[i2c] [patch 1/5] i2c stack can probe()
David Brownell
david-b at pacbell.net
Sat Mar 3 18:54:32 CET 2007
On Saturday 03 March 2007 1:58 am, Jean Delvare wrote:
> On Fri, 2 Mar 2007 12:24:46 -0800, David Brownell wrote:
> > On Friday 02 March 2007 12:02 pm, Jean Delvare wrote:
> > > > No, and in fact that's the only change I made in my local copy of
> > > > these patches: replacing that test with one to return early for legacy
> > > > drivers, since they can't hotplug:
> > > >
> > > > if (dev->driver)
> > > > return 0;
> > >
> > > You really mean if (!dev->driver)?
> >
> > No; until the driver core gets a flag saying "legacy, beware!" the
> > only way we could possibly know that we don't need to kick in the
> > MODALIAS environment variable stuff -- for the load-a-driver part
> > of hotplugging -- is to notice that the device was created with a
> > driver already bound to it. (If the legacy paths don't do that yet,
> > we can make them do that.)
>
> Ah, OK, makes sense now. Sorry for being slow ;) I don't know what the
> legacy paths do exactly, so you'll have to check it out.
I did; they do. It was the very earliest patches that didn't get
that right, that's been fixed since early December, when Scott Wood
pointed out the need to keep both driver pointers in sync.
The basic issue was that i2c_client.driver isn't needed, because
i2c_client.dev.driver suffices ... in the same way, we don't need
both i2c_client.adapter and i2c_client.dev.parent; or the driver
model refcount and i2c_client.usage_count for that matter. When
that duplication vanishes, such questions will vanish. :)
> That being said, if we remove this check, what will happen is that we
> will request a driver to be loaded while it is already loaded (or
> actually just being loaded.) Would this lead to a deadlock, or is it
> only suboptimal?
With I2C, it's probably just sub-optimal. With some other busses,
when legacy driver probe() fails it can make trouble because of a
hotplug/modprobe loop. Since it's easy to prevent the issue from
coming up here, I wanted to be mildly paranoid.
- Dave
More information about the i2c
mailing list