summaryrefslogtreecommitdiffstats
path: root/sys/dev/aac
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2013-08-06 19:14:02 +0000
committermarius <marius@FreeBSD.org>2013-08-06 19:14:02 +0000
commit281e37952d1ff13b3d56914bf7e8c9a8dc15460a (patch)
treea299d3802d6468cc680a281ed7261ac0928b7c82 /sys/dev/aac
parent576dff05bc71310c08c877c6555692807f2a997e (diff)
downloadFreeBSD-src-281e37952d1ff13b3d56914bf7e8c9a8dc15460a.zip
FreeBSD-src-281e37952d1ff13b3d56914bf7e8c9a8dc15460a.tar.gz
- Fix a bug in the MSI allocation logic so an MSI is also employed if a
controller supports only a single message. I haven't seen such an adapter out in the wild, though, so this change likely is a NOP. While at it, further simplify the MSI allocation logic; there's no need to check the number of available messages on our own as pci_alloc_msi(9) will just fail if it can't provide us with the single message we want. - Nuke the unused softc of aacch(4). MFC after: 1 month
Diffstat (limited to 'sys/dev/aac')
-rw-r--r--sys/dev/aac/aac_pci.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/sys/dev/aac/aac_pci.c b/sys/dev/aac/aac_pci.c
index b738383..ccf537e 100644
--- a/sys/dev/aac/aac_pci.c
+++ b/sys/dev/aac/aac_pci.c
@@ -425,18 +425,13 @@ aac_pci_attach(device_t dev)
* Allocate the interrupt.
*/
rid = 0;
- count = 0;
- if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0 &&
- (count = pci_msi_count(dev)) != 0) {
- if (count > 1)
- count = 1;
- else
- count = 0;
- if (count == 1 && pci_alloc_msi(dev, &count) == 0)
+ if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0) {
+ count = 1;
+ if (pci_alloc_msi(dev, &count) == 0)
rid = 1;
}
if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ,
- &rid, RF_ACTIVE | (count != 0 ? 0 : RF_SHAREABLE))) == NULL) {
+ &rid, RF_ACTIVE | (rid != 0 ? 0 : RF_SHAREABLE))) == NULL) {
device_printf(dev, "can't allocate interrupt\n");
goto out;
}
@@ -489,14 +484,10 @@ static device_method_t aacch_methods[] = {
DEVMETHOD_END
};
-struct aacch_softc {
- device_t dev;
-};
-
static driver_t aacch_driver = {
"aacch",
aacch_methods,
- sizeof(struct aacch_softc)
+ 1 /* no softc */
};
static devclass_t aacch_devclass;
@@ -515,19 +506,14 @@ aacch_probe(device_t dev)
}
static int
-aacch_attach(device_t dev)
+aacch_attach(device_t dev __unused)
{
- struct aacch_softc *sc;
-
- sc = device_get_softc(dev);
-
- sc->dev = dev;
return (0);
}
static int
-aacch_detach(device_t dev)
+aacch_detach(device_t dev __unused)
{
return (0);
OpenPOWER on IntegriCloud