aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ir-kbd-i2c.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-05-13 15:50:11 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:21:11 -0400
commit9a4cc5ac991d3b697db4f9e5015a758621a95009 (patch)
tree087883d5290f5e2dcdd2bda34de4e64015466135 /drivers/media/video/ir-kbd-i2c.c
parent4d7a2d6721a6380d4ffc26d81d2c8232fd0d2dfc (diff)
V4L/DVB (11846): ir-kbd-i2c: Don't assume all IR receivers are supported
The code in ir_probe makes the dangerous assumption that all IR receivers are supported by the driver. The new i2c model makes it possible for bridge drivers to instantiate IR devices before they are supported, therefore the ir-kbd-i2c drivers must be made more robust to not spam the logs or even crash on unsupported IR devices. Simply, the driver will not bind to the unsupported devices. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r--drivers/media/video/ir-kbd-i2c.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 3a8880243b1f..86f2fefe1edf 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -298,7 +298,7 @@ static void ir_work(struct work_struct *work)
298static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) 298static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
299{ 299{
300 IR_KEYTAB_TYPE *ir_codes = NULL; 300 IR_KEYTAB_TYPE *ir_codes = NULL;
301 const char *name; 301 const char *name = NULL;
302 int ir_type; 302 int ir_type;
303 struct IR_i2c *ir; 303 struct IR_i2c *ir;
304 struct input_dev *input_dev; 304 struct input_dev *input_dev;
@@ -380,8 +380,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
380 ir_codes = ir_codes_avermedia_cardbus; 380 ir_codes = ir_codes_avermedia_cardbus;
381 break; 381 break;
382 default: 382 default:
383 /* shouldn't happen */ 383 dprintk(1, DEVNAME ": Unsupported i2c address 0x%02x\n", addr);
384 printk(DEVNAME ": Huh? unknown i2c address (0x%02x)?\n", addr);
385 err = -ENODEV; 384 err = -ENODEV;
386 goto err_out_free; 385 goto err_out_free;
387 } 386 }
@@ -396,6 +395,14 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
396 ir->get_key = init_data->get_key; 395 ir->get_key = init_data->get_key;
397 } 396 }
398 397
398 /* Make sure we are all setup before going on */
399 if (!name || !ir->get_key || !ir_codes) {
400 dprintk(1, DEVNAME ": Unsupported device at address 0x%02x\n",
401 addr);
402 err = -ENODEV;
403 goto err_out_free;
404 }
405
399 /* Sets name */ 406 /* Sets name */
400 snprintf(ir->name, sizeof(ir->name), "i2c IR (%s)", name); 407 snprintf(ir->name, sizeof(ir->name), "i2c IR (%s)", name);
401 ir->ir_codes = ir_codes; 408 ir->ir_codes = ir_codes;