Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Jul 2012 14:25:36 +0200
From:      Stefan Bethke <stb@lassitu.de>
To:        Arnaud Lacombe <lacombar@gmail.com>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>, Warner Losh <imp@bsdimp.com>
Subject:   Re: Interfacing devices with multiple parents within newbus
Message-ID:  <A1DF0EAD-65A4-4231-9F4B-08D8443BC241@lassitu.de>
In-Reply-To: <CACqU3MWTKSpVRbJracCjSLVHko8RSpXw6vpC3o3UaAyTizos3A@mail.gmail.com>
References:  <CACqU3MU6iv%2Bo26fCdL5M6Kg6XMM1uZPih5FBiBKPOD9WDx%2BNGg@mail.gmail.com> <FEAC4049-11B0-4B3D-BB7A-0946DBBFF530@bsdimp.com> <CACqU3MWTKSpVRbJracCjSLVHko8RSpXw6vpC3o3UaAyTizos3A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Am 06.07.2012 um 17:33 schrieb Arnaud Lacombe:

> I assume you are talking about =
devclass_get_device()/device_find_child().
>=20
> That's neither correct nor robust in a couple of way:
> 1) you have no guarantee a device unit will always give you the same =
resource.
> 2) there is no reference counting on the returned device.
> 3) there is no track record of the reference being given.
>=20
> About (1), lower unit devices can fails to attach[0], thus newly
> attached bus will now have a negative offset.
>=20
> About (2) and (3), referenced device (think KLD) might go away and the
> child will not be told. In this situation, I want the child to be
> detached prior to its parent.
>=20
> As such, looking up other node by name would fit in what I call
> "bypassing newbus purpose". I might just as well export a damn
> function pointer and make my life easier.

I believe there is one more thing that needs to be addressed, which I =
ran into while trying to do the arge/mdio attachment:

4) the device attach method may require access to the other device to =
complete the attachment, but that other might not be attached yet.

Circular dependencies nonwithstanding, it would be highly desirable for =
a device driver developer to be able to simply declare all prerequisites =
for attachment, and have newbus call attach only after everything is =
there. Right now, the drivers attach method is called by the parent bus =
as soon as enumeration is completed.

A notification mechanism (similar to the devfs notification but with an =
exposed KPI) might be an alternative, as mentioned in this thread.


Stefan

--=20
Stefan Bethke <stb@lassitu.de>   Fon +49 151 14070811






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A1DF0EAD-65A4-4231-9F4B-08D8443BC241>