Panic due to deleting devices twice

Peter Jeremy PeterJeremy at
Mon Jan 23 13:41:57 PST 2006

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 

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) {
                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);
        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

More information about the freebsd-current mailing list