Index: driver/cx25840-driver.c =================================================================== --- driver/cx25840-driver.c (revision 313) +++ driver/cx25840-driver.c (working copy) @@ -126,8 +126,13 @@ u8 buffer[2]; buffer[0] = addr >> 8; buffer[1] = addr & 0xff; - i2c_master_send(client, buffer, 2); - i2c_master_recv(client, buffer, 1); + + if (i2c_master_send(client, buffer, 2) < 2) + return 0; + + if (i2c_master_recv(client, buffer, 1) < 1) + return 0; + return buffer[0]; } @@ -1027,7 +1032,7 @@ kfree(client); return 0; } - DEBUG(1, "cx25%3x-2%x found", + DEBUG(1, "cx25%3x-2%x found. Initializing...", (device_id & 0xfff0) >> 4, (device_id & 0x0f) < 3 ? (device_id & 0x0f) + 1 : 3); @@ -1049,8 +1054,6 @@ state->audio = DECODER_AUDIO_48_KHZ; state->audio_input = -1; - DEBUG(1, "writing init values"); - switch (cardtype) { case 0: cx25840_input_layout = pvr150_input_layout; @@ -1065,7 +1068,6 @@ cx25840_initialize(client); - i2c_attach_client(client); log_status(client); return 0; @@ -1073,9 +1075,11 @@ static int cx25840_attach_adapter(struct i2c_adapter *adapter) { - DEBUG(1, "starting probe for adapter %s (0x%x)", adapter->name, - adapter->id); - return i2c_probe(adapter, &addr_data, &cx25840_detect_client); + 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); + } return 0; }
This patch prevents us from probing other i2c adapters for cx25840
chips, which is a problem Chris Baumgartner identified. I also added
code to not return a bogus value from cx25840_read if the read fails (it
now returns 0 on failure).