tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: introduce device_is_attached()
On Mon, Apr 16, 2012 at 06:52:28PM +0200, Christoph Egger wrote:
>
> Hi,
>
> I want to introduce a new function to sys/devices.h:
>
> bool device_is_attached(device_t parent, cfdata_t cf);
>
> The purpose is for bus drivers who wants to attach children
> and ensure that only one instance of it will attach.
>
> 'parent' is the bus driver and 'cf' is the child device
> as passed to the submatch callback via config_search_loc().
>
> The return value is true if the child is already attached.
>
> I implemented a reference usage of it in amdnb_misc.c to ensure
> that amdtemp only attaches once on rescan.
Don't add that function. Just use a small amdnb_misc softc to track
whether or not the amdtemp is attached or not:
struct amdnb_misc_softc {
device_t sc_amdtemp;
};
Don't pass a pci_attach_args to amdtemp. Just pass it the chipset tag
and PCI tag if that is all that it needs.
I'm not sure I fully understand the purpose of amdnb_miscbus.
Are all of the functions that do/will attach at amdnb_miscbus
configuration-space only functions, or are they something else? Please
explain what amdnb_miscbus is for.
Dave
--
David Young
dyoung%pobox.com@localhost Urbana, IL (217) 721-9981
Home |
Main Index |
Thread Index |
Old Index