[i2c] i2c-remove-redundant-i2c_client-list.patch
David Brownell
david-b at pacbell.net
Fri Jan 18 11:16:22 CET 2008
On Friday 18 January 2008, Jean Delvare wrote:
> Hi David,
>
> On Thu, 17 Jan 2008 11:59:00 -0800, David Brownell wrote:
> > This goes on top of the patch removing most i2c_adapter.clients usage,
> > updating i2c_attach_client:
> >
> > ...
>
> This looks OK to me, I'll add this to my i2c tree. All it is really
> missing is your Signed-off-by line.
Feel free to cut'n'paste that one from another file. :)
> This gave me the idea of a similar cleanup in i2c_detach_client: I fail
> to see why we hold the clist lock while unregistering the device. What
> do you think of the following cleanup?
Looks OK. Similarly, i2c_new_probed_device() could
use a driver model iterator instead of clist_lock.
Something else to think about: clist_lock isn't used
when iterating over i2c_adapter.clients. Maybe it should
just be removed, and replaced *everywhere* by core_lists...
- Dave
> * * * * *
>
> We only need to hold adapter->clist_lock when we touch the client list.
>
> Signed-off-by: Jean Delvare <khali at linux-fr.org>---
> drivers/i2c/i2c-core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- linux-2.6.24-rc8.orig/drivers/i2c/i2c-core.c 2008-01-18 09:56:07.000000000 +0100
> +++ linux-2.6.24-rc8/drivers/i2c/i2c-core.c 2008-01-18 10:17:01.000000000 +0100
> @@ -768,9 +768,10 @@ int i2c_detach_client(struct i2c_client
>
> mutex_lock(&adapter->clist_lock);
> list_del(&client->list);
> + mutex_unlock(&adapter->clist_lock);
> +
> init_completion(&client->released);
> device_unregister(&client->dev);
> - mutex_unlock(&adapter->clist_lock);
> wait_for_completion(&client->released);
>
> out:
>
>
> --
> Jean Delvare
>
More information about the i2c
mailing list