i2c: Kill the redundant client list
We used to maintain our own per-adapter list of i2c clients, but this is redundant with what the driver core does, and no longer needed. Just drop the redundant list. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: David Brownell <dbrownell@users.sourceforge.net>
This commit is contained in:
parent
1e40ac12da
commit
e549c2b54d
2 changed files with 11 additions and 21 deletions
|
@ -276,10 +276,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
|
||||||
if (status)
|
if (status)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
mutex_lock(&adap->clist_lock);
|
|
||||||
list_add_tail(&client->list, &adap->clients);
|
|
||||||
mutex_unlock(&adap->clist_lock);
|
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
|
@ -301,12 +297,6 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
|
||||||
*/
|
*/
|
||||||
void i2c_unregister_device(struct i2c_client *client)
|
void i2c_unregister_device(struct i2c_client *client)
|
||||||
{
|
{
|
||||||
struct i2c_adapter *adapter = client->adapter;
|
|
||||||
|
|
||||||
mutex_lock(&adapter->clist_lock);
|
|
||||||
list_del(&client->list);
|
|
||||||
mutex_unlock(&adapter->clist_lock);
|
|
||||||
|
|
||||||
device_unregister(&client->dev);
|
device_unregister(&client->dev);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(i2c_unregister_device);
|
EXPORT_SYMBOL_GPL(i2c_unregister_device);
|
||||||
|
@ -432,8 +422,6 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
mutex_init(&adap->bus_lock);
|
mutex_init(&adap->bus_lock);
|
||||||
mutex_init(&adap->clist_lock);
|
|
||||||
INIT_LIST_HEAD(&adap->clients);
|
|
||||||
|
|
||||||
mutex_lock(&core_lock);
|
mutex_lock(&core_lock);
|
||||||
|
|
||||||
|
@ -583,6 +571,14 @@ static int i2c_do_del_adapter(struct device_driver *d, void *data)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __unregister_client(struct device *dev, void *dummy)
|
||||||
|
{
|
||||||
|
struct i2c_client *client = i2c_verify_client(dev);
|
||||||
|
if (client)
|
||||||
|
i2c_unregister_device(client);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* i2c_del_adapter - unregister I2C adapter
|
* i2c_del_adapter - unregister I2C adapter
|
||||||
* @adap: the adapter being unregistered
|
* @adap: the adapter being unregistered
|
||||||
|
@ -593,7 +589,6 @@ static int i2c_do_del_adapter(struct device_driver *d, void *data)
|
||||||
*/
|
*/
|
||||||
int i2c_del_adapter(struct i2c_adapter *adap)
|
int i2c_del_adapter(struct i2c_adapter *adap)
|
||||||
{
|
{
|
||||||
struct i2c_client *client, *_n;
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
mutex_lock(&core_lock);
|
mutex_lock(&core_lock);
|
||||||
|
@ -612,10 +607,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
|
||||||
if (res)
|
if (res)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
/* Detach any active clients */
|
/* Detach any active clients. This can't fail, thus we do not
|
||||||
list_for_each_entry_safe_reverse(client, _n, &adap->clients, list) {
|
checking the returned value. */
|
||||||
i2c_unregister_device(client);
|
res = device_for_each_child(&adap->dev, NULL, __unregister_client);
|
||||||
}
|
|
||||||
|
|
||||||
/* clean up the sysfs representation */
|
/* clean up the sysfs representation */
|
||||||
init_completion(&adap->dev_released);
|
init_completion(&adap->dev_released);
|
||||||
|
|
|
@ -178,7 +178,6 @@ struct i2c_driver {
|
||||||
* @driver: device's driver, hence pointer to access routines
|
* @driver: device's driver, hence pointer to access routines
|
||||||
* @dev: Driver model device node for the slave.
|
* @dev: Driver model device node for the slave.
|
||||||
* @irq: indicates the IRQ generated by this device (if any)
|
* @irq: indicates the IRQ generated by this device (if any)
|
||||||
* @list: list of active/busy clients (DEPRECATED)
|
|
||||||
* @detected: member of an i2c_driver.clients list
|
* @detected: member of an i2c_driver.clients list
|
||||||
*
|
*
|
||||||
* An i2c_client identifies a single device (i.e. chip) connected to an
|
* An i2c_client identifies a single device (i.e. chip) connected to an
|
||||||
|
@ -195,7 +194,6 @@ struct i2c_client {
|
||||||
struct i2c_driver *driver; /* and our access routines */
|
struct i2c_driver *driver; /* and our access routines */
|
||||||
struct device dev; /* the device structure */
|
struct device dev; /* the device structure */
|
||||||
int irq; /* irq issued by device */
|
int irq; /* irq issued by device */
|
||||||
struct list_head list; /* DEPRECATED */
|
|
||||||
struct list_head detected;
|
struct list_head detected;
|
||||||
};
|
};
|
||||||
#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
|
#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
|
||||||
|
@ -339,14 +337,12 @@ struct i2c_adapter {
|
||||||
/* data fields that are valid for all devices */
|
/* data fields that are valid for all devices */
|
||||||
u8 level; /* nesting level for lockdep */
|
u8 level; /* nesting level for lockdep */
|
||||||
struct mutex bus_lock;
|
struct mutex bus_lock;
|
||||||
struct mutex clist_lock;
|
|
||||||
|
|
||||||
int timeout; /* in jiffies */
|
int timeout; /* in jiffies */
|
||||||
int retries;
|
int retries;
|
||||||
struct device dev; /* the adapter device */
|
struct device dev; /* the adapter device */
|
||||||
|
|
||||||
int nr;
|
int nr;
|
||||||
struct list_head clients; /* DEPRECATED */
|
|
||||||
char name[48];
|
char name[48];
|
||||||
struct completion dev_released;
|
struct completion dev_released;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue