i2c: Limit locking scope in i2c_detach_client
authorJean Delvare <khali@linux-fr.org>
Sun, 27 Jan 2008 17:14:51 +0000 (18:14 +0100)
committerJean Delvare <khali@hyperion.delvare>
Sun, 27 Jan 2008 17:14:51 +0000 (18:14 +0100)
We only need to hold adapter->clist_lock when we touch the client list.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/i2c-core.c

index 824f12c798d6ed2da217158e5b5b610d92369b8f..4765a50d753778ef60463307e16315669e969b85 100644 (file)
@@ -768,9 +768,10 @@ int i2c_detach_client(struct i2c_client *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: