mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-08 02:15:20 +02:00
Revert "i2c: core: Lock address during client device instantiation"
This reverts commit316be4911f
which is commit8d3cefaf65
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:
parent
ba4a8a450d
commit
988aef386e
|
@ -915,27 +915,6 @@ int i2c_dev_irq_from_resources(const struct resource *resources,
|
||||||
return 0;
|
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
|
* i2c_new_client_device - instantiate an i2c device
|
||||||
* @adap: the adapter managing the 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;
|
goto out_err_silent;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = i2c_lock_addr(adap, client->addr, client->flags);
|
|
||||||
if (status)
|
|
||||||
goto out_err_silent;
|
|
||||||
|
|
||||||
/* Check for address business */
|
/* Check for address business */
|
||||||
status = i2c_check_addr_busy(adap, i2c_encode_flags_to_addr(client));
|
status = i2c_check_addr_busy(adap, i2c_encode_flags_to_addr(client));
|
||||||
if (status)
|
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",
|
dev_dbg(&adap->dev, "client [%s] registered with bus id %s\n",
|
||||||
client->name, dev_name(&client->dev));
|
client->name, dev_name(&client->dev));
|
||||||
|
|
||||||
i2c_unlock_addr(adap, client->addr, client->flags);
|
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
|
|
||||||
out_remove_swnode:
|
out_remove_swnode:
|
||||||
|
@ -1031,7 +1004,6 @@ out_err:
|
||||||
dev_err(&adap->dev,
|
dev_err(&adap->dev,
|
||||||
"Failed to register i2c client %s at 0x%02x (%d)\n",
|
"Failed to register i2c client %s at 0x%02x (%d)\n",
|
||||||
client->name, client->addr, status);
|
client->name, client->addr, status);
|
||||||
i2c_unlock_addr(adap, client->addr, client->flags);
|
|
||||||
out_err_silent:
|
out_err_silent:
|
||||||
if (need_put)
|
if (need_put)
|
||||||
put_device(&client->dev);
|
put_device(&client->dev);
|
||||||
|
|
|
@ -748,9 +748,6 @@ struct i2c_adapter {
|
||||||
struct regulator *bus_regulator;
|
struct regulator *bus_regulator;
|
||||||
|
|
||||||
struct dentry *debugfs;
|
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)
|
#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user