]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/i2c/i2c-core.c
i2c: Set a default timeout value for all adapters
[linux-2.6-omap-h63xx.git] / drivers / i2c / i2c-core.c
index e7d984866de0465f5846225c6b59a0072fec7fd1..e361033815d3ffe8cb2e537d2b39862051ea308c 100644 (file)
@@ -459,6 +459,11 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
                pr_debug("I2C adapter driver [%s] forgot to specify "
                         "physical device\n", adap->name);
        }
+
+       /* Set default timeout to 1 second if not already set */
+       if (adap->timeout == 0)
+               adap->timeout = HZ;
+
        dev_set_name(&adap->dev, "i2c-%d", adap->nr);
        adap->dev.release = &i2c_adapter_dev_release;
        adap->dev.class = &i2c_adapter_class;
@@ -581,7 +586,8 @@ static int i2c_do_del_adapter(struct device_driver *d, void *data)
        struct i2c_client *client, *_n;
        int res;
 
-       /* Remove the devices we created ourselves */
+       /* Remove the devices we created ourselves as the result of hardware
+        * probing (using a driver's detect method) */
        list_for_each_entry_safe(client, _n, &driver->clients, detected) {
                if (client->adapter == adapter) {
                        dev_dbg(&adapter->dev, "Removing %s at 0x%x\n",
@@ -749,6 +755,8 @@ static int __detach_adapter(struct device *dev, void *data)
        struct i2c_driver *driver = data;
        struct i2c_client *client, *_n;
 
+       /* Remove the devices we created ourselves as the result of hardware
+        * probing (using a driver's detect method) */
        list_for_each_entry_safe(client, _n, &driver->clients, detected) {
                dev_dbg(&adapter->dev, "Removing %s at 0x%x\n",
                        client->name, client->addr);
@@ -841,7 +849,7 @@ int i2c_attach_client(struct i2c_client *client)
 
        if (client->driver && !is_newstyle_driver(client->driver)) {
                client->dev.release = i2c_client_release;
-               client->dev.uevent_suppress = 1;
+               dev_set_uevent_suppress(&client->dev, 1);
        } else
                client->dev.release = i2c_client_dev_release;