diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-12-06 11:06:24 -0500 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-06 11:06:24 -0500 |
commit | c7b25a9e96dc89954ae8d8f473f56fae62030f84 (patch) | |
tree | cc1f924445517a16e3923112e77edbfe33cd3b25 /drivers | |
parent | abe38388e50f4d89726fd0c0cceea61563c7026b (diff) |
i2c: Drop probe, ignore and force module parameters
The legacy probe and force module parameters are obsolete now, the
same can be achieved using the new_device sysfs interface, which is
both more flexible and cheaper (it is implemented by i2c-core rather
than replicated in every driver module.)
The legacy ignore module parameters can be dropped as well. Ignoring
can be done by instantiating a "dummy" device at the problematic
address.
This is the first step of a huge cleanup to i2c-core's i2c_detect
function, i2c.h's I2C_CLIENT_INSMOD* macros, and all drivers that made
use of them.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/i2c-core.c | 65 |
1 files changed, 1 insertions, 64 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index d664b4a97a31..fdfaebdf3bfe 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1259,40 +1259,13 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver) | |||
1259 | return -ENOMEM; | 1259 | return -ENOMEM; |
1260 | temp_client->adapter = adapter; | 1260 | temp_client->adapter = adapter; |
1261 | 1261 | ||
1262 | /* Force entries are done first, and are not affected by ignore | ||
1263 | entries */ | ||
1264 | if (address_data->forces) { | ||
1265 | const unsigned short * const *forces = address_data->forces; | ||
1266 | int kind; | ||
1267 | |||
1268 | for (kind = 0; forces[kind]; kind++) { | ||
1269 | for (i = 0; forces[kind][i] != I2C_CLIENT_END; | ||
1270 | i += 2) { | ||
1271 | if (forces[kind][i] == adap_id | ||
1272 | || forces[kind][i] == ANY_I2C_BUS) { | ||
1273 | dev_dbg(&adapter->dev, "found force " | ||
1274 | "parameter for adapter %d, " | ||
1275 | "addr 0x%02x, kind %d\n", | ||
1276 | adap_id, forces[kind][i + 1], | ||
1277 | kind); | ||
1278 | temp_client->addr = forces[kind][i + 1]; | ||
1279 | err = i2c_detect_address(temp_client, | ||
1280 | kind, driver); | ||
1281 | if (err) | ||
1282 | goto exit_free; | ||
1283 | } | ||
1284 | } | ||
1285 | } | ||
1286 | } | ||
1287 | |||
1288 | /* Stop here if the classes do not match */ | 1262 | /* Stop here if the classes do not match */ |
1289 | if (!(adapter->class & driver->class)) | 1263 | if (!(adapter->class & driver->class)) |
1290 | goto exit_free; | 1264 | goto exit_free; |
1291 | 1265 | ||
1292 | /* Stop here if we can't use SMBUS_QUICK */ | 1266 | /* Stop here if we can't use SMBUS_QUICK */ |
1293 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { | 1267 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { |
1294 | if (address_data->probe[0] == I2C_CLIENT_END | 1268 | if (address_data->normal_i2c[0] == I2C_CLIENT_END) |
1295 | && address_data->normal_i2c[0] == I2C_CLIENT_END) | ||
1296 | goto exit_free; | 1269 | goto exit_free; |
1297 | 1270 | ||
1298 | dev_warn(&adapter->dev, "SMBus Quick command not supported, " | 1271 | dev_warn(&adapter->dev, "SMBus Quick command not supported, " |
@@ -1301,43 +1274,7 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver) | |||
1301 | goto exit_free; | 1274 | goto exit_free; |
1302 | } | 1275 | } |
1303 | 1276 | ||
1304 | /* Probe entries are done second, and are not affected by ignore | ||
1305 | entries either */ | ||
1306 | for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { | ||
1307 | if (address_data->probe[i] == adap_id | ||
1308 | || address_data->probe[i] == ANY_I2C_BUS) { | ||
1309 | dev_dbg(&adapter->dev, "found probe parameter for " | ||
1310 | "adapter %d, addr 0x%02x\n", adap_id, | ||
1311 | address_data->probe[i + 1]); | ||
1312 | temp_client->addr = address_data->probe[i + 1]; | ||
1313 | err = i2c_detect_address(temp_client, -1, driver); | ||
1314 | if (err) | ||
1315 | goto exit_free; | ||
1316 | } | ||
1317 | } | ||
1318 | |||
1319 | /* Normal entries are done last, unless shadowed by an ignore entry */ | ||
1320 | for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) { | 1277 | for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) { |
1321 | int j, ignore; | ||
1322 | |||
1323 | ignore = 0; | ||
1324 | for (j = 0; address_data->ignore[j] != I2C_CLIENT_END; | ||
1325 | j += 2) { | ||
1326 | if ((address_data->ignore[j] == adap_id || | ||
1327 | address_data->ignore[j] == ANY_I2C_BUS) | ||
1328 | && address_data->ignore[j + 1] | ||
1329 | == address_data->normal_i2c[i]) { | ||
1330 | dev_dbg(&adapter->dev, "found ignore " | ||
1331 | "parameter for adapter %d, " | ||
1332 | "addr 0x%02x\n", adap_id, | ||
1333 | address_data->ignore[j + 1]); | ||
1334 | ignore = 1; | ||
1335 | break; | ||
1336 | } | ||
1337 | } | ||
1338 | if (ignore) | ||
1339 | continue; | ||
1340 | |||
1341 | dev_dbg(&adapter->dev, "found normal entry for adapter %d, " | 1278 | dev_dbg(&adapter->dev, "found normal entry for adapter %d, " |
1342 | "addr 0x%02x\n", adap_id, | 1279 | "addr 0x%02x\n", adap_id, |
1343 | address_data->normal_i2c[i]); | 1280 | address_data->normal_i2c[i]); |