tech-kern archive

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

Re: introduce device_is_attached()



On Mon, 16 Apr 2012, 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.

I'm kind of with David Young, surely this is what the softc is for.. so
that the parent can keep track of which resources it has allocated (and by
inference, not reallocate them to another device)

but you could also use the device_properties to store such information?

iain


Home | Main Index | Thread Index | Old Index