This patch addresses i2c_enable's inconsistency regarding when it
increments its index for the cx25840 and saa7127 modules. The patch
moves the skip to the pre-probe rather than after, which means the
i2c_enable index will increment once for every ALGO_BIT | HW_B_BT848
adapter installed, rather than just when chips are present and not
already in use.
Full dissertation on the topic can be found here
http://gossamer-threads.com/lists/ivtv/devel/22277
Index: driver/saa7127.c
===================================================================
--- driver/saa7127.c (revision 339)
+++ driver/saa7127.c (working copy)
@@ -738,12 +738,6 @@
dprintk(1, "detecting saa7127 client on address 0x%x\n", address << 1);
- if (i2c_enable[saa7127_i2c_id++] == -1) {
- dprintk(1, "saa7127 client id: saa7127_i2c_id %d, skipped\n",
- saa7127_i2c_id-1);
- return 0;
- }
-
/* Check if the adapter supports the needed features */
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return (0);
@@ -830,9 +824,16 @@
static int saa7127_attach_adapter(struct i2c_adapter *adapter)
{
- dprintk(2, "starting probe for adapter %s (0x%x)\n", adapter->name,
- adapter->id);
- return i2c_probe(adapter, &addr_data, &saa7127_detect_client);
+ if (adapter->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) {
+ if (i2c_enable[saa7127_i2c_id++] == -1) {
+ dprintk(1, "skipping probe on adapter %s (0x%x)\n",
+ adapter->name, adapter->id);
+ } else {
+ dprintk(1, "starting probe on adapter %s (0x%x)\n",
+ adapter->name, adapter->id);
+ return i2c_probe(adapter, &addr_data,
&saa7127_detect_client);
+ }
+ }
return 0;
}
Index: driver/cx25840-driver.c
===================================================================
--- driver/cx25840-driver.c (revision 339)
+++ driver/cx25840-driver.c (working copy)
@@ -1017,12 +1017,6 @@
DEBUG(0, "detecting cx25840 client on address 0x%x", address << 1);
- if (i2c_enable[cx25840_i2c_id++] == -1) {
- DEBUG(0, "client id: cx25840_i2c_id %d, skipped",
- cx25840_i2c_id - 1);
- return 0;
- }
-
/* Check if the adapter supports the needed features
* Not until kernel version 2.6.11 did the bit-algo
* correctly report that it would do an I2C-level xfer */
@@ -1096,9 +1090,14 @@
static int cx25840_attach_adapter(struct i2c_adapter *adapter)
{
if (adapter->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) {
- DEBUG(1, "starting probe for adapter %s (0x%x)", adapter->name,
- adapter->id);
- return i2c_probe(adapter, &addr_data, &cx25840_detect_client);
+ if (i2c_enable[cx25840_i2c_id++] == -1) {
+ DEBUG(1, "skipping probe on adapter %s (0x%x)",
+ adapter->name, adapter->id);
+ } else {
+ DEBUG(1, "starting probe on adapter %s (0x%x)",
+ adapter->name, adapter->id);
+ return i2c_probe(adapter, &addr_data,
&cx25840_detect_client);
+ }
}
return 0;
}