PERFORCE change 94873 for review
John-Mark Gurney
jmg at FreeBSD.org
Sun Apr 9 21:41:58 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=94873
Change 94873 by jmg at jmg_arlene on 2006/04/09 21:41:32
remeber, you rarely need to call device_get_parent(), as all the
bus_* calls take yourself, and automaticly call your parent's
routine w/ your device_t..
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#33 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#33 (text+ko) ====
@@ -380,12 +380,10 @@
int flags, driver_intr_t *intr, void *arg, void **cookiep)
{
struct hvpci_softc *sc;
- device_t parent;
int pciintr, rid;
int error;
sc = device_get_softc(dev);
- parent = device_get_parent(dev);
/* we use 0 through 3 for INTx interrupts, while sun uses 1 through 4 */
pciintr = rman_get_start(ires);
@@ -395,16 +393,16 @@
if (sc->hs_intr[pciintr] != NULL)
return (EBUSY);
- if ((sc->hs_intr[pciintr] = bus_alloc_resource_any(parent, SYS_RES_IRQ,
+ if ((sc->hs_intr[pciintr] = bus_alloc_resource_any(dev, SYS_RES_IRQ,
&rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) {
device_printf(dev, "couldn't alloc interrupt\n");
return (ENXIO);
}
- error = bus_setup_intr(parent, sc->hs_intr[pciintr], flags, intr, arg,
+ error = bus_setup_intr(dev, sc->hs_intr[pciintr], flags, intr, arg,
cookiep);
if (error) {
- bus_release_resource(parent, SYS_RES_IRQ,
+ bus_release_resource(dev, SYS_RES_IRQ,
rman_get_rid(sc->hs_intr[pciintr]), sc->hs_intr[pciintr]);
sc->hs_intr[pciintr] = NULL;
device_printf(dev, "bus_setup_intr: %d\n", error);
@@ -419,19 +417,17 @@
void *cookie)
{
struct hvpci_softc *sc;
- device_t parent;
int pciintr;
int error;
sc = device_get_softc(dev);
- parent = device_get_parent(dev);
pciintr = rman_get_start(vec);
- error = bus_teardown_intr(parent, sc->hs_intr[pciintr], cookie);
+ error = bus_teardown_intr(dev, sc->hs_intr[pciintr], cookie);
if (error)
return (error);
- bus_release_resource(parent, SYS_RES_IRQ,
+ bus_release_resource(dev, SYS_RES_IRQ,
rman_get_rid(sc->hs_intr[pciintr]), sc->hs_intr[pciintr]);
sc->hs_intr[pciintr] = NULL;
More information about the p4-projects
mailing list