Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jan 2004 14:59:02 -0500 (EST)
From:      John Wehle <john@feith.com>
To:        imp@bsdimp.com
Cc:        jhb@FreeBSD.org
Subject:   Re: nasty device_delete_child interaction
Message-ID:  <200401291959.i0TJx2m25103@jwlab.FEITH.COM>

next in thread | raw e-mail | index | archive | help
> 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.

What's the correct approach?

Currently (at least in FreeBSD 4.9) if_xl.c uses device_add_child
in the attach routine to add on miibus.  It then calls device_delete_child
in the detach routine to delete miibus (creating a nice symmetry).

Should if_xl.c still call device_add_child in the attach and simply
not call device_delete_child?  Then who's responsible for deleting
miibus when if_xl is unloaded?

>: > 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.

If the driver has cached a copy of a child, then doesn't
xxx_child_detached still need to be implemented so the driver
knows when the cached copy is invalid?

-- John
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401291959.i0TJx2m25103>