mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
Revert "i2c: core: Lock address during client device instantiation"
This reverts commit e2852a0246 which is
commit 8d3cefaf659265aa82b0373a563fdb9d16a2b947 upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: I79971fdc8bf43c4d141d5a9780d9c6795da484b9
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -919,27 +919,6 @@ int i2c_dev_irq_from_resources(const struct resource *resources,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Serialize device instantiation in case it can be instantiated explicitly
|
||||
* and by auto-detection
|
||||
*/
|
||||
static int i2c_lock_addr(struct i2c_adapter *adap, unsigned short addr,
|
||||
unsigned short flags)
|
||||
{
|
||||
if (!(flags & I2C_CLIENT_TEN) &&
|
||||
test_and_set_bit(addr, adap->addrs_in_instantiation))
|
||||
return -EBUSY;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void i2c_unlock_addr(struct i2c_adapter *adap, unsigned short addr,
|
||||
unsigned short flags)
|
||||
{
|
||||
if (!(flags & I2C_CLIENT_TEN))
|
||||
clear_bit(addr, adap->addrs_in_instantiation);
|
||||
}
|
||||
|
||||
/**
|
||||
* i2c_new_client_device - instantiate an i2c device
|
||||
* @adap: the adapter managing the device
|
||||
@@ -987,10 +966,6 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf
|
||||
goto out_err_silent;
|
||||
}
|
||||
|
||||
status = i2c_lock_addr(adap, client->addr, client->flags);
|
||||
if (status)
|
||||
goto out_err_silent;
|
||||
|
||||
/* Check for address business */
|
||||
status = i2c_check_addr_busy(adap, i2c_encode_flags_to_addr(client));
|
||||
if (status)
|
||||
@@ -1022,8 +997,6 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf
|
||||
dev_dbg(&adap->dev, "client [%s] registered with bus id %s\n",
|
||||
client->name, dev_name(&client->dev));
|
||||
|
||||
i2c_unlock_addr(adap, client->addr, client->flags);
|
||||
|
||||
return client;
|
||||
|
||||
out_remove_swnode:
|
||||
@@ -1035,7 +1008,6 @@ out_err:
|
||||
dev_err(&adap->dev,
|
||||
"Failed to register i2c client %s at 0x%02x (%d)\n",
|
||||
client->name, client->addr, status);
|
||||
i2c_unlock_addr(adap, client->addr, client->flags);
|
||||
out_err_silent:
|
||||
if (need_put)
|
||||
put_device(&client->dev);
|
||||
|
||||
@@ -752,9 +752,6 @@ struct i2c_adapter {
|
||||
struct regulator *bus_regulator;
|
||||
|
||||
struct dentry *debugfs;
|
||||
|
||||
/* 7bit address space */
|
||||
DECLARE_BITMAP(addrs_in_instantiation, 1 << 7);
|
||||
};
|
||||
#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user