diff options
-rw-r--r-- | drivers/i2c/i2c-core.c | 18 | ||||
-rw-r--r-- | include/linux/i2c.h | 12 |
2 files changed, 22 insertions, 8 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 550853f79ae8..b346a687ab59 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -108,6 +108,9 @@ static int i2c_device_probe(struct device *dev) | |||
108 | if (!driver->probe || !driver->id_table) | 108 | if (!driver->probe || !driver->id_table) |
109 | return -ENODEV; | 109 | return -ENODEV; |
110 | client->driver = driver; | 110 | client->driver = driver; |
111 | if (!device_can_wakeup(&client->dev)) | ||
112 | device_init_wakeup(&client->dev, | ||
113 | client->flags & I2C_CLIENT_WAKE); | ||
111 | dev_dbg(dev, "probe\n"); | 114 | dev_dbg(dev, "probe\n"); |
112 | 115 | ||
113 | status = driver->probe(client, i2c_match_id(driver->id_table, client)); | 116 | status = driver->probe(client, i2c_match_id(driver->id_table, client)); |
@@ -262,9 +265,8 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) | |||
262 | client->adapter = adap; | 265 | client->adapter = adap; |
263 | 266 | ||
264 | client->dev.platform_data = info->platform_data; | 267 | client->dev.platform_data = info->platform_data; |
265 | device_init_wakeup(&client->dev, info->flags & I2C_CLIENT_WAKE); | ||
266 | 268 | ||
267 | client->flags = info->flags & ~I2C_CLIENT_WAKE; | 269 | client->flags = info->flags; |
268 | client->addr = info->addr; | 270 | client->addr = info->addr; |
269 | client->irq = info->irq; | 271 | client->irq = info->irq; |
270 | 272 | ||
@@ -1188,8 +1190,8 @@ int i2c_probe(struct i2c_adapter *adapter, | |||
1188 | && address_data->normal_i2c[0] == I2C_CLIENT_END) | 1190 | && address_data->normal_i2c[0] == I2C_CLIENT_END) |
1189 | return 0; | 1191 | return 0; |
1190 | 1192 | ||
1191 | dev_warn(&adapter->dev, "SMBus Quick command not supported, " | 1193 | dev_dbg(&adapter->dev, "SMBus Quick command not supported, " |
1192 | "can't probe for chips\n"); | 1194 | "can't probe for chips\n"); |
1193 | return -EOPNOTSUPP; | 1195 | return -EOPNOTSUPP; |
1194 | } | 1196 | } |
1195 | 1197 | ||
@@ -1350,6 +1352,10 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver) | |||
1350 | } | 1352 | } |
1351 | } | 1353 | } |
1352 | 1354 | ||
1355 | /* Stop here if the classes do not match */ | ||
1356 | if (!(adapter->class & driver->class)) | ||
1357 | goto exit_free; | ||
1358 | |||
1353 | /* Stop here if we can't use SMBUS_QUICK */ | 1359 | /* Stop here if we can't use SMBUS_QUICK */ |
1354 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { | 1360 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { |
1355 | if (address_data->probe[0] == I2C_CLIENT_END | 1361 | if (address_data->probe[0] == I2C_CLIENT_END |
@@ -1362,10 +1368,6 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver) | |||
1362 | goto exit_free; | 1368 | goto exit_free; |
1363 | } | 1369 | } |
1364 | 1370 | ||
1365 | /* Stop here if the classes do not match */ | ||
1366 | if (!(adapter->class & driver->class)) | ||
1367 | goto exit_free; | ||
1368 | |||
1369 | /* Probe entries are done second, and are not affected by ignore | 1371 | /* Probe entries are done second, and are not affected by ignore |
1370 | entries either */ | 1372 | entries either */ |
1371 | for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { | 1373 | for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 08be0d21864c..06115128047f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -97,7 +97,19 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, | |||
97 | 97 | ||
98 | /** | 98 | /** |
99 | * struct i2c_driver - represent an I2C device driver | 99 | * struct i2c_driver - represent an I2C device driver |
100 | * @id: Unique driver ID (optional) | ||
100 | * @class: What kind of i2c device we instantiate (for detect) | 101 | * @class: What kind of i2c device we instantiate (for detect) |
102 | * @attach_adapter: Callback for bus addition (for legacy drivers) | ||
103 | * @detach_adapter: Callback for bus removal (for legacy drivers) | ||
104 | * @detach_client: Callback for device removal (for legacy drivers) | ||
105 | * @probe: Callback for device binding (new-style drivers) | ||
106 | * @remove: Callback for device unbinding (new-style drivers) | ||
107 | * @shutdown: Callback for device shutdown | ||
108 | * @suspend: Callback for device suspend | ||
109 | * @resume: Callback for device resume | ||
110 | * @command: Callback for bus-wide signaling (optional) | ||
111 | * @driver: Device driver model driver | ||
112 | * @id_table: List of I2C devices supported by this driver | ||
101 | * @detect: Callback for device detection | 113 | * @detect: Callback for device detection |
102 | * @address_data: The I2C addresses to probe, ignore or force (for detect) | 114 | * @address_data: The I2C addresses to probe, ignore or force (for detect) |
103 | * @clients: List of detected clients we created (for i2c-core use only) | 115 | * @clients: List of detected clients we created (for i2c-core use only) |