public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] V4L/DVB: ir: use a real device instead of a virtual class
@ 2010-03-11 15:41 Mauro Carvalho Chehab
  2010-03-12 14:40 ` [PATCH 2/4] Add a macro to properly create IR tables Mauro Carvalho Chehab
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2010-03-11 15:41 UTC (permalink / raw)
  To: Linux Media Mailing List

Change the ir-sysfs approach to create irrcv0 as a device, instead of
using class_dev. Also, change the way input is registered, in order
to make its parent to be the irrcv device.

Due to this change, now the event device is created under
/sys/class/ir/irrcv class:

/sys/class/irrcv/irrcv0/
|-- current_protocol
|-- device -> ../../../1-3
|-- input9
|   |-- capabilities
|   |   |-- abs
...

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 0903f53..c9c0a54 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -448,22 +448,15 @@ int ir_input_register(struct input_dev *input_dev,
 	input_dev->setkeycode = ir_setkeycode;
 	input_set_drvdata(input_dev, ir_dev);
 
-	rc = input_register_device(input_dev);
-	if (rc < 0)
-		goto err;
-
 	rc = ir_register_class(input_dev);
-	if (rc < 0) {
-		input_unregister_device(input_dev);
+	if (rc < 0)
 		goto err;
-	}
 
 	return 0;
 
 err:
 	kfree(rc_tab->scan);
 	kfree(ir_dev);
-	input_set_drvdata(input_dev, NULL);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(ir_input_register);
@@ -492,7 +485,6 @@ void ir_input_unregister(struct input_dev *dev)
 	ir_unregister_class(dev);
 
 	kfree(ir_dev);
-	input_unregister_device(dev);
 }
 EXPORT_SYMBOL_GPL(ir_input_unregister);
 
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index bf5fbcd..1bb011a 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -22,7 +22,15 @@
 static unsigned long ir_core_dev_number;
 
 /* class for /sys/class/irrcv */
-static struct class *ir_input_class;
+static char *ir_devnode(struct device *dev, mode_t *mode)
+{
+	return kasprintf(GFP_KERNEL, "irrcv/%s", dev_name(dev));
+}
+
+struct class ir_input_class = {
+	.name		= "irrcv",
+	.devnode	= ir_devnode,
+};
 
 /**
  * show_protocol() - shows the current IR protocol
@@ -128,6 +136,20 @@ static struct attribute *ir_dev_attrs[] = {
 	NULL,
 };
 
+static struct attribute_group ir_dev_attr_grp = {
+	.attrs	=ir_dev_attrs,
+};
+
+static const struct attribute_group *ir_dev_attr_groups[] = {
+	&ir_dev_attr_grp,
+	NULL
+};
+
+static struct device_type ir_dev_type = {
+	.groups		= ir_dev_attr_groups,
+};
+
+
 /**
  * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv?
  * @input_dev:	the struct input_dev descriptor of the device
@@ -137,7 +159,7 @@ static struct attribute *ir_dev_attrs[] = {
 int ir_register_class(struct input_dev *input_dev)
 {
 	int rc;
-	struct kobject *kobj;
+	const char *path;
 
 	struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
 	int devno = find_first_zero_bit(&ir_core_dev_number,
@@ -146,19 +168,31 @@ int ir_register_class(struct input_dev *input_dev)
 	if (unlikely(devno < 0))
 		return devno;
 
-	ir_dev->attr.attrs = ir_dev_attrs;
-	ir_dev->class_dev = device_create(ir_input_class, NULL,
-					  input_dev->dev.devt, ir_dev,
-					  "irrcv%d", devno);
-	kobj = &ir_dev->class_dev->kobj;
+	ir_dev->dev.type = &ir_dev_type;
+	ir_dev->dev.class = &ir_input_class;
+	ir_dev->dev.parent = input_dev->dev.parent;
+	dev_set_name(&ir_dev->dev, "irrcv%d", devno);
+	rc = device_register(&ir_dev->dev);
+	if (rc)
+		return rc;
 
-	printk(KERN_WARNING "Creating IR device %s\n", kobject_name(kobj));
-	rc = sysfs_create_group(kobj, &ir_dev->attr);
-	if (unlikely(rc < 0)) {
-		device_destroy(ir_input_class, input_dev->dev.devt);
-		return -ENOMEM;
+
+	input_dev->dev.parent = &ir_dev->dev;
+	rc = input_register_device(input_dev);
+	if (rc < 0) {
+		device_del(&ir_dev->dev);
+		return rc;
 	}
 
+	__module_get(THIS_MODULE);
+
+	path = kobject_get_path(&input_dev->dev.kobj, GFP_KERNEL);
+	printk(KERN_INFO "%s: %s associated with sysfs %s\n",
+		dev_name(&ir_dev->dev),
+		input_dev->name ? input_dev->name : "Unspecified device",
+		path ? path : "N/A");
+	kfree(path);
+
 	ir_dev->devno = devno;
 	set_bit(devno, &ir_core_dev_number);
 
@@ -175,16 +209,12 @@ int ir_register_class(struct input_dev *input_dev)
 void ir_unregister_class(struct input_dev *input_dev)
 {
 	struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
-	struct kobject *kobj;
 
 	clear_bit(ir_dev->devno, &ir_core_dev_number);
+	input_unregister_device(input_dev);
+	device_del(&ir_dev->dev);
 
-	kobj = &ir_dev->class_dev->kobj;
-
-	sysfs_remove_group(kobj, &ir_dev->attr);
-	device_destroy(ir_input_class, input_dev->dev.devt);
-
-	kfree(ir_dev->attr.name);
+	module_put(THIS_MODULE);
 }
 
 /*
@@ -193,10 +223,10 @@ void ir_unregister_class(struct input_dev *input_dev)
 
 static int __init ir_core_init(void)
 {
-	ir_input_class = class_create(THIS_MODULE, "irrcv");
-	if (IS_ERR(ir_input_class)) {
+	int rc = class_register(&ir_input_class);
+	if (rc) {
 		printk(KERN_ERR "ir_core: unable to register irrcv class\n");
-		return PTR_ERR(ir_input_class);
+		return rc;
 	}
 
 	return 0;
@@ -204,7 +234,7 @@ static int __init ir_core_init(void)
 
 static void __exit ir_core_exit(void)
 {
-	class_destroy(ir_input_class);
+	class_unregister(&ir_input_class);
 }
 
 module_init(ir_core_init);
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 61c223b..ce9f347 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -47,11 +47,9 @@ struct ir_dev_props {
 
 
 struct ir_input_dev {
-	struct input_dev		*dev;		/* Input device*/
+	struct device			dev;		/* device */
 	struct ir_scancode_table	rc_tab;		/* scan/key table */
 	unsigned long			devno;		/* device number */
-	struct attribute_group		attr;		/* IR attributes */
-	struct device			*class_dev;	/* virtual class dev */
 	const struct ir_dev_props	*props;		/* Device properties */
 };
 #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)
-- 
1.6.6.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] Add a macro to properly create IR tables
  2010-03-11 15:41 [PATCH 1/4] V4L/DVB: ir: use a real device instead of a virtual class Mauro Carvalho Chehab
@ 2010-03-12 14:40 ` Mauro Carvalho Chehab
  2010-03-18 11:55   ` Aguirre, Sergio
  2010-03-12 14:50 ` [PATCH 3/4] V4L/DVB: ir-core: Export IR name via uevent Mauro Carvalho Chehab
  2010-03-13  0:18 ` [PATCH 4/4] V4L/DVB: ir-core: export driver name used by IR " Mauro Carvalho Chehab
  2 siblings, 1 reply; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2010-03-12 14:40 UTC (permalink / raw)
  To: Linux Media Mailing List

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/drivers/media/IR/ir-keymaps.c b/drivers/media/IR/ir-keymaps.c
index 0efdefe..dfc777b 100644
--- a/drivers/media/IR/ir-keymaps.c
+++ b/drivers/media/IR/ir-keymaps.c
@@ -28,16 +28,28 @@
 #include <linux/input.h>
 #include <media/ir-common.h>
 
+
+/*
+ * The usage of tables with just the command part is deprecated.
+ * All new IR keytables should contain address+command and need
+ * to define the proper IR_TYPE (IR_TYPE_RC5/IR_TYPE_NEC).
+ * The deprecated tables should use IR_TYPE_UNKNOWN
+ */
+#define IR_TABLE(irname, type, tabname)				\
+struct ir_scancode_table tabname ## _table = {			\
+	.scan = tabname,					\
+	.size = ARRAY_SIZE(tabname),				\
+	.ir_type = type,					\
+	.name = #irname,					\
+};								\
+EXPORT_SYMBOL_GPL(tabname ## _table)
+
+
 /* empty keytable, can be used as placeholder for not-yet created keytables */
 static struct ir_scancode ir_codes_empty[] = {
 	{ 0x2a, KEY_COFFEE },
 };
-
-struct ir_scancode_table ir_codes_empty_table = {
-	.scan = ir_codes_empty,
-	.size = ARRAY_SIZE(ir_codes_empty),
-};
-EXPORT_SYMBOL_GPL(ir_codes_empty_table);
+IR_TABLE(empty, IR_TYPE_UNKNOWN, ir_codes_empty);
 
 /* Michal Majchrowicz <mmajchrowicz@gmail.com> */
 static struct ir_scancode ir_codes_proteus_2309[] = {
@@ -68,12 +80,7 @@ static struct ir_scancode ir_codes_proteus_2309[] = {
 	{ 0x1e, KEY_VOLUMEUP },		/* volume +    */
 	{ 0x14, KEY_F1 },
 };
-
-struct ir_scancode_table ir_codes_proteus_2309_table = {
-	.scan = ir_codes_proteus_2309,
-	.size = ARRAY_SIZE(ir_codes_proteus_2309),
-};
-EXPORT_SYMBOL_GPL(ir_codes_proteus_2309_table);
+IR_TABLE(proteus_2309, IR_TYPE_UNKNOWN, ir_codes_proteus_2309);
 
 /* Matt Jesson <dvb@jesson.eclipse.co.uk */
 static struct ir_scancode ir_codes_avermedia_dvbt[] = {
@@ -113,12 +120,7 @@ static struct ir_scancode ir_codes_avermedia_dvbt[] = {
 	{ 0x1e, KEY_VOLUMEDOWN },	/* 'volume -' */
 	{ 0x3e, KEY_VOLUMEUP },		/* 'volume +' */
 };
-
-struct ir_scancode_table ir_codes_avermedia_dvbt_table = {
-	.scan = ir_codes_avermedia_dvbt,
-	.size = ARRAY_SIZE(ir_codes_avermedia_dvbt),
-};
-EXPORT_SYMBOL_GPL(ir_codes_avermedia_dvbt_table);
+IR_TABLE(avermedia_dvbt, IR_TYPE_UNKNOWN, ir_codes_avermedia_dvbt);
 
 /* Mauro Carvalho Chehab <mchehab@infradead.org> */
 static struct ir_scancode ir_codes_avermedia_m135a[] = {
@@ -168,12 +170,7 @@ static struct ir_scancode ir_codes_avermedia_m135a[] = {
 	{ 0x18, KEY_PLAY },
 	{ 0x1b, KEY_STOP },
 };
-
-struct ir_scancode_table ir_codes_avermedia_m135a_table = {
-	.scan = ir_codes_avermedia_m135a,
-	.size = ARRAY_SIZE(ir_codes_avermedia_m135a),
-};
-EXPORT_SYMBOL_GPL(ir_codes_avermedia_m135a_table);
+IR_TABLE(avermedia_m135a, IR_TYPE_UNKNOWN, ir_codes_avermedia_m135a);
 
 /* Oldrich Jedlicka <oldium.pro@seznam.cz> */
 static struct ir_scancode ir_codes_avermedia_cardbus[] = {
@@ -232,12 +229,7 @@ static struct ir_scancode ir_codes_avermedia_cardbus[] = {
 	{ 0x42, KEY_CHANNELDOWN },	/* Channel down */
 	{ 0x43, KEY_CHANNELUP },	/* Channel up */
 };
-
-struct ir_scancode_table ir_codes_avermedia_cardbus_table = {
-	.scan = ir_codes_avermedia_cardbus,
-	.size = ARRAY_SIZE(ir_codes_avermedia_cardbus),
-};
-EXPORT_SYMBOL_GPL(ir_codes_avermedia_cardbus_table);
+IR_TABLE(avermedia_cardbus, IR_TYPE_UNKNOWN, ir_codes_avermedia_cardbus);
 
 /* Attila Kondoros <attila.kondoros@chello.hu> */
 static struct ir_scancode ir_codes_apac_viewcomp[] = {
@@ -279,12 +271,7 @@ static struct ir_scancode ir_codes_apac_viewcomp[] = {
 	{ 0x0c, KEY_KPPLUS },		/* fine tune >>>> */
 	{ 0x18, KEY_KPMINUS },		/* fine tune <<<< */
 };
-
-struct ir_scancode_table ir_codes_apac_viewcomp_table = {
-	.scan = ir_codes_apac_viewcomp,
-	.size = ARRAY_SIZE(ir_codes_apac_viewcomp),
-};
-EXPORT_SYMBOL_GPL(ir_codes_apac_viewcomp_table);
+IR_TABLE(apac_viewcomp, IR_TYPE_UNKNOWN, ir_codes_apac_viewcomp);
 
 /* ---------------------------------------------------------------------- */
 
@@ -331,12 +318,7 @@ static struct ir_scancode ir_codes_pixelview[] = {
 	{ 0x1d, KEY_REFRESH },		/* reset */
 	{ 0x18, KEY_MUTE },		/* mute/unmute */
 };
-
-struct ir_scancode_table ir_codes_pixelview_table = {
-	.scan = ir_codes_pixelview,
-	.size = ARRAY_SIZE(ir_codes_pixelview),
-};
-EXPORT_SYMBOL_GPL(ir_codes_pixelview_table);
+IR_TABLE(pixelview, IR_TYPE_UNKNOWN, ir_codes_pixelview);
 
 /*
    Mauro Carvalho Chehab <mchehab@infradead.org>
@@ -381,12 +363,7 @@ static struct ir_scancode ir_codes_pixelview_new[] = {
 	{ 0x31, KEY_TV },
 	{ 0x34, KEY_RADIO },
 };
-
-struct ir_scancode_table ir_codes_pixelview_new_table = {
-	.scan = ir_codes_pixelview_new,
-	.size = ARRAY_SIZE(ir_codes_pixelview_new),
-};
-EXPORT_SYMBOL_GPL(ir_codes_pixelview_new_table);
+IR_TABLE(pixelview_new, IR_TYPE_UNKNOWN, ir_codes_pixelview_new);
 
 static struct ir_scancode ir_codes_nebula[] = {
 	{ 0x00, KEY_0 },
@@ -445,12 +422,7 @@ static struct ir_scancode ir_codes_nebula[] = {
 	{ 0x35, KEY_PHONE },
 	{ 0x36, KEY_PC },
 };
-
-struct ir_scancode_table ir_codes_nebula_table = {
-	.scan = ir_codes_nebula,
-	.size = ARRAY_SIZE(ir_codes_nebula),
-};
-EXPORT_SYMBOL_GPL(ir_codes_nebula_table);
+IR_TABLE(nebula, IR_TYPE_UNKNOWN, ir_codes_nebula);
 
 /* DigitalNow DNTV Live DVB-T Remote */
 static struct ir_scancode ir_codes_dntv_live_dvb_t[] = {
@@ -490,12 +462,7 @@ static struct ir_scancode ir_codes_dntv_live_dvb_t[] = {
 	{ 0x1e, KEY_CHANNELDOWN },
 	{ 0x1f, KEY_VOLUMEDOWN },
 };
-
-struct ir_scancode_table ir_codes_dntv_live_dvb_t_table = {
-	.scan = ir_codes_dntv_live_dvb_t,
-	.size = ARRAY_SIZE(ir_codes_dntv_live_dvb_t),
-};
-EXPORT_SYMBOL_GPL(ir_codes_dntv_live_dvb_t_table);
+IR_TABLE(dntv_live_dvb_t, IR_TYPE_UNKNOWN, ir_codes_dntv_live_dvb_t);
 
 /* ---------------------------------------------------------------------- */
 
@@ -547,12 +514,7 @@ static struct ir_scancode ir_codes_iodata_bctv7e[] = {
 	{ 0x61, KEY_FASTFORWARD },	/* forward >> */
 	{ 0x01, KEY_NEXT },		/* skip >| */
 };
-
-struct ir_scancode_table ir_codes_iodata_bctv7e_table = {
-	.scan = ir_codes_iodata_bctv7e,
-	.size = ARRAY_SIZE(ir_codes_iodata_bctv7e),
-};
-EXPORT_SYMBOL_GPL(ir_codes_iodata_bctv7e_table);
+IR_TABLE(iodata_bctv7e, IR_TYPE_UNKNOWN, ir_codes_iodata_bctv7e);
 
 /* ---------------------------------------------------------------------- */
 
@@ -605,12 +567,7 @@ static struct ir_scancode ir_codes_adstech_dvb_t_pci[] = {
 	{ 0x15, KEY_VOLUMEUP },
 	{ 0x1c, KEY_VOLUMEDOWN },
 };
-
-struct ir_scancode_table ir_codes_adstech_dvb_t_pci_table = {
-	.scan = ir_codes_adstech_dvb_t_pci,
-	.size = ARRAY_SIZE(ir_codes_adstech_dvb_t_pci),
-};
-EXPORT_SYMBOL_GPL(ir_codes_adstech_dvb_t_pci_table);
+IR_TABLE(adstech_dvb_t_pci, IR_TYPE_UNKNOWN, ir_codes_adstech_dvb_t_pci);
 
 /* ---------------------------------------------------------------------- */
 
@@ -644,12 +601,7 @@ static struct ir_scancode ir_codes_msi_tvanywhere[] = {
 	{ 0x1e, KEY_CHANNELDOWN },
 	{ 0x1f, KEY_VOLUMEDOWN },
 };
-
-struct ir_scancode_table ir_codes_msi_tvanywhere_table = {
-	.scan = ir_codes_msi_tvanywhere,
-	.size = ARRAY_SIZE(ir_codes_msi_tvanywhere),
-};
-EXPORT_SYMBOL_GPL(ir_codes_msi_tvanywhere_table);
+IR_TABLE(msi_tvanywhere, IR_TYPE_UNKNOWN, ir_codes_msi_tvanywhere);
 
 /* ---------------------------------------------------------------------- */
 
@@ -738,12 +690,7 @@ static struct ir_scancode ir_codes_msi_tvanywhere_plus[] = {
 	{ 0x0c, KEY_FASTFORWARD },	/* >> */
 	{ 0x1d, KEY_RESTART },		/* Reset */
 };
-
-struct ir_scancode_table ir_codes_msi_tvanywhere_plus_table = {
-	.scan = ir_codes_msi_tvanywhere_plus,
-	.size = ARRAY_SIZE(ir_codes_msi_tvanywhere_plus),
-};
-EXPORT_SYMBOL_GPL(ir_codes_msi_tvanywhere_plus_table);
+IR_TABLE(msi_tvanywhere_plus, IR_TYPE_UNKNOWN, ir_codes_msi_tvanywhere_plus);
 
 /* ---------------------------------------------------------------------- */
 
@@ -791,12 +738,7 @@ static struct ir_scancode ir_codes_cinergy_1400[] = {
 	{ 0x48, KEY_STOP },
 	{ 0x5c, KEY_NEXT },
 };
-
-struct ir_scancode_table ir_codes_cinergy_1400_table = {
-	.scan = ir_codes_cinergy_1400,
-	.size = ARRAY_SIZE(ir_codes_cinergy_1400),
-};
-EXPORT_SYMBOL_GPL(ir_codes_cinergy_1400_table);
+IR_TABLE(cinergy_1400, IR_TYPE_UNKNOWN, ir_codes_cinergy_1400);
 
 /* ---------------------------------------------------------------------- */
 
@@ -845,12 +787,7 @@ static struct ir_scancode ir_codes_avertv_303[] = {
 	{ 0x13, KEY_DOWN },
 	{ 0x1b, KEY_UP },
 };
-
-struct ir_scancode_table ir_codes_avertv_303_table = {
-	.scan = ir_codes_avertv_303,
-	.size = ARRAY_SIZE(ir_codes_avertv_303),
-};
-EXPORT_SYMBOL_GPL(ir_codes_avertv_303_table);
+IR_TABLE(avertv_303, IR_TYPE_UNKNOWN, ir_codes_avertv_303);
 
 /* ---------------------------------------------------------------------- */
 
@@ -911,12 +848,7 @@ static struct ir_scancode ir_codes_dntv_live_dvbt_pro[] = {
 	{ 0x5c, KEY_YELLOW },
 	{ 0x5d, KEY_BLUE },
 };
-
-struct ir_scancode_table ir_codes_dntv_live_dvbt_pro_table = {
-	.scan = ir_codes_dntv_live_dvbt_pro,
-	.size = ARRAY_SIZE(ir_codes_dntv_live_dvbt_pro),
-};
-EXPORT_SYMBOL_GPL(ir_codes_dntv_live_dvbt_pro_table);
+IR_TABLE(dntv_live_dvbt_pro, IR_TYPE_UNKNOWN, ir_codes_dntv_live_dvbt_pro);
 
 static struct ir_scancode ir_codes_em_terratec[] = {
 	{ 0x01, KEY_CHANNEL },
@@ -948,12 +880,7 @@ static struct ir_scancode ir_codes_em_terratec[] = {
 	{ 0x1e, KEY_STOP },
 	{ 0x40, KEY_ZOOM },
 };
-
-struct ir_scancode_table ir_codes_em_terratec_table = {
-	.scan = ir_codes_em_terratec,
-	.size = ARRAY_SIZE(ir_codes_em_terratec),
-};
-EXPORT_SYMBOL_GPL(ir_codes_em_terratec_table);
+IR_TABLE(em_terratec, IR_TYPE_UNKNOWN, ir_codes_em_terratec);
 
 static struct ir_scancode ir_codes_pinnacle_grey[] = {
 	{ 0x3a, KEY_0 },
@@ -1005,12 +932,7 @@ static struct ir_scancode ir_codes_pinnacle_grey[] = {
 	{ 0x2a, KEY_MEDIA },
 	{ 0x18, KEY_EPG },
 };
-
-struct ir_scancode_table ir_codes_pinnacle_grey_table = {
-	.scan = ir_codes_pinnacle_grey,
-	.size = ARRAY_SIZE(ir_codes_pinnacle_grey),
-};
-EXPORT_SYMBOL_GPL(ir_codes_pinnacle_grey_table);
+IR_TABLE(pinnacle_grey, IR_TYPE_UNKNOWN, ir_codes_pinnacle_grey);
 
 static struct ir_scancode ir_codes_flyvideo[] = {
 	{ 0x0f, KEY_0 },
@@ -1043,12 +965,7 @@ static struct ir_scancode ir_codes_flyvideo[] = {
 	{ 0x1f, KEY_FORWARD },	/* Forward ( >>> ) */
 	{ 0x0a, KEY_ANGLE },	/* no label, may be used as the PAUSE button */
 };
-
-struct ir_scancode_table ir_codes_flyvideo_table = {
-	.scan = ir_codes_flyvideo,
-	.size = ARRAY_SIZE(ir_codes_flyvideo),
-};
-EXPORT_SYMBOL_GPL(ir_codes_flyvideo_table);
+IR_TABLE(flyvideo, IR_TYPE_UNKNOWN, ir_codes_flyvideo);
 
 static struct ir_scancode ir_codes_flydvb[] = {
 	{ 0x01, KEY_ZOOM },		/* Full Screen */
@@ -1088,12 +1005,7 @@ static struct ir_scancode ir_codes_flydvb[] = {
 	{ 0x11, KEY_STOP },		/* Stop */
 	{ 0x0e, KEY_NEXT },		/* End >>| */
 };
-
-struct ir_scancode_table ir_codes_flydvb_table = {
-	.scan = ir_codes_flydvb,
-	.size = ARRAY_SIZE(ir_codes_flydvb),
-};
-EXPORT_SYMBOL_GPL(ir_codes_flydvb_table);
+IR_TABLE(flydvb, IR_TYPE_UNKNOWN, ir_codes_flydvb);
 
 static struct ir_scancode ir_codes_cinergy[] = {
 	{ 0x00, KEY_0 },
@@ -1134,12 +1046,7 @@ static struct ir_scancode ir_codes_cinergy[] = {
 	{ 0x22, KEY_PAUSE },
 	{ 0x23, KEY_STOP },
 };
-
-struct ir_scancode_table ir_codes_cinergy_table = {
-	.scan = ir_codes_cinergy,
-	.size = ARRAY_SIZE(ir_codes_cinergy),
-};
-EXPORT_SYMBOL_GPL(ir_codes_cinergy_table);
+IR_TABLE(cinergy, IR_TYPE_UNKNOWN, ir_codes_cinergy);
 
 /* Alfons Geser <a.geser@cox.net>
  * updates from Job D. R. Borges <jobdrb@ig.com.br> */
@@ -1197,12 +1104,7 @@ static struct ir_scancode ir_codes_eztv[] = {
 	{ 0x13, KEY_ENTER },	/* enter */
 	{ 0x21, KEY_DOT },	/* . (decimal dot) */
 };
-
-struct ir_scancode_table ir_codes_eztv_table = {
-	.scan = ir_codes_eztv,
-	.size = ARRAY_SIZE(ir_codes_eztv),
-};
-EXPORT_SYMBOL_GPL(ir_codes_eztv_table);
+IR_TABLE(eztv, IR_TYPE_UNKNOWN, ir_codes_eztv);
 
 /* Alex Hermann <gaaf@gmx.net> */
 static struct ir_scancode ir_codes_avermedia[] = {
@@ -1250,12 +1152,7 @@ static struct ir_scancode ir_codes_avermedia[] = {
 	{ 0x11, KEY_CHANNELDOWN },	/* CHANNEL/PAGE- */
 	{ 0x31, KEY_CHANNELUP }		/* CHANNEL/PAGE+ */
 };
-
-struct ir_scancode_table ir_codes_avermedia_table = {
-	.scan = ir_codes_avermedia,
-	.size = ARRAY_SIZE(ir_codes_avermedia),
-};
-EXPORT_SYMBOL_GPL(ir_codes_avermedia_table);
+IR_TABLE(avermedia, IR_TYPE_UNKNOWN, ir_codes_avermedia);
 
 static struct ir_scancode ir_codes_videomate_tv_pvr[] = {
 	{ 0x14, KEY_MUTE },
@@ -1305,12 +1202,7 @@ static struct ir_scancode ir_codes_videomate_tv_pvr[] = {
 	{ 0x20, KEY_LANGUAGE },
 	{ 0x21, KEY_SLEEP },
 };
-
-struct ir_scancode_table ir_codes_videomate_tv_pvr_table = {
-	.scan = ir_codes_videomate_tv_pvr,
-	.size = ARRAY_SIZE(ir_codes_videomate_tv_pvr),
-};
-EXPORT_SYMBOL_GPL(ir_codes_videomate_tv_pvr_table);
+IR_TABLE(videomate_tv_pvr, IR_TYPE_UNKNOWN, ir_codes_videomate_tv_pvr);
 
 /* Michael Tokarev <mjt@tls.msk.ru>
    http://www.corpit.ru/mjt/beholdTV/remote_control.jpg
@@ -1407,12 +1299,7 @@ static struct ir_scancode ir_codes_manli[] = {
 
 	/* 0x1d unused ? */
 };
-
-struct ir_scancode_table ir_codes_manli_table = {
-	.scan = ir_codes_manli,
-	.size = ARRAY_SIZE(ir_codes_manli),
-};
-EXPORT_SYMBOL_GPL(ir_codes_manli_table);
+IR_TABLE(manli, IR_TYPE_UNKNOWN, ir_codes_manli);
 
 /* Mike Baikov <mike@baikov.com> */
 static struct ir_scancode ir_codes_gotview7135[] = {
@@ -1453,12 +1340,7 @@ static struct ir_scancode ir_codes_gotview7135[] = {
 	{ 0x1e, KEY_TIME },	/* TIMESHIFT */
 	{ 0x38, KEY_F24 },	/* NORMAL TIMESHIFT */
 };
-
-struct ir_scancode_table ir_codes_gotview7135_table = {
-	.scan = ir_codes_gotview7135,
-	.size = ARRAY_SIZE(ir_codes_gotview7135),
-};
-EXPORT_SYMBOL_GPL(ir_codes_gotview7135_table);
+IR_TABLE(gotview7135, IR_TYPE_UNKNOWN, ir_codes_gotview7135);
 
 static struct ir_scancode ir_codes_purpletv[] = {
 	{ 0x03, KEY_POWER },
@@ -1502,12 +1384,7 @@ static struct ir_scancode ir_codes_purpletv[] = {
 	{ 0x42, KEY_REWIND },	/* Backward ? */
 
 };
-
-struct ir_scancode_table ir_codes_purpletv_table = {
-	.scan = ir_codes_purpletv,
-	.size = ARRAY_SIZE(ir_codes_purpletv),
-};
-EXPORT_SYMBOL_GPL(ir_codes_purpletv_table);
+IR_TABLE(purpletv, IR_TYPE_UNKNOWN, ir_codes_purpletv);
 
 /* Mapping for the 28 key remote control as seen at
    http://www.sednacomputer.com/photo/cardbus-tv.jpg
@@ -1549,12 +1426,7 @@ static struct ir_scancode ir_codes_pctv_sedna[] = {
 	{ 0x17, KEY_DIGITS },	/* Plus */
 	{ 0x1f, KEY_PLAY },	/* Play */
 };
-
-struct ir_scancode_table ir_codes_pctv_sedna_table = {
-	.scan = ir_codes_pctv_sedna,
-	.size = ARRAY_SIZE(ir_codes_pctv_sedna),
-};
-EXPORT_SYMBOL_GPL(ir_codes_pctv_sedna_table);
+IR_TABLE(pctv_sedna, IR_TYPE_UNKNOWN, ir_codes_pctv_sedna);
 
 /* Mark Phalan <phalanm@o2.ie> */
 static struct ir_scancode ir_codes_pv951[] = {
@@ -1594,12 +1466,7 @@ static struct ir_scancode ir_codes_pv951[] = {
 	{ 0x14, KEY_EQUAL },		/* SYNC */
 	{ 0x1c, KEY_MEDIA },		/* PC/TV */
 };
-
-struct ir_scancode_table ir_codes_pv951_table = {
-	.scan = ir_codes_pv951,
-	.size = ARRAY_SIZE(ir_codes_pv951),
-};
-EXPORT_SYMBOL_GPL(ir_codes_pv951_table);
+IR_TABLE(pv951, IR_TYPE_UNKNOWN, ir_codes_pv951);
 
 /* generic RC5 keytable                                          */
 /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */
@@ -1642,12 +1509,7 @@ static struct ir_scancode ir_codes_rc5_tv[] = {
 	{ 0x3d, KEY_SUSPEND },		/* system standby */
 
 };
-
-struct ir_scancode_table ir_codes_rc5_tv_table = {
-	.scan = ir_codes_rc5_tv,
-	.size = ARRAY_SIZE(ir_codes_rc5_tv),
-};
-EXPORT_SYMBOL_GPL(ir_codes_rc5_tv_table);
+IR_TABLE(rc5_tv, IR_TYPE_UNKNOWN, ir_codes_rc5_tv);
 
 /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */
 static struct ir_scancode ir_codes_winfast[] = {
@@ -1711,12 +1573,7 @@ static struct ir_scancode ir_codes_winfast[] = {
 	{ 0x3b, KEY_F23 },		/* MCE +CH,  on Y04G0033 */
 	{ 0x3f, KEY_F24 }		/* MCE -CH,  on Y04G0033 */
 };
-
-struct ir_scancode_table ir_codes_winfast_table = {
-	.scan = ir_codes_winfast,
-	.size = ARRAY_SIZE(ir_codes_winfast),
-};
-EXPORT_SYMBOL_GPL(ir_codes_winfast_table);
+IR_TABLE(winfast, IR_TYPE_UNKNOWN, ir_codes_winfast);
 
 static struct ir_scancode ir_codes_pinnacle_color[] = {
 	{ 0x59, KEY_MUTE },
@@ -1773,12 +1630,7 @@ static struct ir_scancode ir_codes_pinnacle_color[] = {
 	{ 0x74, KEY_CHANNEL },
 	{ 0x0a, KEY_BACKSPACE },
 };
-
-struct ir_scancode_table ir_codes_pinnacle_color_table = {
-	.scan = ir_codes_pinnacle_color,
-	.size = ARRAY_SIZE(ir_codes_pinnacle_color),
-};
-EXPORT_SYMBOL_GPL(ir_codes_pinnacle_color_table);
+IR_TABLE(pinnacle_color, IR_TYPE_UNKNOWN, ir_codes_pinnacle_color);
 
 /* Hauppauge: the newer, gray remotes (seems there are multiple
  * slightly different versions), shipped with cx88+ivtv cards.
@@ -1840,12 +1692,7 @@ static struct ir_scancode ir_codes_hauppauge_new[] = {
 	{ 0x3c, KEY_ZOOM },		/* full */
 	{ 0x3d, KEY_POWER },		/* system power (green button) */
 };
-
-struct ir_scancode_table ir_codes_hauppauge_new_table = {
-	.scan = ir_codes_hauppauge_new,
-	.size = ARRAY_SIZE(ir_codes_hauppauge_new),
-};
-EXPORT_SYMBOL_GPL(ir_codes_hauppauge_new_table);
+IR_TABLE(hauppauge_new, IR_TYPE_UNKNOWN, ir_codes_hauppauge_new);
 
 static struct ir_scancode ir_codes_npgtech[] = {
 	{ 0x1d, KEY_SWITCHVIDEOMODE },	/* switch inputs */
@@ -1888,12 +1735,7 @@ static struct ir_scancode ir_codes_npgtech[] = {
 	{ 0x10, KEY_POWER },
 
 };
-
-struct ir_scancode_table ir_codes_npgtech_table = {
-	.scan = ir_codes_npgtech,
-	.size = ARRAY_SIZE(ir_codes_npgtech),
-};
-EXPORT_SYMBOL_GPL(ir_codes_npgtech_table);
+IR_TABLE(npgtech, IR_TYPE_UNKNOWN, ir_codes_npgtech);
 
 /* Norwood Micro (non-Pro) TV Tuner
    By Peter Naulls <peter@chocky.org>
@@ -1940,12 +1782,7 @@ static struct ir_scancode ir_codes_norwood[] = {
 	{ 0x34, KEY_RADIO },		/* FM                  */
 	{ 0x65, KEY_POWER },		/* Computer power      */
 };
-
-struct ir_scancode_table ir_codes_norwood_table = {
-	.scan = ir_codes_norwood,
-	.size = ARRAY_SIZE(ir_codes_norwood),
-};
-EXPORT_SYMBOL_GPL(ir_codes_norwood_table);
+IR_TABLE(norwood, IR_TYPE_UNKNOWN, ir_codes_norwood);
 
 /* From reading the following remotes:
  * Zenith Universal 7 / TV Mode 807 / VCR Mode 837
@@ -1999,12 +1836,7 @@ static struct ir_scancode ir_codes_budget_ci_old[] = {
 	{ 0x3d, KEY_POWER2 },
 	{ 0x3e, KEY_TUNER },
 };
-
-struct ir_scancode_table ir_codes_budget_ci_old_table = {
-	.scan = ir_codes_budget_ci_old,
-	.size = ARRAY_SIZE(ir_codes_budget_ci_old),
-};
-EXPORT_SYMBOL_GPL(ir_codes_budget_ci_old_table);
+IR_TABLE(budget_ci_old, IR_TYPE_UNKNOWN, ir_codes_budget_ci_old);
 
 /*
  * Marc Fargas <telenieko@telenieko.com>
@@ -2057,13 +1889,7 @@ static struct ir_scancode ir_codes_asus_pc39[] = {
 	{ 0x3d, KEY_MUTE },		/* mute */
 	{ 0x01, KEY_DVD },		/* dvd */
 };
-
-struct ir_scancode_table ir_codes_asus_pc39_table = {
-	.scan = ir_codes_asus_pc39,
-	.size = ARRAY_SIZE(ir_codes_asus_pc39),
-};
-EXPORT_SYMBOL_GPL(ir_codes_asus_pc39_table);
-
+IR_TABLE(asus_pc39, IR_TYPE_UNKNOWN, ir_codes_asus_pc39);
 
 /* Encore ENLTV-FM  - black plastic, white front cover with white glowing buttons
     Juan Pablo Sormani <sorman@gmail.com> */
@@ -2137,12 +1963,7 @@ static struct ir_scancode ir_codes_encore_enltv[] = {
 	{ 0x47, KEY_YELLOW },		/* AP3 */
 	{ 0x57, KEY_BLUE },		/* AP4 */
 };
-
-struct ir_scancode_table ir_codes_encore_enltv_table = {
-	.scan = ir_codes_encore_enltv,
-	.size = ARRAY_SIZE(ir_codes_encore_enltv),
-};
-EXPORT_SYMBOL_GPL(ir_codes_encore_enltv_table);
+IR_TABLE(encore_enltv, IR_TYPE_UNKNOWN, ir_codes_encore_enltv);
 
 /* Encore ENLTV2-FM  - silver plastic - "Wand Media" written at the botton
     Mauro Carvalho Chehab <mchehab@infradead.org> */
@@ -2194,12 +2015,7 @@ static struct ir_scancode ir_codes_encore_enltv2[] = {
 	{ 0x7d, KEY_FORWARD },
 	{ 0x79, KEY_STOP },
 };
-
-struct ir_scancode_table ir_codes_encore_enltv2_table = {
-	.scan = ir_codes_encore_enltv2,
-	.size = ARRAY_SIZE(ir_codes_encore_enltv2),
-};
-EXPORT_SYMBOL_GPL(ir_codes_encore_enltv2_table);
+IR_TABLE(encore_enltv2, IR_TYPE_UNKNOWN, ir_codes_encore_enltv2);
 
 /* for the Technotrend 1500 bundled remotes (grey and black): */
 static struct ir_scancode ir_codes_tt_1500[] = {
@@ -2243,12 +2059,7 @@ static struct ir_scancode ir_codes_tt_1500[] = {
 	{ 0x3e, KEY_PAUSE },
 	{ 0x3f, KEY_FORWARD },
 };
-
-struct ir_scancode_table ir_codes_tt_1500_table = {
-	.scan = ir_codes_tt_1500,
-	.size = ARRAY_SIZE(ir_codes_tt_1500),
-};
-EXPORT_SYMBOL_GPL(ir_codes_tt_1500_table);
+IR_TABLE(tt_1500, IR_TYPE_UNKNOWN, ir_codes_tt_1500);
 
 /* DViCO FUSION HDTV MCE remote */
 static struct ir_scancode ir_codes_fusionhdtv_mce[] = {
@@ -2308,12 +2119,7 @@ static struct ir_scancode ir_codes_fusionhdtv_mce[] = {
 	{ 0x01, KEY_RECORD },
 	{ 0x4e, KEY_POWER },
 };
-
-struct ir_scancode_table ir_codes_fusionhdtv_mce_table = {
-	.scan = ir_codes_fusionhdtv_mce,
-	.size = ARRAY_SIZE(ir_codes_fusionhdtv_mce),
-};
-EXPORT_SYMBOL_GPL(ir_codes_fusionhdtv_mce_table);
+IR_TABLE(fusionhdtv_mce, IR_TYPE_UNKNOWN, ir_codes_fusionhdtv_mce);
 
 /* Pinnacle PCTV HD 800i mini remote */
 static struct ir_scancode ir_codes_pinnacle_pctv_hd[] = {
@@ -2348,12 +2154,7 @@ static struct ir_scancode ir_codes_pinnacle_pctv_hd[] = {
 	{ 0x36, KEY_RECORD },
 	{ 0x3f, KEY_EPG },	/* Labeled "?" */
 };
-
-struct ir_scancode_table ir_codes_pinnacle_pctv_hd_table = {
-	.scan = ir_codes_pinnacle_pctv_hd,
-	.size = ARRAY_SIZE(ir_codes_pinnacle_pctv_hd),
-};
-EXPORT_SYMBOL_GPL(ir_codes_pinnacle_pctv_hd_table);
+IR_TABLE(pinnacle_pctv_hd, IR_TYPE_UNKNOWN, ir_codes_pinnacle_pctv_hd);
 
 /*
  * Igor Kuznetsov <igk72@ya.ru>
@@ -2456,12 +2257,7 @@ static struct ir_scancode ir_codes_behold[] = {
 	{ 0x5c, KEY_CAMERA },
 
 };
-
-struct ir_scancode_table ir_codes_behold_table = {
-	.scan = ir_codes_behold,
-	.size = ARRAY_SIZE(ir_codes_behold),
-};
-EXPORT_SYMBOL_GPL(ir_codes_behold_table);
+IR_TABLE(behold, IR_TYPE_UNKNOWN, ir_codes_behold);
 
 /* Beholder Intl. Ltd. 2008
  * Dmitry Belimov d.belimov@google.com
@@ -2531,12 +2327,7 @@ static struct ir_scancode ir_codes_behold_columbus[] = {
 	{ 0x1A, KEY_NEXT },
 
 };
-
-struct ir_scancode_table ir_codes_behold_columbus_table = {
-	.scan = ir_codes_behold_columbus,
-	.size = ARRAY_SIZE(ir_codes_behold_columbus),
-};
-EXPORT_SYMBOL_GPL(ir_codes_behold_columbus_table);
+IR_TABLE(behold_columbus, IR_TYPE_UNKNOWN, ir_codes_behold_columbus);
 
 /*
  * Remote control for the Genius TVGO A11MCE
@@ -2582,12 +2373,7 @@ static struct ir_scancode ir_codes_genius_tvgo_a11mce[] = {
 	{ 0x13, KEY_YELLOW },
 	{ 0x50, KEY_BLUE },
 };
-
-struct ir_scancode_table ir_codes_genius_tvgo_a11mce_table = {
-	.scan = ir_codes_genius_tvgo_a11mce,
-	.size = ARRAY_SIZE(ir_codes_genius_tvgo_a11mce),
-};
-EXPORT_SYMBOL_GPL(ir_codes_genius_tvgo_a11mce_table);
+IR_TABLE(genius_tvgo_a11mce, IR_TYPE_UNKNOWN, ir_codes_genius_tvgo_a11mce);
 
 /*
  * Remote control for Powercolor Real Angel 330
@@ -2630,12 +2416,7 @@ static struct ir_scancode ir_codes_powercolor_real_angel[] = {
 	{ 0x14, KEY_RADIO },		/* FM radio */
 	{ 0x25, KEY_POWER },		/* power */
 };
-
-struct ir_scancode_table ir_codes_powercolor_real_angel_table = {
-	.scan = ir_codes_powercolor_real_angel,
-	.size = ARRAY_SIZE(ir_codes_powercolor_real_angel),
-};
-EXPORT_SYMBOL_GPL(ir_codes_powercolor_real_angel_table);
+IR_TABLE(powercolor_real_angel, IR_TYPE_UNKNOWN, ir_codes_powercolor_real_angel);
 
 /* Kworld Plus TV Analog Lite PCI IR
    Mauro Carvalho Chehab <mchehab@infradead.org>
@@ -2696,11 +2477,7 @@ static struct ir_scancode ir_codes_kworld_plus_tv_analog[] = {
 	{ 0x18, KEY_RED},		/* B */
 	{ 0x23, KEY_GREEN},		/* C */
 };
-struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table = {
-	.scan = ir_codes_kworld_plus_tv_analog,
-	.size = ARRAY_SIZE(ir_codes_kworld_plus_tv_analog),
-};
-EXPORT_SYMBOL_GPL(ir_codes_kworld_plus_tv_analog_table);
+IR_TABLE(kworld_plus_tv_analog, IR_TYPE_UNKNOWN, ir_codes_kworld_plus_tv_analog);
 
 /* Kaiomy TVnPC U2
    Mauro Carvalho Chehab <mchehab@infradead.org>
@@ -2749,11 +2526,7 @@ static struct ir_scancode ir_codes_kaiomy[] = {
 	{ 0x1e, KEY_YELLOW},
 	{ 0x1f, KEY_BLUE},
 };
-struct ir_scancode_table ir_codes_kaiomy_table = {
-	.scan = ir_codes_kaiomy,
-	.size = ARRAY_SIZE(ir_codes_kaiomy),
-};
-EXPORT_SYMBOL_GPL(ir_codes_kaiomy_table);
+IR_TABLE(kaiomy, IR_TYPE_UNKNOWN, ir_codes_kaiomy);
 
 static struct ir_scancode ir_codes_avermedia_a16d[] = {
 	{ 0x20, KEY_LIST},
@@ -2791,11 +2564,7 @@ static struct ir_scancode ir_codes_avermedia_a16d[] = {
 	{ 0x08, KEY_EPG},
 	{ 0x2a, KEY_MENU},
 };
-struct ir_scancode_table ir_codes_avermedia_a16d_table = {
-	.scan = ir_codes_avermedia_a16d,
-	.size = ARRAY_SIZE(ir_codes_avermedia_a16d),
-};
-EXPORT_SYMBOL_GPL(ir_codes_avermedia_a16d_table);
+IR_TABLE(avermedia_a16d, IR_TYPE_UNKNOWN, ir_codes_avermedia_a16d);
 
 /* Encore ENLTV-FM v5.3
    Mauro Carvalho Chehab <mchehab@infradead.org>
@@ -2838,11 +2607,7 @@ static struct ir_scancode ir_codes_encore_enltv_fm53[] = {
 	{ 0x0c, KEY_ZOOM},		/* hide pannel */
 	{ 0x47, KEY_SLEEP},		/* shutdown */
 };
-struct ir_scancode_table ir_codes_encore_enltv_fm53_table = {
-	.scan = ir_codes_encore_enltv_fm53,
-	.size = ARRAY_SIZE(ir_codes_encore_enltv_fm53),
-};
-EXPORT_SYMBOL_GPL(ir_codes_encore_enltv_fm53_table);
+IR_TABLE(encore_enltv_fm53, IR_TYPE_UNKNOWN, ir_codes_encore_enltv_fm53);
 
 /* Zogis Real Audio 220 - 32 keys IR */
 static struct ir_scancode ir_codes_real_audio_220_32_keys[] = {
@@ -2882,11 +2647,7 @@ static struct ir_scancode ir_codes_real_audio_220_32_keys[] = {
 	{ 0x19, KEY_CAMERA},		/* Snapshot */
 
 };
-struct ir_scancode_table ir_codes_real_audio_220_32_keys_table = {
-	.scan = ir_codes_real_audio_220_32_keys,
-	.size = ARRAY_SIZE(ir_codes_real_audio_220_32_keys),
-};
-EXPORT_SYMBOL_GPL(ir_codes_real_audio_220_32_keys_table);
+IR_TABLE(real_audio_220_32_keys, IR_TYPE_UNKNOWN, ir_codes_real_audio_220_32_keys);
 
 /* ATI TV Wonder HD 600 USB
    Devin Heitmueller <devin.heitmueller@gmail.com>
@@ -2917,11 +2678,7 @@ static struct ir_scancode ir_codes_ati_tv_wonder_hd_600[] = {
 	{ 0x16, KEY_MUTE},
 	{ 0x17, KEY_VOLUMEDOWN},
 };
-struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table = {
-	.scan = ir_codes_ati_tv_wonder_hd_600,
-	.size = ARRAY_SIZE(ir_codes_ati_tv_wonder_hd_600),
-};
-EXPORT_SYMBOL_GPL(ir_codes_ati_tv_wonder_hd_600_table);
+IR_TABLE(ati_tv_wonder_hd_600, IR_TYPE_UNKNOWN, ir_codes_ati_tv_wonder_hd_600);
 
 /* DVBWorld remotes
    Igor M. Liplianin <liplianin@me.by>
@@ -2959,11 +2716,7 @@ static struct ir_scancode ir_codes_dm1105_nec[] = {
 	{ 0x1e, KEY_TV},		/* tvmode */
 	{ 0x1b, KEY_B},			/* recall */
 };
-struct ir_scancode_table ir_codes_dm1105_nec_table = {
-	.scan = ir_codes_dm1105_nec,
-	.size = ARRAY_SIZE(ir_codes_dm1105_nec),
-};
-EXPORT_SYMBOL_GPL(ir_codes_dm1105_nec_table);
+IR_TABLE(dm1105_nec, IR_TYPE_UNKNOWN, ir_codes_dm1105_nec);
 
 static struct ir_scancode ir_codes_tevii_nec[] = {
 	{ 0x0a, KEY_POWER2},
@@ -3014,11 +2767,7 @@ static struct ir_scancode ir_codes_tevii_nec[] = {
 	{ 0x56, KEY_MODE},
 	{ 0x58, KEY_SWITCHVIDEOMODE},
 };
-struct ir_scancode_table ir_codes_tevii_nec_table = {
-	.scan = ir_codes_tevii_nec,
-	.size = ARRAY_SIZE(ir_codes_tevii_nec),
-};
-EXPORT_SYMBOL_GPL(ir_codes_tevii_nec_table);
+IR_TABLE(tevii_nec, IR_TYPE_UNKNOWN, ir_codes_tevii_nec);
 
 static struct ir_scancode ir_codes_tbs_nec[] = {
 	{ 0x04, KEY_POWER2},	/*power*/
@@ -3054,11 +2803,7 @@ static struct ir_scancode ir_codes_tbs_nec[] = {
 	{ 0x00, KEY_PREVIOUS},
 	{ 0x1b, KEY_MODE},
 };
-struct ir_scancode_table ir_codes_tbs_nec_table = {
-	.scan = ir_codes_tbs_nec,
-	.size = ARRAY_SIZE(ir_codes_tbs_nec),
-};
-EXPORT_SYMBOL_GPL(ir_codes_tbs_nec_table);
+IR_TABLE(tbs_nec, IR_TYPE_UNKNOWN, ir_codes_tbs_nec);
 
 /* Terratec Cinergy Hybrid T USB XS
    Devin Heitmueller <dheitmueller@linuxtv.org>
@@ -3112,11 +2857,7 @@ static struct ir_scancode ir_codes_terratec_cinergy_xs[] = {
 	{ 0x4f, KEY_FASTFORWARD},
 	{ 0x5c, KEY_NEXT},
 };
-struct ir_scancode_table ir_codes_terratec_cinergy_xs_table = {
-	.scan = ir_codes_terratec_cinergy_xs,
-	.size = ARRAY_SIZE(ir_codes_terratec_cinergy_xs),
-};
-EXPORT_SYMBOL_GPL(ir_codes_terratec_cinergy_xs_table);
+IR_TABLE(terratec_cinergy_xs, IR_TYPE_UNKNOWN, ir_codes_terratec_cinergy_xs);
 
 /* EVGA inDtube
    Devin Heitmueller <devin.heitmueller@gmail.com>
@@ -3139,11 +2880,7 @@ static struct ir_scancode ir_codes_evga_indtube[] = {
 	{ 0x1f, KEY_NEXT},
 	{ 0x13, KEY_CAMERA},
 };
-struct ir_scancode_table ir_codes_evga_indtube_table = {
-	.scan = ir_codes_evga_indtube,
-	.size = ARRAY_SIZE(ir_codes_evga_indtube),
-};
-EXPORT_SYMBOL_GPL(ir_codes_evga_indtube_table);
+IR_TABLE(evga_indtube, IR_TYPE_UNKNOWN, ir_codes_evga_indtube);
 
 static struct ir_scancode ir_codes_videomate_s350[] = {
 	{ 0x00, KEY_TV},
@@ -3191,11 +2928,7 @@ static struct ir_scancode ir_codes_videomate_s350[] = {
 	{ 0x11, KEY_ENTER},
 	{ 0x20, KEY_TEXT},
 };
-struct ir_scancode_table ir_codes_videomate_s350_table = {
-	.scan = ir_codes_videomate_s350,
-	.size = ARRAY_SIZE(ir_codes_videomate_s350),
-};
-EXPORT_SYMBOL_GPL(ir_codes_videomate_s350_table);
+IR_TABLE(videomate_s350, IR_TYPE_UNKNOWN, ir_codes_videomate_s350);
 
 /* GADMEI UTV330+ RM008Z remote
    Shine Liu <shinel@foxmail.com>
@@ -3238,11 +2971,7 @@ static struct ir_scancode ir_codes_gadmei_rm008z[] = {
 	{ 0x13, KEY_CHANNELDOWN},	/* CHANNELDOWN */
 	{ 0x15, KEY_ENTER},		/* OK */
 };
-struct ir_scancode_table ir_codes_gadmei_rm008z_table = {
-	.scan = ir_codes_gadmei_rm008z,
-	.size = ARRAY_SIZE(ir_codes_gadmei_rm008z),
-};
-EXPORT_SYMBOL_GPL(ir_codes_gadmei_rm008z_table);
+IR_TABLE(gadmei_rm008z, IR_TYPE_UNKNOWN, ir_codes_gadmei_rm008z);
 
 /*************************************************************
  *		COMPLETE SCANCODE TABLES
@@ -3313,13 +3042,7 @@ static struct ir_scancode ir_codes_rc5_hauppauge_new[] = {
 	{ 0x1e3c, KEY_ZOOM },		/* full */
 	{ 0x1e3d, KEY_POWER },		/* system power (green button) */
 };
-
-struct ir_scancode_table ir_codes_rc5_hauppauge_new_table = {
-	.scan = ir_codes_rc5_hauppauge_new,
-	.size = ARRAY_SIZE(ir_codes_rc5_hauppauge_new),
-	.ir_type = IR_TYPE_RC5,
-};
-EXPORT_SYMBOL_GPL(ir_codes_rc5_hauppauge_new_table);
+IR_TABLE(rc5_hauppauge_new, IR_TYPE_RC5, ir_codes_rc5_hauppauge_new);
 
 /* Terratec Cinergy Hybrid T USB XS FM
    Mauro Carvalho Chehab <mchehab@redhat.com>
@@ -3386,13 +3109,7 @@ static struct ir_scancode ir_codes_nec_terratec_cinergy_xs[] = {
 	{ 0x144f, KEY_FASTFORWARD},
 	{ 0x145c, KEY_NEXT},
 };
-struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table = {
-	.scan = ir_codes_nec_terratec_cinergy_xs,
-	.size = ARRAY_SIZE(ir_codes_nec_terratec_cinergy_xs),
-	.ir_type = IR_TYPE_NEC,
-};
-EXPORT_SYMBOL_GPL(ir_codes_nec_terratec_cinergy_xs_table);
-
+IR_TABLE(nec_terratec_cinergy_xs, IR_TYPE_NEC, ir_codes_nec_terratec_cinergy_xs);
 
 /* Leadtek Winfast TV USB II Deluxe remote
    Magnus Alm <magnus.alm@gmail.com>
@@ -3436,11 +3153,7 @@ static struct ir_scancode ir_codes_winfast_usbii_deluxe[] = {
 	{ 0x63, KEY_ENTER},		/* ENTER */
 
 };
-struct ir_scancode_table ir_codes_winfast_usbii_deluxe_table = {
-	.scan = ir_codes_winfast_usbii_deluxe,
-	.size = ARRAY_SIZE(ir_codes_winfast_usbii_deluxe),
-};
-EXPORT_SYMBOL_GPL(ir_codes_winfast_usbii_deluxe_table);
+IR_TABLE(winfast_usbii_deluxe, IR_TYPE_UNKNOWN, ir_codes_winfast_usbii_deluxe);
 
 /* Kworld 315U
  */
@@ -3485,10 +3198,4 @@ static struct ir_scancode ir_codes_kworld_315u[] = {
 	{ 0x611e, KEY_YELLOW },
 	{ 0x611f, KEY_BLUE },
 };
-
-struct ir_scancode_table ir_codes_kworld_315u_table = {
-	.scan = ir_codes_kworld_315u,
-	.size = ARRAY_SIZE(ir_codes_kworld_315u),
-	.ir_type = IR_TYPE_NEC,
-};
-EXPORT_SYMBOL_GPL(ir_codes_kworld_315u_table);
+IR_TABLE(kworld_315u, IR_TYPE_NEC, ir_codes_kworld_315u);
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index ce9f347..9ab8a77 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -35,7 +35,8 @@ struct ir_scancode {
 struct ir_scancode_table {
 	struct ir_scancode	*scan;
 	int			size;
-	u64		ir_type;
+	u64			ir_type;
+	char			*name;
 	spinlock_t		lock;
 };
 
-- 
1.6.6.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] V4L/DVB: ir-core: Export IR name via uevent
  2010-03-11 15:41 [PATCH 1/4] V4L/DVB: ir: use a real device instead of a virtual class Mauro Carvalho Chehab
  2010-03-12 14:40 ` [PATCH 2/4] Add a macro to properly create IR tables Mauro Carvalho Chehab
@ 2010-03-12 14:50 ` Mauro Carvalho Chehab
  2010-03-13  0:18 ` [PATCH 4/4] V4L/DVB: ir-core: export driver name used by IR " Mauro Carvalho Chehab
  2 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2010-03-12 14:50 UTC (permalink / raw)
  To: Linux Media Mailing List

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index c9c0a54..31f22ba 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -418,6 +418,7 @@ int ir_input_register(struct input_dev *input_dev,
 
 	spin_lock_init(&ir_dev->rc_tab.lock);
 
+	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 *
 				    sizeof(struct ir_scancode), GFP_KERNEL);
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index 1bb011a..0f4da05 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -125,6 +125,24 @@ static ssize_t store_protocol(struct device *d,
 	return len;
 }
 
+
+#define ADD_HOTPLUG_VAR(fmt, val...)					\
+	do {								\
+		int err = add_uevent_var(env, fmt, val);		\
+		if (err)						\
+			return err;					\
+	} while (0)
+
+static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env)
+{
+	struct ir_input_dev *ir_dev = dev_get_drvdata(device);
+
+	if (ir_dev->rc_tab.name)
+		ADD_HOTPLUG_VAR("NAME=\"%s\"", ir_dev->rc_tab.name);
+
+	return 0;
+}
+
 /*
  * Static device attribute struct with the sysfs attributes for IR's
  */
@@ -137,7 +155,7 @@ static struct attribute *ir_dev_attrs[] = {
 };
 
 static struct attribute_group ir_dev_attr_grp = {
-	.attrs	=ir_dev_attrs,
+	.attrs	= ir_dev_attrs,
 };
 
 static const struct attribute_group *ir_dev_attr_groups[] = {
@@ -147,9 +165,9 @@ static const struct attribute_group *ir_dev_attr_groups[] = {
 
 static struct device_type ir_dev_type = {
 	.groups		= ir_dev_attr_groups,
+	.uevent		= ir_dev_uevent,
 };
 
-
 /**
  * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv?
  * @input_dev:	the struct input_dev descriptor of the device
@@ -172,6 +190,7 @@ int ir_register_class(struct input_dev *input_dev)
 	ir_dev->dev.class = &ir_input_class;
 	ir_dev->dev.parent = input_dev->dev.parent;
 	dev_set_name(&ir_dev->dev, "irrcv%d", devno);
+	dev_set_drvdata(&ir_dev->dev, ir_dev);
 	rc = device_register(&ir_dev->dev);
 	if (rc)
 		return rc;
@@ -186,8 +205,8 @@ int ir_register_class(struct input_dev *input_dev)
 
 	__module_get(THIS_MODULE);
 
-	path = kobject_get_path(&input_dev->dev.kobj, GFP_KERNEL);
-	printk(KERN_INFO "%s: %s associated with sysfs %s\n",
+	path = kobject_get_path(&ir_dev->dev.kobj, GFP_KERNEL);
+	printk(KERN_INFO "%s: %s as %s\n",
 		dev_name(&ir_dev->dev),
 		input_dev->name ? input_dev->name : "Unspecified device",
 		path ? path : "N/A");
-- 
1.6.6.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] V4L/DVB: ir-core: export driver name used by IR via uevent
  2010-03-11 15:41 [PATCH 1/4] V4L/DVB: ir: use a real device instead of a virtual class Mauro Carvalho Chehab
  2010-03-12 14:40 ` [PATCH 2/4] Add a macro to properly create IR tables Mauro Carvalho Chehab
  2010-03-12 14:50 ` [PATCH 3/4] V4L/DVB: ir-core: Export IR name via uevent Mauro Carvalho Chehab
@ 2010-03-13  0:18 ` Mauro Carvalho Chehab
  2 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2010-03-13  0:18 UTC (permalink / raw)
  To: Linux Media Mailing List

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>

diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 31f22ba..2d9ba84 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -403,7 +403,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;
@@ -418,6 +419,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 *
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index 0f4da05..bbddf2f 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -139,6 +139,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;
 }
diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c
index 383cca3..f1721e9 100644
--- a/drivers/media/dvb/dm1105/dm1105.c
+++ b/drivers/media/dvb/dm1105/dm1105.c
@@ -45,6 +45,8 @@
 #include "z0194a.h"
 #include "ds3000.h"
 
+#define MODULE_NAME "dm1105"
+
 #define UNSET (-1U)
 
 #define DM1105_BOARD_NOAUTO		UNSET
@@ -627,7 +629,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;
 }
diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c
index 4675a3b..6baf302 100644
--- a/drivers/media/dvb/mantis/mantis_input.c
+++ b/drivers/media/dvb/mantis/mantis_input.c
@@ -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);
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index 49c2a81..ec89afd 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -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;
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index b320dbd..6c11687 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -48,6 +48,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)
@@ -389,7 +391,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;
 
diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c
index c5771db..1cbfba1 100644
--- a/drivers/media/video/cx231xx/cx231xx-input.c
+++ b/drivers/media/video/cx231xx/cx231xx-input.c
@@ -34,6 +34,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); \
@@ -216,7 +218,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;
 
diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c
index 9c6620f..2e6c023 100644
--- a/drivers/media/video/cx23885/cx23885-input.c
+++ b/drivers/media/video/cx23885/cx23885-input.c
@@ -50,6 +50,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) +
@@ -397,7 +399,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;
 
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index de180d4..8f1b846 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -31,6 +31,8 @@
 #include "cx88.h"
 #include <media/ir-common.h>
 
+#define MODULE_NAME "cx88xx"
+
 /* ---------------------------------------------------------------------- */
 
 struct cx88_IR {
@@ -383,7 +385,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;
 
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index 1fb754e..5a1850a 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -38,6 +38,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); \
@@ -473,7 +475,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;
 
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index da18d69..6af69d5 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 */
 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 */
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index f884b33..076be22 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -27,6 +27,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");
@@ -729,7 +731,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;
 
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 9ab8a77..1eae72d 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -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 */
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/4] Add a macro to properly create IR tables
  2010-03-12 14:40 ` [PATCH 2/4] Add a macro to properly create IR tables Mauro Carvalho Chehab
@ 2010-03-18 11:55   ` Aguirre, Sergio
  2010-03-18 12:07     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 6+ messages in thread
From: Aguirre, Sergio @ 2010-03-18 11:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List

Hi Mauro,

> -----Original Message-----
> From: linux-media-owner@vger.kernel.org [mailto:linux-media-
> owner@vger.kernel.org] On Behalf Of Mauro Carvalho Chehab
> Sent: Friday, March 12, 2010 8:40 AM
> To: Linux Media Mailing List
> Subject: [PATCH 2/4] Add a macro to properly create IR tables

This one is missing it's respective "V4L2/DVB:" prefix, as the other patches
In the series has.

Regards,
Sergio

> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> 

<snip>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/4] Add a macro to properly create IR tables
  2010-03-18 11:55   ` Aguirre, Sergio
@ 2010-03-18 12:07     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2010-03-18 12:07 UTC (permalink / raw)
  To: Aguirre, Sergio; +Cc: Linux Media Mailing List

Aguirre, Sergio wrote:
> Hi Mauro,
> 
>> -----Original Message-----
>> From: linux-media-owner@vger.kernel.org [mailto:linux-media-
>> owner@vger.kernel.org] On Behalf Of Mauro Carvalho Chehab
>> Sent: Friday, March 12, 2010 8:40 AM
>> To: Linux Media Mailing List
>> Subject: [PATCH 2/4] Add a macro to properly create IR tables
> 
> This one is missing it's respective "V4L2/DVB:" prefix, as the other patches
> In the series has.

Thanks, Sergio. I've already fixed it when I've applied the patch:

Subject: V4L/DVB: ir-core: Add a macro to properly create IR tables
Author:  Mauro Carvalho Chehab <mchehab@redhat.com>
Date:    Fri Mar 12 11:40:13 2010 -0300

I generally review the subjects and the comments during the patch import procedure,
fixing them when needed.

(btw, the name of the affected file were also missed on the patch I've posted).
> 
> Regards,
> Sergio
> 
>> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
>>
> 
> <snip>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 

Cheers,
Mauro

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-18 12:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-11 15:41 [PATCH 1/4] V4L/DVB: ir: use a real device instead of a virtual class Mauro Carvalho Chehab
2010-03-12 14:40 ` [PATCH 2/4] Add a macro to properly create IR tables Mauro Carvalho Chehab
2010-03-18 11:55   ` Aguirre, Sergio
2010-03-18 12:07     ` Mauro Carvalho Chehab
2010-03-12 14:50 ` [PATCH 3/4] V4L/DVB: ir-core: Export IR name via uevent Mauro Carvalho Chehab
2010-03-13  0:18 ` [PATCH 4/4] V4L/DVB: ir-core: export driver name used by IR " Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox