[i2c] [PATCH 1/2] i2c: Drop redundant i2c_adapter.list
Jean Delvare
khali at linux-fr.org
Wed Dec 5 21:23:41 CET 2007
On Wed, 5 Dec 2007 11:54:27 -0800, David Brownell wrote:
> On Wednesday 05 December 2007, Jean Delvare wrote:
> > @@ -592,7 +583,8 @@ int i2c_register_driver(struct module *o
> > if (driver->attach_adapter) {
> > struct i2c_adapter *adapter;
> >
> > - list_for_each_entry(adapter, &adapters, list) {
> > + list_for_each_entry(adapter, &i2c_adapter_class.devices,
> > + dev.node) {
> > driver->attach_adapter(adapter);
> > }
> > }
> >
>
> That's where the driver model class_for_each_dev() primitive
> should be used. Except ... that primitive still doesn't exist!!
I searched for this primitive as well, with no success ;)
> So it's worth adding a comment there that the core_lists lock is
> what prevents that list from changing, rather than anything the
> driver model is providing.
>
> Likewise in the i2c_del_driver() loop.
Good point. I've added a comment explaining this in both functions.
That being said, as a further step, renaming the lock to something that
describes what it protects would not be superfluous.
--
Jean Delvare
More information about the i2c
mailing list