Use bus_alloc_resource_any() instead of bus_alloc_resource(). Besides being

cleaner, this fixes problems where the code was using ~0 instead of ~0ul
for the upper bound on "any" resources.

MFC after:	1 month
This commit is contained in:
John Baldwin 2010-12-16 15:19:32 +00:00
parent 1c706be073
commit 7f3384ab34
2 changed files with 14 additions and 16 deletions

View File

@ -198,9 +198,8 @@ ndis_attach_pccard(dev)
resource_list_init(&sc->ndis_rl);
sc->ndis_io_rid = 0;
sc->ndis_res_io = bus_alloc_resource(dev,
SYS_RES_IOPORT, &sc->ndis_io_rid,
0, ~0, 1, RF_ACTIVE);
sc->ndis_res_io = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
&sc->ndis_io_rid, RF_ACTIVE);
if (sc->ndis_res_io == NULL) {
device_printf(dev,
"couldn't map iospace\n");
@ -213,8 +212,7 @@ ndis_attach_pccard(dev)
rman_get_size(sc->ndis_res_io));
rid = 0;
sc->ndis_irq = bus_alloc_resource(dev,
SYS_RES_IRQ, &rid, 0, ~0, 1,
sc->ndis_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE);
if (sc->ndis_irq == NULL) {
device_printf(dev,

View File

@ -192,9 +192,9 @@ ndis_attach_pci(dev)
switch (rle->type) {
case SYS_RES_IOPORT:
sc->ndis_io_rid = rle->rid;
sc->ndis_res_io = bus_alloc_resource(dev,
sc->ndis_res_io = bus_alloc_resource_any(dev,
SYS_RES_IOPORT, &sc->ndis_io_rid,
0, ~0, 1, RF_ACTIVE);
RF_ACTIVE);
if (sc->ndis_res_io == NULL) {
device_printf(dev,
"couldn't map iospace\n");
@ -214,10 +214,10 @@ ndis_attach_pci(dev)
if (sc->ndis_res_mem) {
sc->ndis_altmem_rid = rle->rid;
sc->ndis_res_altmem =
bus_alloc_resource(dev,
bus_alloc_resource_any(dev,
SYS_RES_MEMORY,
&sc->ndis_altmem_rid,
0, ~0, 1, RF_ACTIVE);
RF_ACTIVE);
if (sc->ndis_res_altmem == NULL) {
device_printf(dev,
"couldn't map alt "
@ -228,10 +228,10 @@ ndis_attach_pci(dev)
} else {
sc->ndis_mem_rid = rle->rid;
sc->ndis_res_mem =
bus_alloc_resource(dev,
bus_alloc_resource_any(dev,
SYS_RES_MEMORY,
&sc->ndis_mem_rid,
0, ~0, 1, RF_ACTIVE);
RF_ACTIVE);
if (sc->ndis_res_mem == NULL) {
device_printf(dev,
"couldn't map memory\n");
@ -243,9 +243,9 @@ ndis_attach_pci(dev)
break;
case SYS_RES_IRQ:
rid = rle->rid;
sc->ndis_irq = bus_alloc_resource(dev,
SYS_RES_IRQ, &rid, 0, ~0, 1,
RF_SHAREABLE | RF_ACTIVE);
sc->ndis_irq = bus_alloc_resource_any(dev,
SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE);
if (sc->ndis_irq == NULL) {
device_printf(dev,
"couldn't map interrupt\n");
@ -270,8 +270,8 @@ ndis_attach_pci(dev)
*/
if (sc->ndis_irq == NULL) {
rid = 0;
sc->ndis_irq = bus_alloc_resource(dev, SYS_RES_IRQ,
&rid, 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE);
sc->ndis_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
&rid, RF_SHAREABLE | RF_ACTIVE);
if (sc->ndis_irq == NULL) {
device_printf(dev, "couldn't route interrupt\n");
error = ENXIO;