diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-09-16 15:47:15 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil@xs4all.nl> | 2007-09-16 15:47:15 +0200 |
commit | 3f466835bc047f9f83f11ce8dcecc3021de4dec2 (patch) | |
tree | a688c9069871f15ef1438a288515712f9e1a73ed /linux | |
parent | 80d4ab9102f845bde660eab7e43d80af2c2fc328 (diff) | |
download | mediapointer-dvb-s2-3f466835bc047f9f83f11ce8dcecc3021de4dec2.tar.gz mediapointer-dvb-s2-3f466835bc047f9f83f11ce8dcecc3021de4dec2.tar.bz2 |
Use correct error codes when chip is not recognized.
From: Hans Verkuil <hverkuil@xs4all.nl>
If the chip isn't recognized, then the correct errors should be returned.
The v4l2_i2c_attach() utility function will return 0 for all errors
except -ENOMEM to provide proper compatibility support for the old I2C
probing function.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
---
linux/drivers/media/video/cs53l32a.c | 2 +-
linux/drivers/media/video/cx25840/cx25840-core.c | 6 +++++-
linux/drivers/media/video/msp3400-driver.c | 4 ++--
linux/drivers/media/video/saa7115.c | 4 ++--
linux/drivers/media/video/saa7127.c | 6 +++---
linux/drivers/media/video/tlv320aic23b.c | 2 +-
linux/drivers/media/video/upd64031a.c | 2 +-
linux/drivers/media/video/upd64083.c | 2 +-
linux/drivers/media/video/v4l2-common.c | 2 +-
linux/drivers/media/video/vp27smpx.c | 2 +-
linux/drivers/media/video/wm8739.c | 4 ++++
11 files changed, 22 insertions(+), 14 deletions(-)
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/video/cs53l32a.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/cx25840/cx25840-core.c | 6 | ||||
-rw-r--r-- | linux/drivers/media/video/msp3400-driver.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7115.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7127.c | 6 | ||||
-rw-r--r-- | linux/drivers/media/video/tlv320aic23b.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/upd64031a.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/upd64083.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/v4l2-common.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/vp27smpx.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/wm8739.c | 4 |
11 files changed, 22 insertions, 14 deletions
diff --git a/linux/drivers/media/video/cs53l32a.c b/linux/drivers/media/video/cs53l32a.c index 0c7789b1c..38b5516e3 100644 --- a/linux/drivers/media/video/cs53l32a.c +++ b/linux/drivers/media/video/cs53l32a.c @@ -152,7 +152,7 @@ static int cs53l32a_probe(struct i2c_client *client) /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return 0; + return -EIO; snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c index 89fec724c..3f249b025 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.c +++ b/linux/drivers/media/video/cx25840/cx25840-core.c @@ -1099,6 +1099,10 @@ static int cx25840_probe(struct i2c_client *client) u32 id; u16 device_id; + /* Check if the adapter supports the needed features */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) + return -EIO; + v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", client->addr << 1); device_id = cx25840_read(client, 0x101) << 8; @@ -1114,7 +1118,7 @@ static int cx25840_probe(struct i2c_client *client) } else { v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n"); - return 0; + return -ENODEV; } state = kzalloc(sizeof(struct cx25840_state), GFP_KERNEL); diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c index 690a81478..bc74cdccb 100644 --- a/linux/drivers/media/video/msp3400-driver.c +++ b/linux/drivers/media/video/msp3400-driver.c @@ -856,7 +856,7 @@ static int msp_probe(struct i2c_client *client) if (msp_reset(client) == -1) { v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); - return 0; + return -ENODEV; } state = kzalloc(sizeof(*state), GFP_KERNEL); @@ -888,7 +888,7 @@ static int msp_probe(struct i2c_client *client) if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) { v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n"); kfree(state); - return 0; + return -ENODEV; } #if 0 diff --git a/linux/drivers/media/video/saa7115.c b/linux/drivers/media/video/saa7115.c index 3d4020921..3b57cb352 100644 --- a/linux/drivers/media/video/saa7115.c +++ b/linux/drivers/media/video/saa7115.c @@ -1470,7 +1470,7 @@ static int saa7115_probe(struct i2c_client *client) /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return 0; + return -EIO; snprintf(client->name, sizeof(client->name) - 1, "saa7115"); @@ -1489,7 +1489,7 @@ static int saa7115_probe(struct i2c_client *client) if (memcmp(name, "1f711", 5)) { v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n", client->addr << 1, name); - return 0; + return -ENODEV; } snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c index 95e0f998a..27d9cab97 100644 --- a/linux/drivers/media/video/saa7127.c +++ b/linux/drivers/media/video/saa7127.c @@ -683,7 +683,7 @@ static int saa7127_probe(struct i2c_client *client) /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return 0; + return -EIO; snprintf(client->name, sizeof(client->name) - 1, "saa7127"); @@ -697,12 +697,12 @@ static int saa7127_probe(struct i2c_client *client) if ((saa7127_read(client, 0) & 0xe4) != 0 || (saa7127_read(client, 0x29) & 0x3f) != 0x1d) { v4l_dbg(1, debug, client, "saa7127 not found\n"); - return 0; + return -ENODEV; } state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL); if (state == NULL) { - return (-ENOMEM); + return -ENOMEM; } i2c_set_clientdata(client, state); diff --git a/linux/drivers/media/video/tlv320aic23b.c b/linux/drivers/media/video/tlv320aic23b.c index 2e5ed138e..32f4c8c53 100644 --- a/linux/drivers/media/video/tlv320aic23b.c +++ b/linux/drivers/media/video/tlv320aic23b.c @@ -141,7 +141,7 @@ static int tlv320aic23b_probe(struct i2c_client *client) /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return 0; + return -EIO; v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); diff --git a/linux/drivers/media/video/upd64031a.c b/linux/drivers/media/video/upd64031a.c index 9234cbb0d..6cbd124c7 100644 --- a/linux/drivers/media/video/upd64031a.c +++ b/linux/drivers/media/video/upd64031a.c @@ -208,7 +208,7 @@ static int upd64031a_probe(struct i2c_client *client) int i; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return 0; + return -EIO; v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); diff --git a/linux/drivers/media/video/upd64083.c b/linux/drivers/media/video/upd64083.c index 280c593d0..34e99cfbb 100644 --- a/linux/drivers/media/video/upd64083.c +++ b/linux/drivers/media/video/upd64083.c @@ -186,7 +186,7 @@ static int upd64083_probe(struct i2c_client *client) int i; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return 0; + return -EIO; v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c index ef4514369..f97d14486 100644 --- a/linux/drivers/media/video/v4l2-common.c +++ b/linux/drivers/media/video/v4l2-common.c @@ -1655,7 +1655,7 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver else { kfree(client); } - return err; + return err != -ENOMEM ? 0 : err; } /* ----------------------------------------------------------------- */ diff --git a/linux/drivers/media/video/vp27smpx.c b/linux/drivers/media/video/vp27smpx.c index fae69bee7..602d7da63 100644 --- a/linux/drivers/media/video/vp27smpx.c +++ b/linux/drivers/media/video/vp27smpx.c @@ -139,7 +139,7 @@ static int vp27smpx_probe(struct i2c_client *client) /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return 0; + return -EIO; snprintf(client->name, sizeof(client->name) - 1, "vp27smpx"); diff --git a/linux/drivers/media/video/wm8739.c b/linux/drivers/media/video/wm8739.c index 953c47ed4..4b5956a8f 100644 --- a/linux/drivers/media/video/wm8739.c +++ b/linux/drivers/media/video/wm8739.c @@ -276,6 +276,10 @@ static int wm8739_probe(struct i2c_client *client) { struct wm8739_state *state; + /* Check if the adapter supports the needed features */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) + return -EIO; + v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); state = kmalloc(sizeof(struct wm8739_state), GFP_KERNEL); |