i2c: remove i2c_lock_adapter and use i2c_lock_bus directly
The i2c_lock_adapter name is ambiguous since it is unclear if it refers to the root adapter or the adapter you name in the argument. The natural interpretation is the adapter you name in the argument, but there are historical reasons for that not being the case; it in fact locks the root adapter. Just remove the function and force users to spell out the I2C_LOCK_ROOT_ADAPTER name to indicate what is really going on. Also remove i2c_unlock_adapter, of course. This patch was generated with git grep -l 'i2c_\(un\)\?lock_adapter' \ | xargs sed -i 's/i2c_\(un\)\?lock_adapter(\([^)]*\))/'\ 'i2c_\1lock_bus(\2, I2C_LOCK_ROOT_ADAPTER)/g' followed by white-space touch-up. Signed-off-by: Peter Rosin <peda@axentia.se> Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com> Tested-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:

committed by
Wolfram Sang

parent
8c8f74f327
commit
3f3a89e1d7
@@ -47,9 +47,9 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
|
||||
|
||||
client->slave_cb = slave_cb;
|
||||
|
||||
i2c_lock_adapter(client->adapter);
|
||||
i2c_lock_bus(client->adapter, I2C_LOCK_ROOT_ADAPTER);
|
||||
ret = client->adapter->algo->reg_slave(client);
|
||||
i2c_unlock_adapter(client->adapter);
|
||||
i2c_unlock_bus(client->adapter, I2C_LOCK_ROOT_ADAPTER);
|
||||
|
||||
if (ret) {
|
||||
client->slave_cb = NULL;
|
||||
@@ -69,9 +69,9 @@ int i2c_slave_unregister(struct i2c_client *client)
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
i2c_lock_adapter(client->adapter);
|
||||
i2c_lock_bus(client->adapter, I2C_LOCK_ROOT_ADAPTER);
|
||||
ret = client->adapter->algo->unreg_slave(client);
|
||||
i2c_unlock_adapter(client->adapter);
|
||||
i2c_unlock_bus(client->adapter, I2C_LOCK_ROOT_ADAPTER);
|
||||
|
||||
if (ret == 0)
|
||||
client->slave_cb = NULL;
|
||||
|
Reference in New Issue
Block a user