Date: Tue, 24 Jan 2006 08:41:51 +1100 From: Peter Jeremy <PeterJeremy@optushome.com.au> To: John Baldwin <jhb@freebsd.org> Cc: freebsd-current@freebsd.org Subject: Re: Panic due to deleting devices twice Message-ID: <20060123214151.GO25397@cirb503493.alcatel.com.au> In-Reply-To: <200601231618.04949.jhb@freebsd.org> References: <20060121070706.GA32444@cirb503493.alcatel.com.au> <200601231618.04949.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2006-Jan-23 16:18:03 -0500, John Baldwin wrote: >On Saturday 21 January 2006 02:07, Peter Jeremy wrote: >> Looking at the iicsmb code, it appears that iicbb and iicsmb both >> cache and explicitly delete child devices and therefore both need >> bus_child_detached methods. Is this correct? Is there a simpler >> alternative? > >Can they just call bus_generic_detach() instead and not call >device_delete_child()? The existing code does both: static int iicbb_detach(device_t dev) { struct iicbb_softc *sc = (struct iicbb_softc *)device_get_softc(dev); if (sc->iicbus) { bus_generic_detach(dev); device_delete_child(dev, sc->iicbus); } return (0); } static int iicsmb_detach(device_t dev) { struct iicsmb_softc *sc = (struct iicsmb_softc *)device_get_softc(dev); bus_generic_detach(dev); if (sc->smbus) { device_delete_child(dev, sc->smbus); } return (0); } Maybe a better solution in both cases is to just map device_detach to bus_generic_detach() - in which case my patch in kern/92092 is overly baroque. I was hoping that someone might shed some insight into why it was done that way in the first case. -- Peter Jeremy
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060123214151.GO25397>