Skip to contentSkip to conversation

rc-core cleanups

PATCH In review David Härdeman 4 participants 20 messages Jun 7, 2010 – Jul 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover rc-core cleanups

The following series is my current patch queue.

The first five patches remove some of the ir-functions.c legacy from hardware drivers (sadly I don't have the hardware so I can only compile test the resulting code).

The next two patches are the same sysfs centralization patches I've sent before (see discussion in that thread).

The last patch merges the two main rc-core (ir-core) headers, which helps readability for me at least...

Net result - 900 lines less code.

---

David Härdeman (8):
ir-core: convert mantis to not use ir-functions.c
ir-core: convert em28xx to not use ir-functions.c
ir-core: partially convert cx88 to not use ir-functions.c
ir-core: partially convert ir-kbd-i2c.c to not use ir-functions.c
ir-core: partially convert bt8xx to not use ir-functions.c
ir-core: centralize sysfs raw decoder enabling/disabling
ir-core: move decoding state to ir_raw_event_ctrl
ir-core: merge rc-map.h into ir-core.h

 drivers/media/IR/ir-core-priv.h                    |   40 +++
 drivers/media/IR/ir-functions.c                    |   89 -------
 drivers/media/IR/ir-jvc-decoder.c                  |  152 +-----------
 drivers/media/IR/ir-nec-decoder.c                  |  151 +-----------
 drivers/media/IR/ir-raw-event.c                    |  136 +++++------
 drivers/media/IR/ir-rc5-decoder.c                  |  165 +------------
 drivers/media/IR/ir-rc6-decoder.c                  |  154 +-----------
 drivers/media/IR/ir-sony-decoder.c                 |  155 +-----------
 drivers/media/IR/ir-sysfs.c                        |  252 ++++++++++++--------
 drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c    |    2 
 drivers/media/IR/keymaps/rc-apac-viewcomp.c        |    2 
 drivers/media/IR/keymaps/rc-asus-pc39.c            |    2 
 drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c |    2 
 drivers/media/IR/keymaps/rc-avermedia-a16d.c       |    2 
 drivers/media/IR/keymaps/rc-avermedia-cardbus.c    |    2 
 drivers/media/IR/keymaps/rc-avermedia-dvbt.c       |    2 
 .../media/IR/keymaps/rc-avermedia-m135a-rm-jx.c    |    2 
 drivers/media/IR/keymaps/rc-avermedia.c            |    2 
 drivers/media/IR/keymaps/rc-avertv-303.c           |    2 
 drivers/media/IR/keymaps/rc-behold-columbus.c      |    2 
 drivers/media/IR/keymaps/rc-behold.c               |    2 
 drivers/media/IR/keymaps/rc-budget-ci-old.c        |    2 
 drivers/media/IR/keymaps/rc-cinergy-1400.c         |    2 
 drivers/media/IR/keymaps/rc-cinergy.c              |    2 
 drivers/media/IR/keymaps/rc-dm1105-nec.c           |    2 
 drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c      |    2 
 drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c   |    2 
 drivers/media/IR/keymaps/rc-em-terratec.c          |    2 
 drivers/media/IR/keymaps/rc-empty.c                |    2 
 drivers/media/IR/keymaps/rc-encore-enltv-fm53.c    |    2 
 drivers/media/IR/keymaps/rc-encore-enltv.c         |    2 
 drivers/media/IR/keymaps/rc-encore-enltv2.c        |    2 
 drivers/media/IR/keymaps/rc-evga-indtube.c         |    2 
 drivers/media/IR/keymaps/rc-eztv.c                 |    2 
 drivers/media/IR/keymaps/rc-flydvb.c               |    2 
 drivers/media/IR/keymaps/rc-flyvideo.c             |    2 
 drivers/media/IR/keymaps/rc-fusionhdtv-mce.c       |    2 
 drivers/media/IR/keymaps/rc-gadmei-rm008z.c        |    2 
 drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c   |    2 
 drivers/media/IR/keymaps/rc-gotview7135.c          |    2 
 drivers/media/IR/keymaps/rc-hauppauge-new.c        |    2 
 drivers/media/IR/keymaps/rc-imon-mce.c             |    2 
 drivers/media/IR/keymaps/rc-imon-pad.c             |    2 
 drivers/media/IR/keymaps/rc-iodata-bctv7e.c        |    2 
 drivers/media/IR/keymaps/rc-kaiomy.c               |    2 
 drivers/media/IR/keymaps/rc-kworld-315u.c          |    2 
 .../media/IR/keymaps/rc-kworld-plus-tv-analog.c    |    2 
 drivers/media/IR/keymaps/rc-manli.c                |    2 
 drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c  |    2 
 drivers/media/IR/keymaps/rc-msi-tvanywhere.c       |    2 
 drivers/media/IR/keymaps/rc-nebula.c               |    2 
 .../media/IR/keymaps/rc-nec-terratec-cinergy-xs.c  |    2 
 drivers/media/IR/keymaps/rc-norwood.c              |    2 
 drivers/media/IR/keymaps/rc-npgtech.c              |    2 
 drivers/media/IR/keymaps/rc-pctv-sedna.c           |    2 
 drivers/media/IR/keymaps/rc-pinnacle-color.c       |    2 
 drivers/media/IR/keymaps/rc-pinnacle-grey.c        |    2 
 drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c     |    2 
 drivers/media/IR/keymaps/rc-pixelview-mk12.c       |    2 
 drivers/media/IR/keymaps/rc-pixelview-new.c        |    2 
 drivers/media/IR/keymaps/rc-pixelview.c            |    2 
 .../media/IR/keymaps/rc-powercolor-real-angel.c    |    2 
 drivers/media/IR/keymaps/rc-proteus-2309.c         |    2 
 drivers/media/IR/keymaps/rc-purpletv.c             |    2 
 drivers/media/IR/keymaps/rc-pv951.c                |    2 
 drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c    |    2 
 drivers/media/IR/keymaps/rc-rc5-tv.c               |    2 
 .../media/IR/keymaps/rc-real-audio-220-32-keys.c   |    2 
 drivers/media/IR/keymaps/rc-tbs-nec.c              |    2 
 drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c  |    2 
 drivers/media/IR/keymaps/rc-tevii-nec.c            |    2 
 drivers/media/IR/keymaps/rc-tt-1500.c              |    2 
 drivers/media/IR/keymaps/rc-videomate-s350.c       |    2 
 drivers/media/IR/keymaps/rc-videomate-tv-pvr.c     |    2 
 drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c |    2 
 drivers/media/IR/keymaps/rc-winfast.c              |    2 
 drivers/media/dvb/mantis/mantis_input.c            |    5 
 drivers/media/video/bt8xx/bttv-input.c             |   35 +--
 drivers/media/video/bt8xx/bttv.h                   |    1 
 drivers/media/video/bt8xx/bttvp.h                  |   11 -
 drivers/media/video/cx23885/cx23885-input.c        |   51 ----
 drivers/media/video/cx88/cx88-input.c              |   46 +---
 drivers/media/video/em28xx/em28xx-input.c          |   65 +----
 drivers/media/video/em28xx/em28xx.h                |    1 
 drivers/media/video/ir-kbd-i2c.c                   |   14 -
 drivers/media/video/saa7134/saa7134-input.c        |   61 +----
 include/media/ir-common.h                          |   22 --
 include/media/ir-core.h                            |  112 +++++++++
 include/media/ir-kbd-i2c.h                         |    3 
 include/media/rc-map.h                             |  121 ----------
 90 files changed, 545 insertions(+), 1431 deletions(-)
 delete mode 100644 include/media/rc-map.h
Signature · 1 line
David Härdeman
#1 lore raw

PATCH 1/8 ir-core: convert mantis to not use ir-functions.c

Convert drivers/media/dvb/mantis/mantis_input.c to not use ir-functions.c

---
 drivers/media/dvb/mantis/mantis_input.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
drivers/media/dvb/mantis/mantis_input.c +1 -4
index 3d4e466..a99489b 100644
@@ -19,7 +19,7 @@
 */
 
 #include <linux/input.h>
-#include <media/ir-common.h>
+#include <media/ir-core.h>
 #include <linux/pci.h>
 
 #include "dmxdev.h"
@@ -104,7 +104,6 @@ EXPORT_SYMBOL_GPL(ir_mantis);
 int mantis_input_init(struct mantis_pci *mantis)
 {
 	struct input_dev *rc;
-	struct ir_input_state rc_state;
 	char name[80], dev[80];
 	int err;
 
@@ -120,8 +119,6 @@ int mantis_input_init(struct mantis_pci *mantis)
 	rc->name = name;
 	rc->phys = dev;
 
-	ir_input_init(rc, &rc_state, IR_TYPE_OTHER);
-
 	rc->id.bustype	= BUS_PCI;
 	rc->id.vendor	= mantis->vendor_id;
 	rc->id.product	= mantis->device_id;
#2 lore raw

PATCH 2/8 ir-core: convert em28xx to not use ir-functions.c

In reply to David Härdeman

Convert drivers/media/video/em28xx/em28xx-input.c to not use ir-functions.c

---
 drivers/media/video/em28xx/em28xx-input.c |   65 +++++++----------------------
 drivers/media/video/em28xx/em28xx.h       |    1 
 2 files changed, 17 insertions(+), 49 deletions(-)
drivers/media/video/em28xx/em28xx-input.c +16 -49
index dffd026..c4d6027 100644
@@ -64,17 +64,14 @@ struct em28xx_ir_poll_result {
 struct em28xx_IR {
 	struct em28xx *dev;
 	struct input_dev *input;
-	struct ir_input_state ir;
 	char name[32];
 	char phys[32];
 
 	/* poll external decoder */
 	int polling;
 	struct delayed_work work;
-	unsigned int last_toggle:1;
 	unsigned int full_code:1;
 	unsigned int last_readcount;
-	unsigned int repeat_interval;
 
 	int  (*get_key)(struct em28xx_IR *, struct em28xx_ir_poll_result *);
 
@@ -290,7 +287,6 @@ static int em2874_polling_getkey(struct em28xx_IR *ir,
 static void em28xx_ir_handle_key(struct em28xx_IR *ir)
 {
 	int result;
-	int do_sendkey = 0;
 	struct em28xx_ir_poll_result poll_result;
 
 	/* read the registers containing the IR status */
@@ -305,52 +301,28 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir)
 		ir->last_readcount, poll_result.rc_address,
 		poll_result.rc_data[0]);
 
-	if (ir->dev->chip_id == CHIP_ID_EM2874) {
+	if (poll_result.read_count > 0 &&
+	    poll_result.read_count != ir->last_readcount) {
+		if (ir->full_code)
+			ir_keydown(ir->input,
+				   poll_result.rc_address << 8 |
+				   poll_result.rc_data[0],
+				   poll_result.toggle_bit);
+		else
+			ir_keydown(ir->input,
+				   poll_result.rc_data[0],
+				   poll_result.toggle_bit);
+	}
+
+	if (ir->dev->chip_id == CHIP_ID_EM2874)
 		/* The em2874 clears the readcount field every time the
 		   register is read.  The em2860/2880 datasheet says that it
 		   is supposed to clear the readcount, but it doesn't.  So with
 		   the em2874, we are looking for a non-zero read count as
 		   opposed to a readcount that is incrementing */
 		ir->last_readcount = 0;
-	}
-
-	if (poll_result.read_count == 0) {
-		/* The button has not been pressed since the last read */
-	} else if (ir->last_toggle != poll_result.toggle_bit) {
-		/* A button has been pressed */
-		dprintk("button has been pressed\n");
-		ir->last_toggle = poll_result.toggle_bit;
-		ir->repeat_interval = 0;
-		do_sendkey = 1;
-	} else if (poll_result.toggle_bit == ir->last_toggle &&
-		   poll_result.read_count > 0 &&
-		   poll_result.read_count != ir->last_readcount) {
-		/* The button is still being held down */
-		dprintk("button being held down\n");
-
-		/* Debouncer for first keypress */
-		if (ir->repeat_interval++ > 9) {
-			/* Start repeating after 1 second */
-			do_sendkey = 1;
-		}
-	}
-
-	if (do_sendkey) {
-		dprintk("sending keypress\n");
-
-		if (ir->full_code)
-			ir_input_keydown(ir->input, &ir->ir,
-					 poll_result.rc_address << 8 |
-					 poll_result.rc_data[0]);
-		else
-			ir_input_keydown(ir->input, &ir->ir,
-					 poll_result.rc_data[0]);
-
-		ir_input_nokey(ir->input, &ir->ir);
-	}
-
-	ir->last_readcount = poll_result.read_count;
-	return;
+	else
+		ir->last_readcount = poll_result.read_count;
 }
 
 static void em28xx_ir_work(struct work_struct *work)
@@ -465,11 +437,6 @@ int em28xx_ir_init(struct em28xx *dev)
 	usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
 	strlcat(ir->phys, "/input0", sizeof(ir->phys));
 
-	/* Set IR protocol */
-	err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER);
-	if (err < 0)
-		goto err_out_free;
-
 	input_dev->name = ir->name;
 	input_dev->phys = ir->phys;
 	input_dev->id.bustype = BUS_USB;
drivers/media/video/em28xx/em28xx.h +1 -0
index b252d1b..6216786 100644
@@ -32,6 +32,7 @@
 #include <linux/i2c.h>
 #include <linux/mutex.h>
 #include <media/ir-kbd-i2c.h>
+#include <media/ir-core.h>
 #if defined(CONFIG_VIDEO_EM28XX_DVB) || defined(CONFIG_VIDEO_EM28XX_DVB_MODULE)
 #include <media/videobuf-dvb.h>
 #endif
#3 lore raw

Re: [PATCH 2/8] ir-core: convert em28xx to not use ir-functions.c

Em 07-06-2010 16:32, David Härdeman escreveu:

Quoted 3 lines

Convert drivers/media/video/em28xx/em28xx-input.c to not use ir-functions.c

This patch caused a bad effect: if some key were pressed before loading the driver, it causes endless repetitions of the last keycode:

[ 2126.019882] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07
[ 2126.126629] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07
[ 2126.233253] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07
[ 2126.339875] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07
[ 2126.446625] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07

I'll try to fix it and apply a patch to solve it.

Cheers,
Mauro

#4 lore raw

Re: [PATCH 2/8] ir-core: convert em28xx to not use ir-functions.c

Em 27-06-2010 07:23, Mauro Carvalho Chehab escreveu:

Quoted 8 lines

Em 07-06-2010 16:32, David Härdeman escreveu:

Quoted 3 lines

Convert drivers/media/video/em28xx/em28xx-input.c to not use ir-functions.c

This patch caused a bad effect: if some key were pressed before loading the driver, it causes endless repetitions of the last keycode:

Quoted 7 lines
[ 2126.019882] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07
[ 2126.126629] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07
[ 2126.233253] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07
[ 2126.339875] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07
[ 2126.446625] em28xx IR (em28xx #0)/ir: ir->get_key result tb=01 rc=01 lr=01 data=1e07

I'll try to fix it and apply a patch to solve it.

Hmm.. in a matter of fact, the problem were in the printk... it were generating one line for each poll interval.

After fixing it, your patch looks ok:

[ 3072.019846] em28xx IR (em28xx #0)/ir: em28xx_ir_handle_key: toggle: 0, count: 1, key 0x1e01
[ 3072.028390] ir_g_keycode_from_table: em28xx IR (em28xx #0): scancode 0x1e01 keycode 0x02
[ 3072.036655] ir_keydown: em28xx IR (em28xx #0): key down event, key 0x0002, scancode 0x1e01
[ 3072.143218] em28xx IR (em28xx #0)/ir: em28xx_ir_handle_key: toggle: 0, count: 2, key 0x1e01
[ 3072.151773] ir_g_keycode_from_table: em28xx IR (em28xx #0): scancode 0x1e01 keycode 0x02
[ 3072.409709] ir_keyup: keyup key 0x0002

Also, the test for read_count > 0 is not needed, and, in fact, can cause loosing one key when the 6-bits wide repetition counter reaches their maximum value:

[ 3484.999804] em28xx IR (em28xx #0)/ir: em28xx_ir_handle_key: toggle: 0, count: 127, key 0x1e02
[ 3485.116431] em28xx IR (em28xx #0)/ir: em28xx_ir_handle_key: toggle: 0, count: 0, key 0x1e02

---

em28xx-input: Don't generate one debug message for every get_key read

Instead of generating one printk for every IR read, prints it only when count is different from the last count.

While here, as this code is called on every 100ms during the runtime lifetime, do some performance optimization, assuming that, under normal circumstances, it is unlikely that the driver would get a new key/key repeat on every poll.

drivers/media/video/em28xx/em28xx-input.c +15 -18
index dd6d528..6759cd5 100644
@@ -292,18 +292,15 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir)
 
 	/* read the registers containing the IR status */
 	result = ir->get_key(ir, &poll_result);
-	if (result < 0) {
+	if (unlikely(result < 0)) {
 		dprintk("ir->get_key() failed %d\n", result);
 		return;
 	}
 
-	dprintk("ir->get_key result tb=%02x rc=%02x lr=%02x data=%02x%02x\n",
-		poll_result.toggle_bit, poll_result.read_count,
-		ir->last_readcount, poll_result.rc_address,
-		poll_result.rc_data[0]);
-
-	if (poll_result.read_count > 0 &&
-	    poll_result.read_count != ir->last_readcount) {
+	if (unlikely(poll_result.read_count != ir->last_readcount)) {
+		dprintk("%s: toggle: %d, count: %d, key 0x%02x%02x\n", __func__,
+			poll_result.toggle_bit, poll_result.read_count,
+			poll_result.rc_address, poll_result.rc_data[0]);
 		if (ir->full_code)
 			ir_keydown(ir->input,
 				   poll_result.rc_address << 8 |
@@ -313,17 +310,17 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir)
 			ir_keydown(ir->input,
 				   poll_result.rc_data[0],
 				   poll_result.toggle_bit);
-	}
 
-	if (ir->dev->chip_id == CHIP_ID_EM2874)
-		/* The em2874 clears the readcount field every time the
-		   register is read.  The em2860/2880 datasheet says that it
-		   is supposed to clear the readcount, but it doesn't.  So with
-		   the em2874, we are looking for a non-zero read count as
-		   opposed to a readcount that is incrementing */
-		ir->last_readcount = 0;
-	else
-		ir->last_readcount = poll_result.read_count;
+		if (ir->dev->chip_id == CHIP_ID_EM2874)
+			/* The em2874 clears the readcount field every time the
+			   register is read.  The em2860/2880 datasheet says that it
+			   is supposed to clear the readcount, but it doesn't.  So with
+			   the em2874, we are looking for a non-zero read count as
+			   opposed to a readcount that is incrementing */
+			ir->last_readcount = 0;
+		else
+			ir->last_readcount = poll_result.read_count;
+	}
 }
 
 static void em28xx_ir_work(struct work_struct *work)
#5 lore raw

PATCH 3/8 ir-core: partially convert cx88 to not use ir-functions.c

In reply to David Härdeman

Partially convert drivers/media/video/cx88/cx88-input.c to not use ir-functions.c

---
 drivers/media/video/cx88/cx88-input.c |   46 +++++++++++----------------------
 1 files changed, 16 insertions(+), 30 deletions(-)
drivers/media/video/cx88/cx88-input.c +16 -30
index 0de9bdf..e6ecbf8 100644
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 
 #include "cx88.h"
+#include <media/ir-core.h>
 #include <media/ir-common.h>
 
 #define MODULE_NAME "cx88xx"
@@ -38,8 +39,8 @@
 struct cx88_IR {
 	struct cx88_core *core;
 	struct input_dev *input;
-	struct ir_input_state ir;
 	struct ir_dev_props props;
+	u64 ir_type;
 
 	int users;
 
@@ -50,7 +51,6 @@ struct cx88_IR {
 	u32 sampling;
 	u32 samples[16];
 	int scount;
-	unsigned long release;
 
 	/* poll external decoder */
 	int polling;
@@ -124,29 +124,21 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
 
 		data = (data << 4) | ((gpio_key & 0xf0) >> 4);
 
-		ir_input_keydown(ir->input, &ir->ir, data);
-		ir_input_nokey(ir->input, &ir->ir);
+		ir_keydown(ir->input, data, 0);
 
 	} else if (ir->mask_keydown) {
 		/* bit set on keydown */
-		if (gpio & ir->mask_keydown) {
-			ir_input_keydown(ir->input, &ir->ir, data);
-		} else {
-			ir_input_nokey(ir->input, &ir->ir);
-		}
+		if (gpio & ir->mask_keydown)
+			ir_keydown(ir->input, data, 0);
 
 	} else if (ir->mask_keyup) {
 		/* bit cleared on keydown */
-		if (0 == (gpio & ir->mask_keyup)) {
-			ir_input_keydown(ir->input, &ir->ir, data);
-		} else {
-			ir_input_nokey(ir->input, &ir->ir);
-		}
+		if (0 == (gpio & ir->mask_keyup))
+			ir_keydown(ir->input, data, 0);
 
 	} else {
 		/* can't distinguish keydown/up :-/ */
-		ir_input_keydown(ir->input, &ir->ir, data);
-		ir_input_nokey(ir->input, &ir->ir);
+		ir_keydown(ir->input, data, 0);
 	}
 }
 
@@ -438,9 +430,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
 	snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name);
 	snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
 
-	err = ir_input_init(input_dev, &ir->ir, ir_type);
-	if (err < 0)
-		goto err_out_free;
+	ir->ir_type = ir_type;
 
 	input_dev->name = ir->name;
 	input_dev->phys = ir->phys;
@@ -515,8 +505,6 @@ void cx88_ir_irq(struct cx88_core *core)
 	}
 	if (!ir->scount) {
 		/* nothing to sample */
-		if (ir->ir.keypressed && time_after(jiffies, ir->release))
-			ir_input_nokey(ir->input, &ir->ir);
 		return;
 	}
 
@@ -552,7 +540,7 @@ void cx88_ir_irq(struct cx88_core *core)
 
 		if (ircode == 0) { /* key still pressed */
 			ir_dprintk("pulse distance decoded repeat code\n");
-			ir->release = jiffies + msecs_to_jiffies(120);
+			ir_repeat(ir->input);
 			break;
 		}
 
@@ -566,10 +554,8 @@ void cx88_ir_irq(struct cx88_core *core)
 			break;
 		}
 
-		ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f);
-
-		ir_input_keydown(ir->input, &ir->ir, (ircode >> 16) & 0x7f);
-		ir->release = jiffies + msecs_to_jiffies(120);
+		ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0xff);
+		ir_keydown(ir->input, (ircode >> 16) & 0xff, 0);
 		break;
 	case CX88_BOARD_HAUPPAUGE:
 	case CX88_BOARD_HAUPPAUGE_DVB_T1:
@@ -605,16 +591,16 @@ void cx88_ir_irq(struct cx88_core *core)
 		if ( dev != 0x1e && dev != 0x1f )
 			/* not a hauppauge remote */
 			break;
-		ir_input_keydown(ir->input, &ir->ir, code);
-		ir->release = jiffies + msecs_to_jiffies(120);
+		ir_keydown(ir->input, code, toggle);
 		break;
 	case CX88_BOARD_PINNACLE_PCTV_HD_800i:
 		ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
 		ir_dprintk("biphase decoded: %x\n", ircode);
 		if ((ircode & 0xfffff000) != 0x3000)
 			break;
-		ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f);
-		ir->release = jiffies + msecs_to_jiffies(120);
+		/* Note: bit 0x800 being the toggle is assumed, not checked
+		   with real hardware  */
+		ir_keydown(ir->input, ircode & 0x3f, ircode & 0x0800 ? 1 : 0);
 		break;
 	}
 
#6 lore raw

PATCH 4/8 ir-core: partially convert ir-kbd-i2c.c to not use ir-functions.c

In reply to David Härdeman

Partially convert drivers/media/video/ir-kbd-i2c.c to not use ir-functions.c

---
 drivers/media/video/ir-kbd-i2c.c |   14 ++++----------
 include/media/ir-kbd-i2c.h       |    2 +-
 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/media/video/ir-kbd-i2c.c +4 -10
index 29d4397..27ae8bb 100644
@@ -47,7 +47,7 @@
 #include <linux/i2c-id.h>
 #include <linux/workqueue.h>
 
-#include <media/ir-common.h>
+#include <media/ir-core.h>
 #include <media/ir-kbd-i2c.h>
 
 /* ----------------------------------------------------------------------- */
@@ -272,11 +272,8 @@ static void ir_key_poll(struct IR_i2c *ir)
 		return;
 	}
 
-	if (0 == rc) {
-		ir_input_nokey(ir->input, &ir->ir);
-	} else {
-		ir_input_keydown(ir->input, &ir->ir, ir_key);
-	}
+	if (rc)
+		ir_keydown(ir->input, ir_key, 0);
 }
 
 static void ir_work(struct work_struct *work)
@@ -439,10 +436,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		 dev_name(&client->dev));
 
 	/* init + register input device */
-	err = ir_input_init(input_dev, &ir->ir, ir_type);
-	if (err < 0)
-		goto err_out_free;
-
+	ir->ir_type = ir_type;
 	input_dev->id.bustype = BUS_I2C;
 	input_dev->name       = ir->name;
 	input_dev->phys       = ir->phys;
include/media/ir-kbd-i2c.h +1 -1
index 0506e45..5e96d7a 100644
@@ -11,7 +11,7 @@ struct IR_i2c {
 	struct i2c_client      *c;
 	struct input_dev       *input;
 	struct ir_input_state  ir;
-
+	u64                    ir_type;
 	/* Used to avoid fast repeating */
 	unsigned char          old;
 
#7 lore raw

PATCH 5/8 ir-core: partially convert bt8xx to not use ir-functions.c

In reply to David Härdeman

Partially convert drivers/media/video/bt8xx/bttv-input.c to not use ir-functions.c.

Since the last user is gone with this patch, also remove a bunch of code from ir-functions.c.

---
 drivers/media/IR/ir-functions.c             |   89 +--------------------------
 drivers/media/video/bt8xx/bttv-input.c      |   35 ++---------
 drivers/media/video/bt8xx/bttv.h            |    1 
 drivers/media/video/bt8xx/bttvp.h           |   11 ---
 drivers/media/video/cx23885/cx23885-input.c |   51 +--------------
 drivers/media/video/saa7134/saa7134-input.c |   61 +++----------------
 include/media/ir-common.h                   |   22 -------
 include/media/ir-kbd-i2c.h                  |    1 
 8 files changed, 27 insertions(+), 244 deletions(-)
drivers/media/IR/ir-functions.c +2 -87
index db591e4..d7f47b2 100644
@@ -31,67 +31,6 @@
 MODULE_AUTHOR("Gerd Knorr <[email protected]> [SuSE Labs]");
 MODULE_LICENSE("GPL");
 
-static int repeat = 1;
-module_param(repeat, int, 0444);
-MODULE_PARM_DESC(repeat,"auto-repeat for IR keys (default: on)");
-
-/* -------------------------------------------------------------------------- */
-
-static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir)
-{
-	if (KEY_RESERVED == ir->keycode) {
-		printk(KERN_INFO "%s: unknown key: key=0x%02x down=%d\n",
-		       dev->name, ir->ir_key, ir->keypressed);
-		return;
-	}
-	IR_dprintk(1,"%s: key event code=%d down=%d\n",
-		dev->name,ir->keycode,ir->keypressed);
-	input_report_key(dev,ir->keycode,ir->keypressed);
-	input_sync(dev);
-}
-
-/* -------------------------------------------------------------------------- */
-
-int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
-		  const u64 ir_type)
-{
-	ir->ir_type = ir_type;
-
-	if (repeat)
-		set_bit(EV_REP, dev->evbit);
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(ir_input_init);
-
-
-void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir)
-{
-	if (ir->keypressed) {
-		ir->keypressed = 0;
-		ir_input_key_event(dev,ir);
-	}
-}
-EXPORT_SYMBOL_GPL(ir_input_nokey);
-
-void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
-		      u32 ir_key)
-{
-	u32 keycode = ir_g_keycode_from_table(dev, ir_key);
-
-	if (ir->keypressed && ir->keycode != keycode) {
-		ir->keypressed = 0;
-		ir_input_key_event(dev,ir);
-	}
-	if (!ir->keypressed) {
-		ir->ir_key  = ir_key;
-		ir->keycode = keycode;
-		ir->keypressed = 1;
-		ir_input_key_event(dev,ir);
-	}
-}
-EXPORT_SYMBOL_GPL(ir_input_keydown);
-
 /* -------------------------------------------------------------------------- */
 /* extract mask bits out of data and pack them into the result */
 u32 ir_extract_bits(u32 data, u32 mask)
@@ -284,12 +223,10 @@ void ir_rc5_timer_end(unsigned long data)
 {
 	struct card_ir *ir = (struct card_ir *)data;
 	struct timeval tv;
-	unsigned long current_jiffies, timeout;
 	u32 gap;
 	u32 rc5 = 0;
 
 	/* get time */
-	current_jiffies = jiffies;
 	do_gettimeofday(&tv);
 
 	/* avoid overflow with gap >1s */
@@ -325,32 +262,10 @@ void ir_rc5_timer_end(unsigned long data)
 			u32 toggle = RC5_TOGGLE(rc5);
 			u32 instr = RC5_INSTR(rc5);
 
-			/* Good code, decide if repeat/repress */
-			if (toggle != RC5_TOGGLE(ir->last_rc5) ||
-			    instr != RC5_INSTR(ir->last_rc5)) {
-				IR_dprintk(1, "ir-common: instruction %x, toggle %x\n", instr,
-					toggle);
-				ir_input_nokey(ir->dev, &ir->ir);
-				ir_input_keydown(ir->dev, &ir->ir, instr);
-			}
-
-			/* Set/reset key-up timer */
-			timeout = current_jiffies +
-				  msecs_to_jiffies(ir->rc5_key_timeout);
-			mod_timer(&ir->timer_keyup, timeout);
-
-			/* Save code for repeat test */
-			ir->last_rc5 = rc5;
+			/* Good code */
+			ir_keydown(ir->dev, instr, toggle);
 		}
 	}
 }
 EXPORT_SYMBOL_GPL(ir_rc5_timer_end);
 
-void ir_rc5_timer_keyup(unsigned long data)
-{
-	struct card_ir *ir = (struct card_ir *)data;
-
-	IR_dprintk(1, "ir-common: key released\n");
-	ir_input_nokey(ir->dev, &ir->ir);
-}
-EXPORT_SYMBOL_GPL(ir_rc5_timer_keyup);
drivers/media/video/bt8xx/bttv-input.c +7 -28
index 814fd34..66cdc0d 100644
@@ -30,10 +30,6 @@
 
 static int ir_debug;
 module_param(ir_debug, int, 0644);
-static int repeat_delay = 500;
-module_param(repeat_delay, int, 0644);
-static int repeat_period = 33;
-module_param(repeat_period, int, 0644);
 
 static int ir_rc5_remote_gap = 885;
 module_param(ir_rc5_remote_gap, int, 0644);
@@ -75,14 +71,11 @@ static void ir_handle_key(struct bttv *btv)
 
 	if ((ir->mask_keydown  &&  (0 != (gpio & ir->mask_keydown))) ||
 	    (ir->mask_keyup    &&  (0 == (gpio & ir->mask_keyup)))) {
-		ir_input_keydown(ir->dev, &ir->ir, data);
-	} else {
+		ir_keydown(ir->dev, data, 0);
+	} else if (btv->c.type == BTTV_BOARD_WINFAST2000) {
 		/* HACK: Probably, ir->mask_keydown is missing
 		   for this board */
-		if (btv->c.type == BTTV_BOARD_WINFAST2000)
-			ir_input_keydown(ir->dev, &ir->ir, data);
-
-		ir_input_nokey(ir->dev,&ir->ir);
+		ir_keydown(ir->dev, data, 0);
 	}
 
 }
@@ -106,9 +99,7 @@ static void ir_enltv_handle_key(struct bttv *btv)
 			gpio, data,
 			(gpio & ir->mask_keyup) ? " up" : "up/down");
 
-		ir_input_keydown(ir->dev, &ir->ir, data);
-		if (keyup)
-			ir_input_nokey(ir->dev, &ir->ir);
+		ir_keydown(ir->dev, data, 0);
 	} else {
 		if ((ir->last_gpio & 1 << 31) == keyup)
 			return;
@@ -117,10 +108,8 @@ static void ir_enltv_handle_key(struct bttv *btv)
 			gpio, data,
 			(gpio & ir->mask_keyup) ? " up" : "down");
 
-		if (keyup)
-			ir_input_nokey(ir->dev, &ir->ir);
-		else
-			ir_input_keydown(ir->dev, &ir->ir, data);
+		if (!keyup)
+			ir_keydown(ir->dev, data, 0);
 	}
 
 	ir->last_gpio = data | keyup;
@@ -215,9 +204,6 @@ static void bttv_ir_start(struct bttv *btv, struct card_ir *ir)
 		ir->timer_end.function = ir_rc5_timer_end;
 		ir->timer_end.data = (unsigned long)ir;
 
-		init_timer(&ir->timer_keyup);
-		ir->timer_keyup.function = ir_rc5_timer_keyup;
-		ir->timer_keyup.data = (unsigned long)ir;
 		ir->shift_by = 1;
 		ir->start = 3;
 		ir->addr = 0x0;
@@ -370,10 +356,7 @@ int bttv_input_init(struct bttv *btv)
 	snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
 		 pci_name(btv->c.pci));
 
-	err = ir_input_init(input_dev, &ir->ir, ir_type);
-	if (err < 0)
-		goto err_out_free;
-
+	ir->ir_type = ir_type;
 	input_dev->name = ir->name;
 	input_dev->phys = ir->phys;
 	input_dev->id.bustype = BUS_PCI;
@@ -395,10 +378,6 @@ int bttv_input_init(struct bttv *btv)
 	if (err)
 		goto err_out_stop;
 
-	/* the remote isn't as bouncy as a keyboard */
-	ir->dev->rep[REP_DELAY] = repeat_delay;
-	ir->dev->rep[REP_PERIOD] = repeat_period;
-
 	return 0;
 
  err_out_stop:
drivers/media/video/bt8xx/bttv.h +1 -0
index 3ec2402..33882c8 100644
@@ -17,6 +17,7 @@
 #include <linux/videodev2.h>
 #include <linux/i2c.h>
 #include <media/v4l2-device.h>
+#include <media/ir-core.h>
 #include <media/ir-common.h>
 #include <media/ir-kbd-i2c.h>
 #include <media/i2c-addr.h>
drivers/media/video/bt8xx/bttvp.h +1 -10
index 6cccc2a..4b29863 100644
@@ -41,6 +41,7 @@
 #include <linux/device.h>
 #include <media/videobuf-dma-sg.h>
 #include <media/tveeprom.h>
+#include <media/ir-core.h>
 #include <media/ir-common.h>
 
 
@@ -298,16 +299,6 @@ struct bttv_pll_info {
 	unsigned int pll_current;  /* Currently programmed ofreq */
 };
 
-/* for gpio-connected remote control */
-struct bttv_input {
-	struct input_dev      *dev;
-	struct ir_input_state ir;
-	char                  name[32];
-	char                  phys[32];
-	u32                   mask_keycode;
-	u32                   mask_keydown;
-};
-
 struct bttv_suspend_state {
 	u32  gpio_enable;
 	u32  gpio_data;
drivers/media/video/cx23885/cx23885-input.c +4 -47

106 lines not on this page · raw message

drivers/media/video/saa7134/saa7134-input.c +11 -50

124 lines not on this page · raw message

include/media/ir-common.h +1 -21
index 528050e..8043a53 100644
@@ -33,21 +33,11 @@
 #define RC5_ADDR(x)	(((x)>>6)&31)
 #define RC5_INSTR(x)	((x)&63)
 
-struct ir_input_state {
-	/* configuration */
-	u64      ir_type;
-
-	/* key info */
-	u32                ir_key;      /* ir scancode */
-	u32                keycode;     /* linux key code */
-	int                keypressed;  /* current state */
-};
-
 /* this was saa7134_ir and bttv_ir, moved here for
  * rc5 decoding. */
 struct card_ir {
 	struct input_dev        *dev;
-	struct ir_input_state   ir;
+	u64			ir_type;
 	char                    name[32];
 	char                    phys[32];
 	int			users;
@@ -73,8 +63,6 @@ struct card_ir {
 	/* RC5 gpio */
 	u32 rc5_gpio;
 	struct timer_list timer_end;	/* timer_end for code completion */
-	struct timer_list timer_keyup;	/* timer_end for key release */
-	u32 last_rc5;			/* last good rc5 code */
 	u32 last_bit;			/* last raw bit seen */
 	u32 code;			/* raw code under construction */
 	struct timeval base_time;	/* time of last seen code */
@@ -89,19 +77,11 @@ struct card_ir {
 };
 
 /* Routines from ir-functions.c */
-
-int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
-		   const u64 ir_type);
-void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
-void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
-		      u32 ir_key);
 u32  ir_extract_bits(u32 data, u32 mask);
 int  ir_dump_samples(u32 *samples, int count);
 int  ir_decode_biphase(u32 *samples, int count, int low, int high);
 int  ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
 u32  ir_rc5_decode(unsigned int code);
-
 void ir_rc5_timer_end(unsigned long data);
-void ir_rc5_timer_keyup(unsigned long data);
 
 #endif
include/media/ir-kbd-i2c.h +0 -1
index 5e96d7a..13ea2aa 100644
@@ -10,7 +10,6 @@ struct IR_i2c {
 
 	struct i2c_client      *c;
 	struct input_dev       *input;
-	struct ir_input_state  ir;
 	u64                    ir_type;
 	/* Used to avoid fast repeating */
 	unsigned char          old;
#8 lore raw

Re: [PATCH 5/8] ir-core: partially convert bt8xx to not use ir-functions.c

Em 07-06-2010 16:32, David Härdeman escreveu:

Quoted 5 lines

Partially convert drivers/media/video/bt8xx/bttv-input.c to not use ir-functions.c.

Since the last user is gone with this patch, also remove a bunch of code from ir-functions.c.

This patch breakd mceusb driver:

drivers/media/IR/mceusb.c: In function ‘mceusb_init_input_dev’:
drivers/media/IR/mceusb.c:774: error: invalid application of ‘sizeof’ to incomplete type ‘struct ir_input_state’ drivers/media/IR/mceusb.c:785: error: implicit declaration of function ‘ir_input_init’ make[1]: ** [drivers/media/IR/mceusb.o] Erro 1
make[1]: ** Esperando que outros processos terminem.
make: ** [drivers/media/IR/] Erro 2

Also, the description is wrong, since it changes not only bttv, but also cx23885 and saa7134.

Cheers,
Mauro

#9 lore raw

Re: [PATCH 5/8] ir-core: partially convert bt8xx to not use ir-functions.c

Quoted 9 lines · Mauro Carvalho Chehab

Em 07-06-2010 16:32, David Härdeman escreveu:

Quoted 5 lines

Partially convert drivers/media/video/bt8xx/bttv-input.c to not use ir-functions.c.

Since the last user is gone with this patch, also remove a bunch of code from ir-functions.c.

This patch breakd mceusb driver:

Quoted 8 lines

drivers/media/IR/mceusb.c: In function ‘mceusb_init_input_dev’:
drivers/media/IR/mceusb.c:774: error: invalid application of ‘sizeof’ to incomplete type ‘struct ir_input_state’ drivers/media/IR/mceusb.c:785: error: implicit declaration of function ‘ir_input_init’ make[1]: ** [drivers/media/IR/mceusb.o] Erro 1
make[1]: ** Esperando que outros processos terminem.
make: ** [drivers/media/IR/] Erro 2

Also, the description is wrong, since it changes not only bttv, but also cx23885 and saa7134.

Mauro,

I'll be removing the RC5 and NEC decoding from the cx23885 driver hopefully by the end of the day. That will make parts of David's patch obsolete.

I'll be developing off of the v4l-dvb.git staging/rc branch. Is that the right branch to use?

Also the IR registration Ooops is not patched in staging/rc, so the cx23885 driver Oops-es on load. Is it OK if I pull in (fetch & merge) the patch from some other branch, or would it be easier for you if I just use an uncommitted patch in my working tree?

Regards,
Andy

Mauro

Quoted 6 lines

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [PATCH 5/8] ir-core: partially convert bt8xx to not use ir-functions.c

Em 27-06-2010 12:14, Andy Walls escreveu:

Quoted 17 lines · Mauro Carvalho Chehab
Quoted 16 lines

Em 07-06-2010 16:32, David Härdeman escreveu:

Quoted 5 lines

Partially convert drivers/media/video/bt8xx/bttv-input.c to not use ir-functions.c.

Since the last user is gone with this patch, also remove a bunch of code from ir-functions.c.

This patch breakd mceusb driver:

drivers/media/IR/mceusb.c: In function ‘mceusb_init_input_dev’:
drivers/media/IR/mceusb.c:774: error: invalid application of ‘sizeof’ to incomplete type ‘struct ir_input_state’ drivers/media/IR/mceusb.c:785: error: implicit declaration of function ‘ir_input_init’ make[1]: ** [drivers/media/IR/mceusb.o] Erro 1
make[1]: ** Esperando que outros processos terminem.
make: ** [drivers/media/IR/] Erro 2

Quoted 7 lines
Quoted 1 line

Also, the description is wrong, since it changes not only bttv, but also cx23885 and saa7134.

Mauro,

I'll be removing the RC5 and NEC decoding from the cx23885 driver hopefully by the end of the day. That will make parts of David's patch obsolete.

Ok. David, it is generally a good idea to break those patches into smaller ones, since, when conflicts like this happens, we can just discard a patch at the series, or move it to happen after another patch.

Quoted 2 lines

I'll be developing off of the v4l-dvb.git staging/rc branch. Is that the right branch to use?

Yes. I'll likely apply a few more patches there.

Quoted 4 lines

Also the IR registration Ooops is not patched in staging/rc, so the cx23885 driver Oops-es on load. Is it OK if I pull in (fetch & merge) the patch from some other branch, or would it be easier for you if I just use an uncommitted patch in my working tree?

Probably, it is ok if you send it with the fix pulled in.

I'll handle the conflicts when sending upstream.

Cheers,
Mauro

#11 lore raw

Re: [PATCH 5/8] ir-core: partially convert bt8xx to not use ir-functions.c

In reply to Mauro Carvalho Chehab
Quoted 7 lines · Mauro Carvalho Chehab

Em 07-06-2010 16:32, David Härdeman escreveu:

Quoted 5 lines

Partially convert drivers/media/video/bt8xx/bttv-input.c to not use ir-functions.c.

Since the last user is gone with this patch, also remove a bunch of code from ir-functions.c.

Quoted 8 lines

This patch breakd mceusb driver:

drivers/media/IR/mceusb.c: In function ‘mceusb_init_input_dev’:
drivers/media/IR/mceusb.c:774: error: invalid application of ‘sizeof’ to incomplete type ‘struct ir_input_state’ drivers/media/IR/mceusb.c:785: error: implicit declaration of function ‘ir_input_init’ make[1]: ** [drivers/media/IR/mceusb.o] Erro 1
make[1]: ** Esperando que outros processos terminem.
make: ** [drivers/media/IR/] Erro 2

The mceusb driver doesn't actually need ir_input_state at all, and one of my pending patches removes it.

https://patchwork.kernel.org/patch/106549/

Signature · 2 lines
Jarod Wilson
[email protected]
#12 lore raw

Re: [PATCH 5/8] ir-core: partially convert bt8xx to not use ir-functions.c

Quoted 11 lines · Jarod Wilson
Quoted 9 lines · Mauro Carvalho Chehab

Em 07-06-2010 16:32, David Härdeman escreveu:

Quoted 5 lines

Partially convert drivers/media/video/bt8xx/bttv-input.c to not use ir-functions.c.

Since the last user is gone with this patch, also remove a bunch of code from ir-functions.c.

This patch breakd mceusb driver:

Quoted 8 lines
Quoted 6 lines

drivers/media/IR/mceusb.c: In function ‘mceusb_init_input_dev’:
drivers/media/IR/mceusb.c:774: error: invalid application of ‘sizeof’ to incomplete type ‘struct ir_input_state’ drivers/media/IR/mceusb.c:785: error: implicit declaration of function ‘ir_input_init’ make[1]: ** [drivers/media/IR/mceusb.o] Erro 1
make[1]: ** Esperando que outros processos terminem.
make: ** [drivers/media/IR/] Erro 2

The mceusb driver doesn't actually need ir_input_state at all,

I just came to that conclusion 5 minutes ago for the cx23885 driver as well. Right now it does use it, but once I get this conversion complete, it won't need it either AFAICT.

I guess Mauro's build never got to the cx23885 driver.

Regards,
Andy

#13 lore raw

MCEUSB memory leak and how to tell if ir_register_input() failure registered input_dev?

In reply to Jarod Wilson

Jarrod,

Looking at the patches branch from your WIP git tree:

Is mceusb_init_input_dev() supposed to allocate a struct ir_input_dev? It looks like ir_register_input() handles that, and it is trashing your pointer (memory leak).

Mauro and Jarrod,

When ir_register_input() fails, it doesn't indicate whether or not it was able to register the input_dev or not. To me it looks like it can return with failure with the input_dev either way depending on the case. This makes proper cleanup of the input_dev in my cx23885_input_init() function difficult in the failure case, since the input subsystem has two different deallocators depending on if the device had been registered or not.

Regards,
Andy

#14 lore raw

Re: MCEUSB memory leak and how to tell if ir_register_input() failure registered input_dev?

Quoted 8 lines · Andy Walls

Jarrod,

Looking at the patches branch from your WIP git tree:

Is mceusb_init_input_dev() supposed to allocate a struct ir_input_dev? It looks like ir_register_input() handles that, and it is trashing your pointer (memory leak).

Eep, crap, you're right. Fixed locally (I think), will test it out and ship off the patch probably tomorrow (exhausting weekend of watching futbol and some heavy-duty bbq'ing, need to turn in early... ;).

Just double-checked, I actually cribbed that incorrectness from imon.c, so I'll need to fix it there too. D'oh.

Quoted 9 lines

Mauro and Jarrod,

When ir_register_input() fails, it doesn't indicate whether or not it was able to register the input_dev or not.  To me it looks like it can return with failure with the input_dev either way depending on the case. This makes proper cleanup of the input_dev in my cx23885_input_init() function difficult in the failure case, since the input subsystem has two different deallocators depending on if the device had been registered or not.

Hm. I've done a double-take a few times now, but if input_register_device is successful, and something later in __ir_input_register fails, input_unregister_device *does* get called within __ir_input_register, so all you should have to do is call input_free_device in your init function's error path, no?

Signature · 2 lines
Jarod Wilson
[email protected]
#15 lore raw

Re: MCEUSB memory leak and how to tell if ir_register_input() failure registered input_dev?

Quoted 12 lines · Jarod Wilson
Quoted 9 lines · Andy Walls

Mauro and Jarrod,

When ir_register_input() fails, it doesn't indicate whether or not it was able to register the input_dev or not. To me it looks like it can return with failure with the input_dev either way depending on the case. This makes proper cleanup of the input_dev in my cx23885_input_init() function difficult in the failure case, since the input subsystem has two different deallocators depending on if the device had been registered or not.

Quoted 5 lines

Hm. I've done a double-take a few times now, but if input_register_device is successful, and something later in __ir_input_register fails, input_unregister_device *does* get called within __ir_input_register, so all you should have to do is call input_free_device in your init function's error path, no?

I couldn't quite tell (with the constant stream of intteruptions I get at times). That's why I asked. :)

I'll double check today once I'm done with getting the CX23888 IR Tx working.

Regards,
Andy

#16 lore raw

PATCH 6/8 ir-core: centralize sysfs raw decoder enabling/disabling

In reply to David Härdeman

With the current logic, each raw decoder needs to add a copy of the exact same sysfs code. This is both unnecessary and also means that (re)loading an IR driver after raw decoder modules have been loaded won't work as expected.

This patch moves that logic into ir-raw-event and adds a single sysfs file per device.

Reading that file returns something like:

	"rc5 [rc6] nec jvc [sony]"

(with enabled protocols in [] brackets)

Writing either "+protocol" or "-protocol" to that file will enable or disable the according protocol decoder.

An additional benefit is that the disabling of a decoder will be remembered across module removal/insertion so a previously disabled decoder won't suddenly be activated again. The default setting is to enable all decoders.

This is also necessary for the next patch which moves even more decoder state into the central raw decoding structs.

---
 drivers/media/IR/ir-core-priv.h    |    3 
 drivers/media/IR/ir-jvc-decoder.c  |   64 ---------
 drivers/media/IR/ir-nec-decoder.c  |   64 ---------
 drivers/media/IR/ir-raw-event.c    |  112 +++++++++-------
 drivers/media/IR/ir-rc5-decoder.c  |   64 ---------
 drivers/media/IR/ir-rc6-decoder.c  |   64 ---------
 drivers/media/IR/ir-sony-decoder.c |   64 ---------
 drivers/media/IR/ir-sysfs.c        |  252 +++++++++++++++++++++---------------
 8 files changed, 231 insertions(+), 456 deletions(-)
drivers/media/IR/ir-core-priv.h +3 -0
index b79446f..3072e55 100644
@@ -21,6 +21,7 @@
 struct ir_raw_handler {
 	struct list_head list;
 
+	u64 protocols; /* which are handled by this handler */
 	int (*decode)(struct input_dev *input_dev, struct ir_raw_event event);
 	int (*raw_register)(struct input_dev *input_dev);
 	int (*raw_unregister)(struct input_dev *input_dev);
@@ -32,6 +33,7 @@ struct ir_raw_event_ctrl {
 	ktime_t				last_event;	/* when last event occurred */
 	enum raw_event_type		last_type;	/* last event type */
 	struct input_dev		*input_dev;	/* pointer to the parent input_dev */
+	u64				enabled_protocols; /* enabled raw protocol decoders */
 };
 
 /* macros for IR decoders */
@@ -73,6 +75,7 @@ void ir_unregister_class(struct input_dev *input_dev);
 /*
  * Routines from ir-raw-event.c to be used internally and by decoders
  */
+u64 ir_raw_get_allowed_protocols(void);
 int ir_raw_event_register(struct input_dev *input_dev);
 void ir_raw_event_unregister(struct input_dev *input_dev);
 int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler);
drivers/media/IR/ir-jvc-decoder.c +3 -61

105 lines not on this page · raw message

drivers/media/IR/ir-nec-decoder.c +3 -61

105 lines not on this page · raw message

drivers/media/IR/ir-raw-event.c +65 -47

144 lines not on this page · raw message

drivers/media/IR/ir-rc5-decoder.c +3 -61

105 lines not on this page · raw message

drivers/media/IR/ir-rc6-decoder.c +3 -61

105 lines not on this page · raw message

drivers/media/IR/ir-sony-decoder.c +3 -61

105 lines not on this page · raw message

drivers/media/IR/ir-sysfs.c +148 -104

322 lines not on this page · raw message

#17 lore raw

PATCH 7/8 ir-core: move decoding state to ir_raw_event_ctrl

In reply to David Härdeman

This patch moves the state from each raw decoder into the ir_raw_event_ctrl struct.

This allows the removal of code like this:

        spin_lock(&decoder_lock);
        list_for_each_entry(data, &decoder_list, list) {
                if (data->ir_dev == ir_dev)
                        break;
        }
        spin_unlock(&decoder_lock);
        return data;

which is currently run for each decoder on each event in order to get the client-specific decoding state data.

In addition, ir decoding modules and ir driver module load order is now independent. Centralizing the data also allows for a nice code reduction of about 30% per raw decoder as client lists and client registration callbacks are no longer necessary.

Out-of-tree modules can still use a similar trick to what the raw decoders did before this patch until they are merged.

---
 drivers/media/IR/ir-core-priv.h    |   37 ++++++++++++-
 drivers/media/IR/ir-jvc-decoder.c  |   90 ++-----------------------------
 drivers/media/IR/ir-nec-decoder.c  |   89 +++----------------------------
 drivers/media/IR/ir-raw-event.c    |   48 +++--------------
 drivers/media/IR/ir-rc5-decoder.c  |  103 +++++-------------------------------
 drivers/media/IR/ir-rc6-decoder.c  |   92 ++------------------------------
 drivers/media/IR/ir-sony-decoder.c |   93 +++------------------------------
 7 files changed, 87 insertions(+), 465 deletions(-)
drivers/media/IR/ir-core-priv.h +35 -2
index 3072e55..d19d819 100644
@@ -23,8 +23,6 @@ struct ir_raw_handler {
 
 	u64 protocols; /* which are handled by this handler */
 	int (*decode)(struct input_dev *input_dev, struct ir_raw_event event);
-	int (*raw_register)(struct input_dev *input_dev);
-	int (*raw_unregister)(struct input_dev *input_dev);
 };
 
 struct ir_raw_event_ctrl {
@@ -34,6 +32,41 @@ struct ir_raw_event_ctrl {
 	enum raw_event_type		last_type;	/* last event type */
 	struct input_dev		*input_dev;	/* pointer to the parent input_dev */
 	u64				enabled_protocols; /* enabled raw protocol decoders */
+
+	/* raw decoder state follows */
+	struct ir_raw_event prev_ev;
+	struct nec_dec {
+		int state;
+		unsigned count;
+		u32 bits;
+	} nec;
+	struct rc5_dec {
+		int state;
+		u32 bits;
+		unsigned count;
+		unsigned wanted_bits;
+	} rc5;
+	struct rc6_dec {
+		int state;
+		u8 header;
+		u32 body;
+		bool toggle;
+		unsigned count;
+		unsigned wanted_bits;
+	} rc6;
+	struct sony_dec {
+		int state;
+		u32 bits;
+		unsigned count;
+	} sony;
+	struct jvc_dec {
+		int state;
+		u16 bits;
+		u16 old_bits;
+		unsigned count;
+		bool first;
+		bool toggle;
+	} jvc;
 };
 
 /* macros for IR decoders */
drivers/media/IR/ir-jvc-decoder.c +7 -83

134 lines not on this page · raw message

drivers/media/IR/ir-nec-decoder.c +8 -81

136 lines not on this page · raw message

drivers/media/IR/ir-raw-event.c +9 -39

75 lines not on this page · raw message

drivers/media/IR/ir-rc5-decoder.c +13 -90

158 lines not on this page · raw message

drivers/media/IR/ir-rc6-decoder.c +5 -87

159 lines not on this page · raw message

drivers/media/IR/ir-sony-decoder.c +10 -83

143 lines not on this page · raw message

#18 lore raw

PATCH 8/8 ir-core: merge rc-map.h into ir-core.h

In reply to David Härdeman

Haven't discussed this patch on the linux-media list yet, but merging rc-map.h into ir-core.h at least makes it much easier for me to get a good overview of the entire rc-core subsystem (and to make sweeping changes). Not sure if everyone agrees?

---
 drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c    |    2 
 drivers/media/IR/keymaps/rc-apac-viewcomp.c        |    2 
 drivers/media/IR/keymaps/rc-asus-pc39.c            |    2 
 drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c |    2 
 drivers/media/IR/keymaps/rc-avermedia-a16d.c       |    2 
 drivers/media/IR/keymaps/rc-avermedia-cardbus.c    |    2 
 drivers/media/IR/keymaps/rc-avermedia-dvbt.c       |    2 
 .../media/IR/keymaps/rc-avermedia-m135a-rm-jx.c    |    2 
 drivers/media/IR/keymaps/rc-avermedia.c            |    2 
 drivers/media/IR/keymaps/rc-avertv-303.c           |    2 
 drivers/media/IR/keymaps/rc-behold-columbus.c      |    2 
 drivers/media/IR/keymaps/rc-behold.c               |    2 
 drivers/media/IR/keymaps/rc-budget-ci-old.c        |    2 
 drivers/media/IR/keymaps/rc-cinergy-1400.c         |    2 
 drivers/media/IR/keymaps/rc-cinergy.c              |    2 
 drivers/media/IR/keymaps/rc-dm1105-nec.c           |    2 
 drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c      |    2 
 drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c   |    2 
 drivers/media/IR/keymaps/rc-em-terratec.c          |    2 
 drivers/media/IR/keymaps/rc-empty.c                |    2 
 drivers/media/IR/keymaps/rc-encore-enltv-fm53.c    |    2 
 drivers/media/IR/keymaps/rc-encore-enltv.c         |    2 
 drivers/media/IR/keymaps/rc-encore-enltv2.c        |    2 
 drivers/media/IR/keymaps/rc-evga-indtube.c         |    2 
 drivers/media/IR/keymaps/rc-eztv.c                 |    2 
 drivers/media/IR/keymaps/rc-flydvb.c               |    2 
 drivers/media/IR/keymaps/rc-flyvideo.c             |    2 
 drivers/media/IR/keymaps/rc-fusionhdtv-mce.c       |    2 
 drivers/media/IR/keymaps/rc-gadmei-rm008z.c        |    2 
 drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c   |    2 
 drivers/media/IR/keymaps/rc-gotview7135.c          |    2 
 drivers/media/IR/keymaps/rc-hauppauge-new.c        |    2 
 drivers/media/IR/keymaps/rc-imon-mce.c             |    2 
 drivers/media/IR/keymaps/rc-imon-pad.c             |    2 
 drivers/media/IR/keymaps/rc-iodata-bctv7e.c        |    2 
 drivers/media/IR/keymaps/rc-kaiomy.c               |    2 
 drivers/media/IR/keymaps/rc-kworld-315u.c          |    2 
 .../media/IR/keymaps/rc-kworld-plus-tv-analog.c    |    2 
 drivers/media/IR/keymaps/rc-manli.c                |    2 
 drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c  |    2 
 drivers/media/IR/keymaps/rc-msi-tvanywhere.c       |    2 
 drivers/media/IR/keymaps/rc-nebula.c               |    2 
 .../media/IR/keymaps/rc-nec-terratec-cinergy-xs.c  |    2 
 drivers/media/IR/keymaps/rc-norwood.c              |    2 
 drivers/media/IR/keymaps/rc-npgtech.c              |    2 
 drivers/media/IR/keymaps/rc-pctv-sedna.c           |    2 
 drivers/media/IR/keymaps/rc-pinnacle-color.c       |    2 
 drivers/media/IR/keymaps/rc-pinnacle-grey.c        |    2 
 drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c     |    2 
 drivers/media/IR/keymaps/rc-pixelview-mk12.c       |    2 
 drivers/media/IR/keymaps/rc-pixelview-new.c        |    2 
 drivers/media/IR/keymaps/rc-pixelview.c            |    2 
 .../media/IR/keymaps/rc-powercolor-real-angel.c    |    2 
 drivers/media/IR/keymaps/rc-proteus-2309.c         |    2 
 drivers/media/IR/keymaps/rc-purpletv.c             |    2 
 drivers/media/IR/keymaps/rc-pv951.c                |    2 
 drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c    |    2 
 drivers/media/IR/keymaps/rc-rc5-tv.c               |    2 
 .../media/IR/keymaps/rc-real-audio-220-32-keys.c   |    2 
 drivers/media/IR/keymaps/rc-tbs-nec.c              |    2 
 drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c  |    2 
 drivers/media/IR/keymaps/rc-tevii-nec.c            |    2 
 drivers/media/IR/keymaps/rc-tt-1500.c              |    2 
 drivers/media/IR/keymaps/rc-videomate-s350.c       |    2 
 drivers/media/IR/keymaps/rc-videomate-tv-pvr.c     |    2 
 drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c |    2 
 drivers/media/IR/keymaps/rc-winfast.c              |    2 
 include/media/ir-core.h                            |  112 ++++++++++++++++++-
 include/media/rc-map.h                             |  121 --------------------
 69 files changed, 178 insertions(+), 189 deletions(-)
 delete mode 100644 include/media/rc-map.h
drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c +1 -1
index b172831..8d5655a 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* ADS Tech Instant TV DVB-T PCI Remote */
 
drivers/media/IR/keymaps/rc-apac-viewcomp.c +1 -1
index 0ef2b56..fa9c9a7 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Attila Kondoros <[email protected]> */
 
drivers/media/IR/keymaps/rc-asus-pc39.c +1 -1
index 2aa068c..d6bd983 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
  * Marc Fargas <[email protected]>
drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c +1 -1
index 8edfd29..cb4ddc8 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* ATI TV Wonder HD 600 USB
    Devin Heitmueller <[email protected]>
drivers/media/IR/keymaps/rc-avermedia-a16d.c +1 -1
index 12f0435..332de38 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode avermedia_a16d[] = {
 	{ 0x20, KEY_LIST},
drivers/media/IR/keymaps/rc-avermedia-cardbus.c +1 -1
index 2a945b0..c7bf603 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Oldrich Jedlicka <[email protected]> */
 
drivers/media/IR/keymaps/rc-avermedia-dvbt.c +1 -1
index 39dde62..32339c8 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Matt Jesson <[email protected] */
 
drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c +1 -1
index 101e7ea..fe7a76f 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
  * Avermedia M135A with IR model RM-JX
drivers/media/IR/keymaps/rc-avermedia.c +1 -1
index 21effd5..ebb6ff4 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Alex Hermann <[email protected]> */
 
drivers/media/IR/keymaps/rc-avertv-303.c +1 -1
index 971c59d..a2d7372 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* AVERTV STUDIO 303 Remote */
 
drivers/media/IR/keymaps/rc-behold-columbus.c +1 -1
index 9f56c98..1702137 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Beholder Intl. Ltd. 2008
  * Dmitry Belimov [email protected]
drivers/media/IR/keymaps/rc-behold.c +1 -1
index abc140b..5f30f5d 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
  * Igor Kuznetsov <[email protected]>
drivers/media/IR/keymaps/rc-budget-ci-old.c +1 -1
index 64c2ac9..fdc9f1a 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* From reading the following remotes:
  * Zenith Universal 7 / TV Mode 807 / VCR Mode 837
drivers/media/IR/keymaps/rc-cinergy-1400.c +1 -1
index 074f2c2..f45761a 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Cinergy 1400 DVB-T */
 
drivers/media/IR/keymaps/rc-cinergy.c +1 -1
index cf84c3d..656cada 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode cinergy[] = {
 	{ 0x00, KEY_0 },
drivers/media/IR/keymaps/rc-dm1105-nec.c +1 -1
index 90684d0..8ffedf0 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* DVBWorld remotes
    Igor M. Liplianin <[email protected]>
drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c +1 -1
index 8a4027a..7bf9674 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* DigitalNow DNTV Live DVB-T Remote */
 
drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c +1 -1
index 6f4d607..8815a60 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* DigitalNow DNTV Live! DVB-T Pro Remote */
 
drivers/media/IR/keymaps/rc-em-terratec.c +1 -1
index 3130c9c..6c16941 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode em_terratec[] = {
 	{ 0x01, KEY_CHANNEL },
drivers/media/IR/keymaps/rc-empty.c +1 -1
index 3b338d8..6091b96 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* empty keytable, can be used as placeholder for not-yet created keytables */
 
drivers/media/IR/keymaps/rc-encore-enltv-fm53.c +1 -1
index 4b81696..c55dd20 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Encore ENLTV-FM v5.3
    Mauro Carvalho Chehab <[email protected]>
drivers/media/IR/keymaps/rc-encore-enltv.c +1 -1
index 9fabffd..06049c3 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Encore ENLTV-FM  - black plastic, white front cover with white glowing buttons
     Juan Pablo Sormani <[email protected]> */
drivers/media/IR/keymaps/rc-encore-enltv2.c +1 -1
index efefd51..3795eb8 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Encore ENLTV2-FM  - silver plastic - "Wand Media" written at the botton
     Mauro Carvalho Chehab <[email protected]> */
drivers/media/IR/keymaps/rc-evga-indtube.c +1 -1
index 3f3fb13..adf78e1 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* EVGA inDtube
    Devin Heitmueller <[email protected]>
drivers/media/IR/keymaps/rc-eztv.c +1 -1
index 660907a..c00078c 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Alfons Geser <[email protected]>
  * updates from Job D. R. Borges <[email protected]> */
drivers/media/IR/keymaps/rc-flydvb.c +1 -1
index a173c81..c694b54 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode flydvb[] = {
 	{ 0x01, KEY_ZOOM },		/* Full Screen */
drivers/media/IR/keymaps/rc-flyvideo.c +1 -1
index 9c73043..c59fbe4 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode flyvideo[] = {
 	{ 0x0f, KEY_0 },
drivers/media/IR/keymaps/rc-fusionhdtv-mce.c +1 -1
index cdb1038..e2e09a1 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* DViCO FUSION HDTV MCE remote */
 
drivers/media/IR/keymaps/rc-gadmei-rm008z.c +1 -1
index c16c0d1..f77ab33 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* GADMEI UTV330+ RM008Z remote
    Shine Liu <[email protected]>
drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c +1 -1
index 89f8e38..b36ede9 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
  * Remote control for the Genius TVGO A11MCE
drivers/media/IR/keymaps/rc-gotview7135.c +1 -1
index 52f025b..3b6048b 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Mike Baikov <[email protected]> */
 
drivers/media/IR/keymaps/rc-hauppauge-new.c +1 -1
index c6f8cd7..7d6c146 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Hauppauge: the newer, gray remotes (seems there are multiple
  * slightly different versions), shipped with cx88+ivtv cards.
drivers/media/IR/keymaps/rc-imon-mce.c +1 -1
index e49f350..4e014f3 100644
@@ -9,7 +9,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* mce-mode imon mce remote key table */
 static struct ir_scancode imon_mce[] = {
drivers/media/IR/keymaps/rc-imon-pad.c +1 -1
index bc4db72..68194ff 100644
@@ -9,7 +9,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
  * standard imon remote key table, which isn't really entirely
drivers/media/IR/keymaps/rc-iodata-bctv7e.c +1 -1
index ef66002..76ff936 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* IO-DATA BCTV7E Remote */
 
drivers/media/IR/keymaps/rc-kaiomy.c +1 -1
index 4c7883b..20bf013 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Kaiomy TVnPC U2
    Mauro Carvalho Chehab <[email protected]>
drivers/media/IR/keymaps/rc-kworld-315u.c +1 -1
index 618c817..e140ea0 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Kworld 315U
  */
drivers/media/IR/keymaps/rc-kworld-plus-tv-analog.c +1 -1
index 366732f..21ebbfd 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Kworld Plus TV Analog Lite PCI IR
    Mauro Carvalho Chehab <[email protected]>
drivers/media/IR/keymaps/rc-manli.c +1 -1
index 1e9fbfa..d062775 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Michael Tokarev <[email protected]>
    http://www.corpit.ru/mjt/beholdTV/remote_control.jpg
drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c +1 -1
index eb8e42c..7173c5d 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
   Keycodes for remote on the MSI TV@nywhere Plus. The controller IC on the card
drivers/media/IR/keymaps/rc-msi-tvanywhere.c +1 -1
index ef41185..6897c07 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* MSI TV@nywhere MASTER remote */
 
drivers/media/IR/keymaps/rc-nebula.c +1 -1
index ccc50eb..ec98473 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode nebula[] = {
 	{ 0x00, KEY_0 },
drivers/media/IR/keymaps/rc-nec-terratec-cinergy-xs.c +1 -1
index e1b54d2..2ebd496 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Terratec Cinergy Hybrid T USB XS FM
    Mauro Carvalho Chehab <[email protected]>
drivers/media/IR/keymaps/rc-norwood.c +1 -1
index e5849a6..f3d379a 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Norwood Micro (non-Pro) TV Tuner
    By Peter Naulls <[email protected]>
drivers/media/IR/keymaps/rc-npgtech.c +1 -1
index b9ece1e..ecf616c 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode npgtech[] = {
 	{ 0x1d, KEY_SWITCHVIDEOMODE },	/* switch inputs */
drivers/media/IR/keymaps/rc-pctv-sedna.c +1 -1
index 4129bb4..13b7f9d 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Mapping for the 28 key remote control as seen at
    http://www.sednacomputer.com/photo/cardbus-tv.jpg
drivers/media/IR/keymaps/rc-pinnacle-color.c +1 -1
index 326e023..1f06180 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode pinnacle_color[] = {
 	{ 0x59, KEY_MUTE },
drivers/media/IR/keymaps/rc-pinnacle-grey.c +1 -1
index 14cb772..d0f6d6c 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode pinnacle_grey[] = {
 	{ 0x3a, KEY_0 },
drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c +1 -1
index 835bf4e..55b1ca1 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Pinnacle PCTV HD 800i mini remote */
 
drivers/media/IR/keymaps/rc-pixelview-mk12.c +1 -1
index 5a735d5..1417384 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
  * Keytable for MK-F12 IR remote provided together with Pixelview
drivers/media/IR/keymaps/rc-pixelview-new.c +1 -1
index 7bbbbf5..10b9ef7 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
    Mauro Carvalho Chehab <[email protected]>
drivers/media/IR/keymaps/rc-pixelview.c +1 -1
index 82ff12e..7d50692 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode pixelview[] = {
 
drivers/media/IR/keymaps/rc-powercolor-real-angel.c +1 -1
index 7cef819..e2379db 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
  * Remote control for Powercolor Real Angel 330
drivers/media/IR/keymaps/rc-proteus-2309.c +1 -1
index 22e92d3..ef941e4 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Michal Majchrowicz <[email protected]> */
 
drivers/media/IR/keymaps/rc-purpletv.c +1 -1
index 4e20fc2..fdae1cb 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode purpletv[] = {
 	{ 0x03, KEY_POWER },
drivers/media/IR/keymaps/rc-pv951.c +1 -1
index 36679e7..45842c5 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Mark Phalan <[email protected]> */
 
drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c +1 -1
index cc6b8f5..2055e2e 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /*
  * Hauppauge:the newer, gray remotes (seems there are multiple
drivers/media/IR/keymaps/rc-rc5-tv.c +1 -1
index 73cce2f..7ffbd25 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* generic RC5 keytable                                          */
 /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */
drivers/media/IR/keymaps/rc-real-audio-220-32-keys.c +1 -1
index ab1a6d2..51508c3 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Zogis Real Audio 220 - 32 keys IR */
 
drivers/media/IR/keymaps/rc-tbs-nec.c +1 -1
index 3309631..1c01270 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode tbs_nec[] = {
 	{ 0x04, KEY_POWER2},	/*power*/
drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c +1 -1
index 5326a0b..1699c3f 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Terratec Cinergy Hybrid T USB XS
    Devin Heitmueller <[email protected]>
drivers/media/IR/keymaps/rc-tevii-nec.c +1 -1
index e30d411..6edc662 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode tevii_nec[] = {
 	{ 0x0a, KEY_POWER2},
drivers/media/IR/keymaps/rc-tt-1500.c +1 -1
index bc88de0..79b5d19 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* for the Technotrend 1500 bundled remotes (grey and black): */
 
drivers/media/IR/keymaps/rc-videomate-s350.c +1 -1
index 4df7fcd..9fe9f4e 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode videomate_s350[] = {
 	{ 0x00, KEY_TV},
drivers/media/IR/keymaps/rc-videomate-tv-pvr.c +1 -1
index 776b0a6..e80ef1c 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 static struct ir_scancode videomate_tv_pvr[] = {
 	{ 0x14, KEY_MUTE },
drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c +1 -1
index 9d2d550..9bcb541 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Leadtek Winfast TV USB II Deluxe remote
    Magnus Alm <[email protected]>
drivers/media/IR/keymaps/rc-winfast.c +1 -1
index 0e90a3b..7a4a30b 100644
@@ -10,7 +10,7 @@
  * (at your option) any later version.
  */
 
-#include <media/rc-map.h>
+#include <media/ir-core.h>
 
 /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */
 
include/media/ir-core.h +111 -1

140 lines not on this page · raw message

include/media/rc-map.h deleted +0 -121

121 lines not on this page · raw message

#19 lore raw

Re: [PATCH 8/8] ir-core: merge rc-map.h into ir-core.h

Em 07-06-2010 16:32, David Härdeman escreveu:

Quoted 4 lines

Haven't discussed this patch on the linux-media list yet, but merging rc-map.h into ir-core.h at least makes it much easier for me to get a good overview of the entire rc-core subsystem (and to make sweeping changes). Not sure if everyone agrees?

I don't like the idea of merging those headers. It will just slow down the build time when a change at the core is applied, as all rc tables would need to be rebuilt for no good reason.

Cheers,
Mauro