From owner-p4-projects@FreeBSD.ORG Sun Apr 9 21:41:57 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BB31516A404; Sun, 9 Apr 2006 21:41:57 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7D04A16A407 for ; Sun, 9 Apr 2006 21:41:57 +0000 (UTC) (envelope-from jmg@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7EAC243D55 for ; Sun, 9 Apr 2006 21:41:56 +0000 (GMT) (envelope-from jmg@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k39LfuA1090857 for ; Sun, 9 Apr 2006 21:41:56 GMT (envelope-from jmg@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k39LfuuG090850 for perforce@freebsd.org; Sun, 9 Apr 2006 21:41:56 GMT (envelope-from jmg@freebsd.org) Date: Sun, 9 Apr 2006 21:41:56 GMT Message-Id: <200604092141.k39LfuuG090850@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmg@freebsd.org using -f From: John-Mark Gurney To: Perforce Change Reviews Cc: Subject: PERFORCE change 94873 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Apr 2006 21:41:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=94873 Change 94873 by jmg@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;