diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-12-06 11:06:25 -0500 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-06 11:06:25 -0500 |
commit | ccfbbd082a1c71667bead7124591ccd09f08ac90 (patch) | |
tree | 2540e8371dd79afac9ec29707ce9a078a3c004be /drivers/i2c | |
parent | c7b25a9e96dc89954ae8d8f473f56fae62030f84 (diff) |
i2c: Simplify i2c_detect_address
The kind parameter of i2c_detect_address() always has value -1, so we
can get rid of it.
Next step is to update all i2c detect callback functions to get rid of
this now useless parameter.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index fdfaebdf3bfe..37df0f14c38c 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1180,7 +1180,7 @@ EXPORT_SYMBOL(i2c_master_recv); | |||
1180 | * ---------------------------------------------------- | 1180 | * ---------------------------------------------------- |
1181 | */ | 1181 | */ |
1182 | 1182 | ||
1183 | static int i2c_detect_address(struct i2c_client *temp_client, int kind, | 1183 | static int i2c_detect_address(struct i2c_client *temp_client, |
1184 | struct i2c_driver *driver) | 1184 | struct i2c_driver *driver) |
1185 | { | 1185 | { |
1186 | struct i2c_board_info info; | 1186 | struct i2c_board_info info; |
@@ -1199,22 +1199,18 @@ static int i2c_detect_address(struct i2c_client *temp_client, int kind, | |||
1199 | if (i2c_check_addr(adapter, addr)) | 1199 | if (i2c_check_addr(adapter, addr)) |
1200 | return 0; | 1200 | return 0; |
1201 | 1201 | ||
1202 | /* Make sure there is something at this address, unless forced */ | 1202 | /* Make sure there is something at this address */ |
1203 | if (kind < 0) { | 1203 | if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0) |
1204 | if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, | 1204 | return 0; |
1205 | I2C_SMBUS_QUICK, NULL) < 0) | ||
1206 | return 0; | ||
1207 | 1205 | ||
1208 | /* prevent 24RF08 corruption */ | 1206 | /* Prevent 24RF08 corruption */ |
1209 | if ((addr & ~0x0f) == 0x50) | 1207 | if ((addr & ~0x0f) == 0x50) |
1210 | i2c_smbus_xfer(adapter, addr, 0, 0, 0, | 1208 | i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL); |
1211 | I2C_SMBUS_QUICK, NULL); | ||
1212 | } | ||
1213 | 1209 | ||
1214 | /* Finally call the custom detection function */ | 1210 | /* Finally call the custom detection function */ |
1215 | memset(&info, 0, sizeof(struct i2c_board_info)); | 1211 | memset(&info, 0, sizeof(struct i2c_board_info)); |
1216 | info.addr = addr; | 1212 | info.addr = addr; |
1217 | err = driver->detect(temp_client, kind, &info); | 1213 | err = driver->detect(temp_client, -1, &info); |
1218 | if (err) { | 1214 | if (err) { |
1219 | /* -ENODEV is returned if the detection fails. We catch it | 1215 | /* -ENODEV is returned if the detection fails. We catch it |
1220 | here as this isn't an error. */ | 1216 | here as this isn't an error. */ |
@@ -1279,7 +1275,7 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver) | |||
1279 | "addr 0x%02x\n", adap_id, | 1275 | "addr 0x%02x\n", adap_id, |
1280 | address_data->normal_i2c[i]); | 1276 | address_data->normal_i2c[i]); |
1281 | temp_client->addr = address_data->normal_i2c[i]; | 1277 | temp_client->addr = address_data->normal_i2c[i]; |
1282 | err = i2c_detect_address(temp_client, -1, driver); | 1278 | err = i2c_detect_address(temp_client, driver); |
1283 | if (err) | 1279 | if (err) |
1284 | goto exit_free; | 1280 | goto exit_free; |
1285 | } | 1281 | } |