Re: nasty device_delete_child interaction
"M. Warner Losh" <[email protected]> Thu, 29 Jan 2004 09:11:09 -0700 (MST)
| Newsgroups | gmane.os.freebsd.devel.new-bus |
|---|---|
| Message-ID | <[email protected]> |
In message: <[email protected]> John Baldwin <[email protected]> writes: : On Thursday 29 January 2004 01:35 am, John Wehle wrote: : > device_delete_child works by starting with the grandchildren : > working back towards the immediate child. Several drivers : > (i.e. if_xl.c, if_wx.c, iicbb.c) have code similar to: : > : > xxx_attach() : > { : > : > ... : > sc->child_dev = device_add_child ... : > } : > : > xxx_detach() : > { : > : > bus_generic_detach (); : > if (sc->child_dev) : > device_delete_child ... : > } Don't do that. You are duplicating the storage of children in two places. If you need to cache a copy of a child, that's fine. However, don't delete it explicitly in xxx_detach. I'd say that these drivers are wrong and should be fixed. : > It seems to me that any driver which calls device_delete_child : > as part of detaching must also implement something like: No. They should avoid the problem by using newbus correctly. This sort of solution just adds code to no good purpose. Warner _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-new-bus To unsubscribe, send any mail to "[email protected]"