Provide the number of interrupt resources added to the list

by using extra argument, so caller will know that.
This commit is contained in:
Ruslan Bukin 2015-05-15 13:55:18 +00:00
parent 5c894ee2ef
commit a8c5ea04b4
8 changed files with 13 additions and 8 deletions

View File

@ -251,7 +251,7 @@ simplebus_setup_dinfo(device_t dev, phandle_t node,
resource_list_init(&ndi->rl);
ofw_bus_reg_to_rl(dev, node, sc->acells, sc->scells, &ndi->rl);
ofw_bus_intr_to_rl(dev, node, &ndi->rl);
ofw_bus_intr_to_rl(dev, node, &ndi->rl, NULL);
return (ndi);
}

View File

@ -147,7 +147,7 @@ ofw_gpiobus_setup_devinfo(device_t bus, device_t child, phandle_t node)
}
free(pins, M_DEVBUF);
/* Parse the interrupt resources. */
if (ofw_bus_intr_to_rl(bus, node, &dinfo->opd_dinfo.rl) != 0) {
if (ofw_bus_intr_to_rl(bus, node, &dinfo->opd_dinfo.rl, NULL) != 0) {
ofw_gpiobus_destroy_devinfo(bus, dinfo);
return (NULL);
}

View File

@ -430,7 +430,8 @@ ofw_bus_reg_to_rl(device_t dev, phandle_t node, pcell_t acells, pcell_t scells,
}
int
ofw_bus_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl)
ofw_bus_intr_to_rl(device_t dev, phandle_t node,
struct resource_list *rl, int *rlen)
{
phandle_t iparent;
uint32_t icells, *intr;
@ -495,6 +496,8 @@ ofw_bus_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl)
irqnum = ofw_bus_map_intr(dev, iparent, icells, &intr[i]);
resource_list_add(rl, SYS_RES_IRQ, rid++, irqnum, irqnum, 1);
}
if (rlen != NULL)
*rlen = rid;
free(intr, M_OFWPROP);
return (err);
}

View File

@ -75,7 +75,7 @@ int ofw_bus_search_intrmap(void *, int, void *, int, void *, int, void *,
/* Routines for parsing device-tree data into resource lists. */
int ofw_bus_reg_to_rl(device_t, phandle_t, pcell_t, pcell_t,
struct resource_list *);
int ofw_bus_intr_to_rl(device_t, phandle_t, struct resource_list *);
int ofw_bus_intr_to_rl(device_t, phandle_t, struct resource_list *, int *);
/* Helper to get device status property */
const char *ofw_bus_get_status(device_t dev);

View File

@ -156,7 +156,8 @@ ofw_iicbus_attach(device_t dev)
childdev = device_add_child(dev, NULL, -1);
resource_list_init(&dinfo->opd_dinfo.rl);
ofw_bus_intr_to_rl(childdev, child, &dinfo->opd_dinfo.rl);
ofw_bus_intr_to_rl(childdev, child,
&dinfo->opd_dinfo.rl, NULL);
device_set_ivars(childdev, dinfo);
}

View File

@ -198,7 +198,7 @@ simplebus_attach(device_t dev)
continue;
}
if (ofw_bus_intr_to_rl(dev, dt_child, &di->di_res)) {
if (ofw_bus_intr_to_rl(dev, dt_child, &di->di_res, NULL)) {
device_printf(dev, "%s: could not process "
"'interrupts' property\n", di->di_ofw.obd_name);
resource_list_free(&di->di_res);

View File

@ -201,7 +201,8 @@ ofw_pcibus_enum_devtree(device_t dev, u_int domain, u_int busno)
* resource list.
*/
if (dinfo->opd_dinfo.cfg.intpin == 0)
ofw_bus_intr_to_rl(dev, child, &dinfo->opd_dinfo.resources);
ofw_bus_intr_to_rl(dev, child,
&dinfo->opd_dinfo.resources, NULL);
}
}

View File

@ -146,7 +146,7 @@ vdevice_attach(device_t dev)
}
resource_list_init(&dinfo->mdi_resources);
ofw_bus_intr_to_rl(dev, child, &dinfo->mdi_resources);
ofw_bus_intr_to_rl(dev, child, &dinfo->mdi_resources, NULL);
cdev = device_add_child(dev, NULL, -1);
if (cdev == NULL) {