提交 727e625c 编写于 作者: M Mauro Carvalho Chehab

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: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 9c89a181
......@@ -404,7 +404,8 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table);
*/
int ir_input_register(struct input_dev *input_dev,
const struct ir_scancode_table *rc_tab,
const struct ir_dev_props *props)
const struct ir_dev_props *props,
const char *driver_name)
{
struct ir_input_dev *ir_dev;
struct ir_scancode *keymap = rc_tab->scan;
......@@ -419,6 +420,10 @@ int ir_input_register(struct input_dev *input_dev,
spin_lock_init(&ir_dev->rc_tab.lock);
ir_dev->driver_name = kmalloc(strlen(driver_name) + 1, GFP_KERNEL);
if (!ir_dev->driver_name)
return -ENOMEM;
strcpy(ir_dev->driver_name, driver_name);
ir_dev->rc_tab.name = rc_tab->name;
ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size);
ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size *
......
......@@ -140,6 +140,8 @@ static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env)
if (ir_dev->rc_tab.name)
ADD_HOTPLUG_VAR("NAME=\"%s\"", ir_dev->rc_tab.name);
if (ir_dev->driver_name)
ADD_HOTPLUG_VAR("DRV_NAME=\"%s\"", ir_dev->driver_name);
return 0;
}
......
......@@ -46,6 +46,8 @@
#include "z0194a.h"
#include "ds3000.h"
#define MODULE_NAME "dm1105"
#define UNSET (-1U)
#define DM1105_BOARD_NOAUTO UNSET
......@@ -628,7 +630,7 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105)
INIT_WORK(&dm1105->ir.work, dm1105_emit_key);
err = ir_input_register(input_dev, ir_codes, NULL);
err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME);
return err;
}
......
......@@ -32,6 +32,8 @@
#include "mantis_reg.h"
#include "mantis_uart.h"
#define MODULE_NAME "mantis_core"
static struct ir_scancode mantis_ir_table[] = {
{ 0x29, KEY_POWER },
{ 0x28, KEY_FAVORITES },
......@@ -126,7 +128,7 @@ int mantis_input_init(struct mantis_pci *mantis)
rc->id.version = 1;
rc->dev = mantis->pdev->dev;
err = ir_input_register(rc, &ir_mantis, NULL);
err = ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME);
if (err) {
dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err);
input_free_device(rc);
......
......@@ -54,6 +54,8 @@
#include "tda1002x.h"
#include "tda827x.h"
#define MODULE_NAME "budget_ci"
/*
* Regarding DEBIADDR_IR:
* Some CI modules hang if random addresses are read.
......@@ -254,7 +256,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
budget_ci->ir.timer_keyup.function = msp430_ir_keyup;
budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir;
budget_ci->ir.last_raw = 0xffff; /* An impossible value */
error = ir_input_register(input_dev, ir_codes, NULL);
error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME);
if (error) {
printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error);
return error;
......
......@@ -49,6 +49,8 @@ module_param(ir_rc5_key_timeout, int, 0644);
#define DEVNAME "bttv-input"
#define MODULE_NAME "bttv"
/* ---------------------------------------------------------------------- */
static void ir_handle_key(struct bttv *btv)
......@@ -390,7 +392,7 @@ int bttv_input_init(struct bttv *btv)
bttv_ir_start(btv, ir);
/* all done */
err = ir_input_register(btv->remote->dev, ir_codes, NULL);
err = ir_input_register(btv->remote->dev, ir_codes, NULL, MODULE_NAME);
if (err)
goto err_out_stop;
......
......@@ -35,6 +35,8 @@ static unsigned int ir_debug;
module_param(ir_debug, int, 0644);
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
#define MODULE_NAME "cx231xx"
#define i2cdprintk(fmt, arg...) \
if (ir_debug) { \
printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \
......@@ -217,7 +219,8 @@ int cx231xx_ir_init(struct cx231xx *dev)
cx231xx_ir_start(ir);
/* all done */
err = ir_input_register(ir->input, dev->board.ir_codes, NULL);
err = ir_input_register(ir->input, dev->board.ir_codes,
NULL, MODULE_NAME);
if (err)
goto err_out_stop;
......
......@@ -51,6 +51,8 @@
#define RC5_EXTENDED_COMMAND_OFFSET 64
#define MODULE_NAME "cx23885"
static inline unsigned int rc5_command(u32 rc5_baseband)
{
return RC5_INSTR(rc5_baseband) +
......@@ -398,7 +400,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
dev->ir_input = ir;
cx23885_input_ir_start(dev);
ret = ir_input_register(ir->dev, ir_codes, NULL);
ret = ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME);
if (ret)
goto err_out_stop;
......
......@@ -32,6 +32,8 @@
#include "cx88.h"
#include <media/ir-common.h>
#define MODULE_NAME "cx88xx"
/* ---------------------------------------------------------------------- */
struct cx88_IR {
......@@ -384,7 +386,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
cx88_ir_start(core, ir);
/* all done */
err = ir_input_register(ir->input, ir_codes, NULL);
err = ir_input_register(ir->input, ir_codes, NULL, MODULE_NAME);
if (err)
goto err_out_stop;
......
......@@ -39,6 +39,8 @@ static unsigned int ir_debug;
module_param(ir_debug, int, 0644);
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
#define MODULE_NAME "em28xx"
#define i2cdprintk(fmt, arg...) \
if (ir_debug) { \
printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \
......@@ -474,7 +476,7 @@ int em28xx_ir_init(struct em28xx *dev)
/* all done */
err = ir_input_register(ir->input, dev->board.ir_codes,
&ir->props);
&ir->props, MODULE_NAME);
if (err)
goto err_out_stop;
......
......@@ -61,9 +61,9 @@ module_param(hauppauge, int, 0644); /* Choose Hauppauge remote */
MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults to 0)");
#define DEVNAME "ir-kbd-i2c"
#define MODULE_NAME "ir-kbd-i2c"
#define dprintk(level, fmt, arg...) if (debug >= level) \
printk(KERN_DEBUG DEVNAME ": " fmt , ## arg)
printk(KERN_DEBUG MODULE_NAME ": " fmt , ## arg)
/* ----------------------------------------------------------------------- */
......@@ -447,11 +447,11 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
input_dev->name = ir->name;
input_dev->phys = ir->phys;
err = ir_input_register(ir->input, ir->ir_codes, NULL);
err = ir_input_register(ir->input, ir->ir_codes, NULL, MODULE_NAME);
if (err)
goto err_out_free;
printk(DEVNAME ": %s detected at %s [%s]\n",
printk(MODULE_NAME ": %s detected at %s [%s]\n",
ir->input->name, ir->input->phys, adap->name);
/* start polling via eventd */
......
......@@ -28,6 +28,8 @@
#include "saa7134-reg.h"
#include "saa7134.h"
#define MODULE_NAME "saa7134"
static unsigned int disable_ir;
module_param(disable_ir, int, 0444);
MODULE_PARM_DESC(disable_ir,"disable infrared remote support");
......@@ -730,7 +732,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
dev->remote = ir;
saa7134_ir_start(dev, ir);
err = ir_input_register(ir->dev, ir_codes, NULL);
err = ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME);
if (err)
goto err_out_stop;
......
......@@ -49,6 +49,7 @@ struct ir_dev_props {
struct ir_input_dev {
struct device dev; /* device */
char *driver_name; /* Name of the driver module */
struct ir_scancode_table rc_tab; /* scan/key table */
unsigned long devno; /* device number */
const struct ir_dev_props *props; /* Device properties */
......@@ -62,7 +63,8 @@ u32 ir_g_keycode_from_table(struct input_dev *input_dev,
int ir_input_register(struct input_dev *dev,
const struct ir_scancode_table *ir_codes,
const struct ir_dev_props *props);
const struct ir_dev_props *props,
const char *driver_name);
void ir_input_unregister(struct input_dev *input_dev);
/* Routines from ir-sysfs.c */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册