Commit cf02df77 authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

[PATCH] i2c: Rework client usage count, 3 of 3

Do not limit the usage count of i2c clients to 1. In other words,
change the client usage count behavior from the old I2C_CLIENT_ALLOW_USE
to the old I2C_CLIENT_ALLOW_MULTIPLE_USE. The rationale is that no
driver actually needs the limiting behavior, and the unlimiting
behavior is slightly easier to implement.

Update the documentation to reflect this change.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cde7859b
...@@ -92,6 +92,7 @@ Technical changes: ...@@ -92,6 +92,7 @@ Technical changes:
Drop client->id. Drop client->id.
Drop any 24RF08 corruption prevention you find, as this is now done Drop any 24RF08 corruption prevention you find, as this is now done
at the i2c-core level, and doing it twice voids it. at the i2c-core level, and doing it twice voids it.
Don't add I2C_CLIENT_ALLOW_USE to client->flags, it's the default now.
* [Init] Limits must not be set by the driver (can be done later in * [Init] Limits must not be set by the driver (can be done later in
user-space). Chip should not be reset default (although a module user-space). Chip should not be reset default (although a module
......
...@@ -497,14 +497,9 @@ int i2c_use_client(struct i2c_client *client) ...@@ -497,14 +497,9 @@ int i2c_use_client(struct i2c_client *client)
if (ret) if (ret)
return ret; return ret;
if (client->usage_count > 0)
goto busy;
client->usage_count++; client->usage_count++;
return 0; return 0;
busy:
i2c_dec_use_client(client);
return -EBUSY;
} }
int i2c_release_client(struct i2c_client *client) int i2c_release_client(struct i2c_client *client)
......
...@@ -307,9 +307,7 @@ extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id, ...@@ -307,9 +307,7 @@ extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id,
extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *); extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *);
to make sure that client-struct is valid and that it is okay to access to make sure that client-struct is valid and that it is okay to access
the i2c-client. the i2c-client.
returns -EACCES if client doesn't allow use (default) returns -ENODEV if client has gone in the meantime */
returns -EBUSY if client doesn't allow multiple use (default) and
usage_count >0 */
extern int i2c_use_client(struct i2c_client *); extern int i2c_use_client(struct i2c_client *);
extern int i2c_release_client(struct i2c_client *); extern int i2c_release_client(struct i2c_client *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment