diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-03-12 19:18:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-17 23:47:05 -0400 |
commit | 727e625cc2c114e449a78f851b0c12edac897a83 (patch) | |
tree | ec7b14d68fb1b79d636d50756082e61360610063 | |
parent | 9c89a181a09eaafca5fc638c3b7ce1620227f60a (diff) |
V4L/DVB: ir-core: export driver name used by IR via uevent
Now, both driver and keytable names are exported to userspace. This
will help userspace to decide when a table need to be replaced
by another one.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/IR/ir-keytable.c | 7 | ||||
-rw-r--r-- | drivers/media/IR/ir-sysfs.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dm1105/dm1105.c | 4 | ||||
-rw-r--r-- | drivers/media/dvb/mantis/mantis_input.c | 4 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 4 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv-input.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-input.c | 5 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-input.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-input.c | 4 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-input.c | 4 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 8 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 4 | ||||
-rw-r--r-- | include/media/ir-core.h | 4 |
13 files changed, 43 insertions, 15 deletions
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 6db3ff74659b..73fe4bec83bc 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c | |||
@@ -404,7 +404,8 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); | |||
404 | */ | 404 | */ |
405 | int ir_input_register(struct input_dev *input_dev, | 405 | int ir_input_register(struct input_dev *input_dev, |
406 | const struct ir_scancode_table *rc_tab, | 406 | const struct ir_scancode_table *rc_tab, |
407 | const struct ir_dev_props *props) | 407 | const struct ir_dev_props *props, |
408 | const char *driver_name) | ||
408 | { | 409 | { |
409 | struct ir_input_dev *ir_dev; | 410 | struct ir_input_dev *ir_dev; |
410 | struct ir_scancode *keymap = rc_tab->scan; | 411 | struct ir_scancode *keymap = rc_tab->scan; |
@@ -419,6 +420,10 @@ int ir_input_register(struct input_dev *input_dev, | |||
419 | 420 | ||
420 | spin_lock_init(&ir_dev->rc_tab.lock); | 421 | spin_lock_init(&ir_dev->rc_tab.lock); |
421 | 422 | ||
423 | ir_dev->driver_name = kmalloc(strlen(driver_name) + 1, GFP_KERNEL); | ||
424 | if (!ir_dev->driver_name) | ||
425 | return -ENOMEM; | ||
426 | strcpy(ir_dev->driver_name, driver_name); | ||
422 | ir_dev->rc_tab.name = rc_tab->name; | 427 | ir_dev->rc_tab.name = rc_tab->name; |
423 | ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size); | 428 | ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size); |
424 | ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size * | 429 | ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size * |
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 6d63657b5685..0592515a19f8 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c | |||
@@ -140,6 +140,8 @@ static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env) | |||
140 | 140 | ||
141 | if (ir_dev->rc_tab.name) | 141 | if (ir_dev->rc_tab.name) |
142 | ADD_HOTPLUG_VAR("NAME=\"%s\"", ir_dev->rc_tab.name); | 142 | ADD_HOTPLUG_VAR("NAME=\"%s\"", ir_dev->rc_tab.name); |
143 | if (ir_dev->driver_name) | ||
144 | ADD_HOTPLUG_VAR("DRV_NAME=\"%s\"", ir_dev->driver_name); | ||
143 | 145 | ||
144 | return 0; | 146 | return 0; |
145 | } | 147 | } |
diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index b6d46961a99e..3229ff325c56 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c | |||
@@ -46,6 +46,8 @@ | |||
46 | #include "z0194a.h" | 46 | #include "z0194a.h" |
47 | #include "ds3000.h" | 47 | #include "ds3000.h" |
48 | 48 | ||
49 | #define MODULE_NAME "dm1105" | ||
50 | |||
49 | #define UNSET (-1U) | 51 | #define UNSET (-1U) |
50 | 52 | ||
51 | #define DM1105_BOARD_NOAUTO UNSET | 53 | #define DM1105_BOARD_NOAUTO UNSET |
@@ -628,7 +630,7 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) | |||
628 | 630 | ||
629 | INIT_WORK(&dm1105->ir.work, dm1105_emit_key); | 631 | INIT_WORK(&dm1105->ir.work, dm1105_emit_key); |
630 | 632 | ||
631 | err = ir_input_register(input_dev, ir_codes, NULL); | 633 | err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); |
632 | 634 | ||
633 | return err; | 635 | return err; |
634 | } | 636 | } |
diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index 4675a3b53c7d..6baf30229689 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include "mantis_reg.h" | 32 | #include "mantis_reg.h" |
33 | #include "mantis_uart.h" | 33 | #include "mantis_uart.h" |
34 | 34 | ||
35 | #define MODULE_NAME "mantis_core" | ||
36 | |||
35 | static struct ir_scancode mantis_ir_table[] = { | 37 | static struct ir_scancode mantis_ir_table[] = { |
36 | { 0x29, KEY_POWER }, | 38 | { 0x29, KEY_POWER }, |
37 | { 0x28, KEY_FAVORITES }, | 39 | { 0x28, KEY_FAVORITES }, |
@@ -126,7 +128,7 @@ int mantis_input_init(struct mantis_pci *mantis) | |||
126 | rc->id.version = 1; | 128 | rc->id.version = 1; |
127 | rc->dev = mantis->pdev->dev; | 129 | rc->dev = mantis->pdev->dev; |
128 | 130 | ||
129 | err = ir_input_register(rc, &ir_mantis, NULL); | 131 | err = ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME); |
130 | if (err) { | 132 | if (err) { |
131 | dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); | 133 | dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); |
132 | input_free_device(rc); | 134 | input_free_device(rc); |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 49c2a817a06f..ec89afd38917 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -54,6 +54,8 @@ | |||
54 | #include "tda1002x.h" | 54 | #include "tda1002x.h" |
55 | #include "tda827x.h" | 55 | #include "tda827x.h" |
56 | 56 | ||
57 | #define MODULE_NAME "budget_ci" | ||
58 | |||
57 | /* | 59 | /* |
58 | * Regarding DEBIADDR_IR: | 60 | * Regarding DEBIADDR_IR: |
59 | * Some CI modules hang if random addresses are read. | 61 | * Some CI modules hang if random addresses are read. |
@@ -254,7 +256,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
254 | budget_ci->ir.timer_keyup.function = msp430_ir_keyup; | 256 | budget_ci->ir.timer_keyup.function = msp430_ir_keyup; |
255 | budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; | 257 | budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; |
256 | budget_ci->ir.last_raw = 0xffff; /* An impossible value */ | 258 | budget_ci->ir.last_raw = 0xffff; /* An impossible value */ |
257 | error = ir_input_register(input_dev, ir_codes, NULL); | 259 | error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); |
258 | if (error) { | 260 | if (error) { |
259 | printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); | 261 | printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); |
260 | return error; | 262 | return error; |
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index aa153a986ade..d17a9b7911e5 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c | |||
@@ -49,6 +49,8 @@ module_param(ir_rc5_key_timeout, int, 0644); | |||
49 | 49 | ||
50 | #define DEVNAME "bttv-input" | 50 | #define DEVNAME "bttv-input" |
51 | 51 | ||
52 | #define MODULE_NAME "bttv" | ||
53 | |||
52 | /* ---------------------------------------------------------------------- */ | 54 | /* ---------------------------------------------------------------------- */ |
53 | 55 | ||
54 | static void ir_handle_key(struct bttv *btv) | 56 | static void ir_handle_key(struct bttv *btv) |
@@ -390,7 +392,7 @@ int bttv_input_init(struct bttv *btv) | |||
390 | bttv_ir_start(btv, ir); | 392 | bttv_ir_start(btv, ir); |
391 | 393 | ||
392 | /* all done */ | 394 | /* all done */ |
393 | err = ir_input_register(btv->remote->dev, ir_codes, NULL); | 395 | err = ir_input_register(btv->remote->dev, ir_codes, NULL, MODULE_NAME); |
394 | if (err) | 396 | if (err) |
395 | goto err_out_stop; | 397 | goto err_out_stop; |
396 | 398 | ||
diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c index b473cd8367f5..a0e8bb88d67e 100644 --- a/drivers/media/video/cx231xx/cx231xx-input.c +++ b/drivers/media/video/cx231xx/cx231xx-input.c | |||
@@ -35,6 +35,8 @@ static unsigned int ir_debug; | |||
35 | module_param(ir_debug, int, 0644); | 35 | module_param(ir_debug, int, 0644); |
36 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); | 36 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); |
37 | 37 | ||
38 | #define MODULE_NAME "cx231xx" | ||
39 | |||
38 | #define i2cdprintk(fmt, arg...) \ | 40 | #define i2cdprintk(fmt, arg...) \ |
39 | if (ir_debug) { \ | 41 | if (ir_debug) { \ |
40 | printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \ | 42 | printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \ |
@@ -217,7 +219,8 @@ int cx231xx_ir_init(struct cx231xx *dev) | |||
217 | cx231xx_ir_start(ir); | 219 | cx231xx_ir_start(ir); |
218 | 220 | ||
219 | /* all done */ | 221 | /* all done */ |
220 | err = ir_input_register(ir->input, dev->board.ir_codes, NULL); | 222 | err = ir_input_register(ir->input, dev->board.ir_codes, |
223 | NULL, MODULE_NAME); | ||
221 | if (err) | 224 | if (err) |
222 | goto err_out_stop; | 225 | goto err_out_stop; |
223 | 226 | ||
diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index 8e9d990dbe93..ef1db2d9668a 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c | |||
@@ -51,6 +51,8 @@ | |||
51 | 51 | ||
52 | #define RC5_EXTENDED_COMMAND_OFFSET 64 | 52 | #define RC5_EXTENDED_COMMAND_OFFSET 64 |
53 | 53 | ||
54 | #define MODULE_NAME "cx23885" | ||
55 | |||
54 | static inline unsigned int rc5_command(u32 rc5_baseband) | 56 | static inline unsigned int rc5_command(u32 rc5_baseband) |
55 | { | 57 | { |
56 | return RC5_INSTR(rc5_baseband) + | 58 | return RC5_INSTR(rc5_baseband) + |
@@ -398,7 +400,7 @@ int cx23885_input_init(struct cx23885_dev *dev) | |||
398 | dev->ir_input = ir; | 400 | dev->ir_input = ir; |
399 | cx23885_input_ir_start(dev); | 401 | cx23885_input_ir_start(dev); |
400 | 402 | ||
401 | ret = ir_input_register(ir->dev, ir_codes, NULL); | 403 | ret = ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME); |
402 | if (ret) | 404 | if (ret) |
403 | goto err_out_stop; | 405 | goto err_out_stop; |
404 | 406 | ||
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 6b6abf062c21..8b52546c6e1d 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include "cx88.h" | 32 | #include "cx88.h" |
33 | #include <media/ir-common.h> | 33 | #include <media/ir-common.h> |
34 | 34 | ||
35 | #define MODULE_NAME "cx88xx" | ||
36 | |||
35 | /* ---------------------------------------------------------------------- */ | 37 | /* ---------------------------------------------------------------------- */ |
36 | 38 | ||
37 | struct cx88_IR { | 39 | struct cx88_IR { |
@@ -384,7 +386,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
384 | cx88_ir_start(core, ir); | 386 | cx88_ir_start(core, ir); |
385 | 387 | ||
386 | /* all done */ | 388 | /* all done */ |
387 | err = ir_input_register(ir->input, ir_codes, NULL); | 389 | err = ir_input_register(ir->input, ir_codes, NULL, MODULE_NAME); |
388 | if (err) | 390 | if (err) |
389 | goto err_out_stop; | 391 | goto err_out_stop; |
390 | 392 | ||
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 20a0001e8885..32f376654c0c 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c | |||
@@ -39,6 +39,8 @@ static unsigned int ir_debug; | |||
39 | module_param(ir_debug, int, 0644); | 39 | module_param(ir_debug, int, 0644); |
40 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); | 40 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); |
41 | 41 | ||
42 | #define MODULE_NAME "em28xx" | ||
43 | |||
42 | #define i2cdprintk(fmt, arg...) \ | 44 | #define i2cdprintk(fmt, arg...) \ |
43 | if (ir_debug) { \ | 45 | if (ir_debug) { \ |
44 | printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \ | 46 | printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \ |
@@ -474,7 +476,7 @@ int em28xx_ir_init(struct em28xx *dev) | |||
474 | 476 | ||
475 | /* all done */ | 477 | /* all done */ |
476 | err = ir_input_register(ir->input, dev->board.ir_codes, | 478 | err = ir_input_register(ir->input, dev->board.ir_codes, |
477 | &ir->props); | 479 | &ir->props, MODULE_NAME); |
478 | if (err) | 480 | if (err) |
479 | goto err_out_stop; | 481 | goto err_out_stop; |
480 | 482 | ||
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index da18d698e7f2..6af69d5c8499 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -61,9 +61,9 @@ module_param(hauppauge, int, 0644); /* Choose Hauppauge remote */ | |||
61 | MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults to 0)"); | 61 | MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults to 0)"); |
62 | 62 | ||
63 | 63 | ||
64 | #define DEVNAME "ir-kbd-i2c" | 64 | #define MODULE_NAME "ir-kbd-i2c" |
65 | #define dprintk(level, fmt, arg...) if (debug >= level) \ | 65 | #define dprintk(level, fmt, arg...) if (debug >= level) \ |
66 | printk(KERN_DEBUG DEVNAME ": " fmt , ## arg) | 66 | printk(KERN_DEBUG MODULE_NAME ": " fmt , ## arg) |
67 | 67 | ||
68 | /* ----------------------------------------------------------------------- */ | 68 | /* ----------------------------------------------------------------------- */ |
69 | 69 | ||
@@ -447,11 +447,11 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
447 | input_dev->name = ir->name; | 447 | input_dev->name = ir->name; |
448 | input_dev->phys = ir->phys; | 448 | input_dev->phys = ir->phys; |
449 | 449 | ||
450 | err = ir_input_register(ir->input, ir->ir_codes, NULL); | 450 | err = ir_input_register(ir->input, ir->ir_codes, NULL, MODULE_NAME); |
451 | if (err) | 451 | if (err) |
452 | goto err_out_free; | 452 | goto err_out_free; |
453 | 453 | ||
454 | printk(DEVNAME ": %s detected at %s [%s]\n", | 454 | printk(MODULE_NAME ": %s detected at %s [%s]\n", |
455 | ir->input->name, ir->input->phys, adap->name); | 455 | ir->input->name, ir->input->phys, adap->name); |
456 | 456 | ||
457 | /* start polling via eventd */ | 457 | /* start polling via eventd */ |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index a2b16693ee9a..c1fe7c9369b2 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include "saa7134-reg.h" | 28 | #include "saa7134-reg.h" |
29 | #include "saa7134.h" | 29 | #include "saa7134.h" |
30 | 30 | ||
31 | #define MODULE_NAME "saa7134" | ||
32 | |||
31 | static unsigned int disable_ir; | 33 | static unsigned int disable_ir; |
32 | module_param(disable_ir, int, 0444); | 34 | module_param(disable_ir, int, 0444); |
33 | MODULE_PARM_DESC(disable_ir,"disable infrared remote support"); | 35 | MODULE_PARM_DESC(disable_ir,"disable infrared remote support"); |
@@ -730,7 +732,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
730 | dev->remote = ir; | 732 | dev->remote = ir; |
731 | saa7134_ir_start(dev, ir); | 733 | saa7134_ir_start(dev, ir); |
732 | 734 | ||
733 | err = ir_input_register(ir->dev, ir_codes, NULL); | 735 | err = ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME); |
734 | if (err) | 736 | if (err) |
735 | goto err_out_stop; | 737 | goto err_out_stop; |
736 | 738 | ||
diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 9ab8a7774223..1eae72d518e0 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h | |||
@@ -49,6 +49,7 @@ struct ir_dev_props { | |||
49 | 49 | ||
50 | struct ir_input_dev { | 50 | struct ir_input_dev { |
51 | struct device dev; /* device */ | 51 | struct device dev; /* device */ |
52 | char *driver_name; /* Name of the driver module */ | ||
52 | struct ir_scancode_table rc_tab; /* scan/key table */ | 53 | struct ir_scancode_table rc_tab; /* scan/key table */ |
53 | unsigned long devno; /* device number */ | 54 | unsigned long devno; /* device number */ |
54 | const struct ir_dev_props *props; /* Device properties */ | 55 | const struct ir_dev_props *props; /* Device properties */ |
@@ -62,7 +63,8 @@ u32 ir_g_keycode_from_table(struct input_dev *input_dev, | |||
62 | 63 | ||
63 | int ir_input_register(struct input_dev *dev, | 64 | int ir_input_register(struct input_dev *dev, |
64 | const struct ir_scancode_table *ir_codes, | 65 | const struct ir_scancode_table *ir_codes, |
65 | const struct ir_dev_props *props); | 66 | const struct ir_dev_props *props, |
67 | const char *driver_name); | ||
66 | void ir_input_unregister(struct input_dev *input_dev); | 68 | void ir_input_unregister(struct input_dev *input_dev); |
67 | 69 | ||
68 | /* Routines from ir-sysfs.c */ | 70 | /* Routines from ir-sysfs.c */ |