Remove I2C core state that duplicates driver model state:  a list of
children of a given adapter (i2c_adapter.clients, i2c_client.list) and
a lock (i2c_adapter.clist_lock) protecting it.

Depends on the previous patch which removes the last uses of this list.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>
---
Also presumes there are no more users of this list outside i2c-core;
ISTR that was fixed some time ago.  But maybe that's wrong.

 drivers/i2c/i2c-core.c |   15 ---------------
 include/linux/i2c.h    |    4 ----
 2 files changed, 19 deletions(-)

--- g26.orig/drivers/i2c/i2c-core.c     2008-05-04 20:55:46.000000000 -0700
+++ g26/drivers/i2c/i2c-core.c  2008-05-04 20:55:55.000000000 -0700
@@ -310,7 +310,6 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
  */
 void i2c_unregister_device(struct i2c_client *client)
 {
-       struct i2c_adapter      *adapter = client->adapter;
        struct i2c_driver       *driver = client->driver;
 
        if (driver && !is_newstyle_driver(driver)) {
@@ -320,10 +319,6 @@ void i2c_unregister_device(struct i2c_cl
                return;
        }
 
-       mutex_lock(&adapter->clist_lock);
-       list_del(&client->list);
-       mutex_unlock(&adapter->clist_lock);
-
        device_unregister(&client->dev);
 }
 EXPORT_SYMBOL_GPL(i2c_unregister_device);
@@ -551,8 +546,6 @@ static int i2c_register_adapter(struct i
        int res = 0, dummy;
 
        mutex_init(&adap->bus_lock);
-       mutex_init(&adap->clist_lock);
-       INIT_LIST_HEAD(&adap->clients);
 
        /* Setup SMBALERT# infrastructure. */
        INIT_WORK(&adap->alert, smbus_alert);
@@ -962,10 +955,6 @@ int i2c_attach_client(struct i2c_client 
        if (res)
                goto out_err;
 
-       mutex_lock(&adapter->clist_lock);
-       list_add_tail(&client->list, &adapter->clients);
-       mutex_unlock(&adapter->clist_lock);
-
        dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n",
                client->name, client->dev.bus_id);
 
@@ -1001,10 +990,6 @@ int i2c_detach_client(struct i2c_client 
                }
        }
 
-       mutex_lock(&adapter->clist_lock);
-       list_del(&client->list);
-       mutex_unlock(&adapter->clist_lock);
-
        init_completion(&client->released);
        device_unregister(&client->dev);
        wait_for_completion(&client->released);
--- g26.orig/include/linux/i2c.h        2008-05-04 20:55:46.000000000 -0700
+++ g26/include/linux/i2c.h     2008-05-04 20:55:55.000000000 -0700
@@ -163,7 +163,6 @@ struct i2c_driver {
  * @irq: indicates the IRQ generated by this device (if any)
  * @driver_name: Identifies new-style driver used with this device; also
  *     used as the module name for hotplug/coldplug modprobe support.
- * @list: list of active/busy clients (DEPRECATED)
  * @released: used to synchronize client releases & detaches and references
  *
  * An i2c_client identifies a single device (i.e. chip) connected to an
@@ -181,7 +180,6 @@ struct i2c_client {
        struct device dev;              /* the device structure         */
        int irq;                        /* irq issued by device (or -1) */
        char driver_name[KOBJ_NAME_LEN];
-       struct list_head list;          /* DEPRECATED */
        struct completion released;
 };
 #define to_i2c_client(d) container_of(d, struct i2c_client, dev)
@@ -328,14 +326,12 @@ struct i2c_adapter {
        /* data fields that are valid for all devices   */
        u8 level;                       /* nesting level for lockdep */
        struct mutex bus_lock;
-       struct mutex clist_lock;
 
        int timeout;
        int retries;
        struct device dev;              /* the adapter device */
 
        int nr;
-       struct list_head clients;       /* DEPRECATED */
        char name[48];
        struct completion dev_released;
 

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

Reply via email to