aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-08-21 07:28:24 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-21 07:28:24 -0400
commit470fba7ebe60ad9185056b080b331abad24b4df9 (patch)
treef83bc13d97adaf5dd0e0f1d6a157b890f868577f /drivers/i2c/i2c-core.c
parent7225e75144b9718cbbe1820d9c011c809d5773fd (diff)
parent6a55617ed5d1aa62b850de2cf66f5ede2eef4825 (diff)
Merge branch 'linus' into x86/doc
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 7608df83d6d1..550853f79ae8 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -722,7 +722,8 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
722 722
723 INIT_LIST_HEAD(&driver->clients); 723 INIT_LIST_HEAD(&driver->clients);
724 /* Walk the adapters that are already present */ 724 /* Walk the adapters that are already present */
725 class_for_each_device(&i2c_adapter_class, driver, __attach_adapter); 725 class_for_each_device(&i2c_adapter_class, NULL, driver,
726 __attach_adapter);
726 727
727 mutex_unlock(&core_lock); 728 mutex_unlock(&core_lock);
728 return 0; 729 return 0;
@@ -782,7 +783,8 @@ void i2c_del_driver(struct i2c_driver *driver)
782{ 783{
783 mutex_lock(&core_lock); 784 mutex_lock(&core_lock);
784 785
785 class_for_each_device(&i2c_adapter_class, driver, __detach_adapter); 786 class_for_each_device(&i2c_adapter_class, NULL, driver,
787 __detach_adapter);
786 788
787 driver_unregister(&driver->driver); 789 driver_unregister(&driver->driver);
788 pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); 790 pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name);
@@ -811,7 +813,12 @@ static int i2c_check_addr(struct i2c_adapter *adapter, int addr)
811int i2c_attach_client(struct i2c_client *client) 813int i2c_attach_client(struct i2c_client *client)
812{ 814{
813 struct i2c_adapter *adapter = client->adapter; 815 struct i2c_adapter *adapter = client->adapter;
814 int res = 0; 816 int res;
817
818 /* Check for address business */
819 res = i2c_check_addr(adapter, client->addr);
820 if (res)
821 return res;
815 822
816 client->dev.parent = &client->adapter->dev; 823 client->dev.parent = &client->adapter->dev;
817 client->dev.bus = &i2c_bus_type; 824 client->dev.bus = &i2c_bus_type;
@@ -1449,9 +1456,11 @@ i2c_new_probed_device(struct i2c_adapter *adap,
1449 if ((addr_list[i] & ~0x07) == 0x30 1456 if ((addr_list[i] & ~0x07) == 0x30
1450 || (addr_list[i] & ~0x0f) == 0x50 1457 || (addr_list[i] & ~0x0f) == 0x50
1451 || !i2c_check_functionality(adap, I2C_FUNC_SMBUS_QUICK)) { 1458 || !i2c_check_functionality(adap, I2C_FUNC_SMBUS_QUICK)) {
1459 union i2c_smbus_data data;
1460
1452 if (i2c_smbus_xfer(adap, addr_list[i], 0, 1461 if (i2c_smbus_xfer(adap, addr_list[i], 0,
1453 I2C_SMBUS_READ, 0, 1462 I2C_SMBUS_READ, 0,
1454 I2C_SMBUS_BYTE, NULL) >= 0) 1463 I2C_SMBUS_BYTE, &data) >= 0)
1455 break; 1464 break;
1456 } else { 1465 } else {
1457 if (i2c_smbus_xfer(adap, addr_list[i], 0, 1466 if (i2c_smbus_xfer(adap, addr_list[i], 0,