tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: introduce device_is_attached()



On 04/16/12 19:41, Christoph Egger wrote:
On 16.04.12 19:12, Matt Thomas wrote:

On Apr 16, 2012, at 9:52 AM, 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);

I'd prefer device_is_attached_p

Ok, I will rename it.

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.

Can it be used in driver match routines so they don't need to
keep a local to prevent multiple matches?

Oh, good point. I think this is possible and will make
struct amdnb_misc_softc completely superflous.
I will give this a try tomorrow.

Ok, I can confirm it is also usable in the child driver match routines.
However, the local is still needed for the rescan hook.

Christoph


Home | Main Index | Thread Index | Old Index