Revert "i2c: core: Lock address during client device instantiation"

This reverts commit 316be4911f which is
commit 8d3cefaf65 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: Ib9858d534bbb26acb771c5f7344d8494b86c9b27
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2024-10-10 13:02:25 +00:00
parent ba4a8a450d
commit 988aef386e
2 changed files with 0 additions and 31 deletions

View File

@ -915,27 +915,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
@ -983,10 +962,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)
@ -1018,8 +993,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:
@ -1031,7 +1004,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);

View File

@ -748,9 +748,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)