[media] media: rc: move check whether a protocol is enabled to the core
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 16 Nov 2015 19:52:50 +0000 (17:52 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 19 Nov 2015 13:39:17 +0000 (11:39 -0200)
Checking whether a protocol is enabled and calling the related decoder
functions should be done by the rc core, not the protocol handlers.

Properly handle lirc considering that no protocol bit is set for lirc.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/rc/ir-jvc-decoder.c
drivers/media/rc/ir-mce_kbd-decoder.c
drivers/media/rc/ir-nec-decoder.c
drivers/media/rc/ir-rc5-decoder.c
drivers/media/rc/ir-rc6-decoder.c
drivers/media/rc/ir-sanyo-decoder.c
drivers/media/rc/ir-sharp-decoder.c
drivers/media/rc/ir-sony-decoder.c
drivers/media/rc/ir-xmp-decoder.c
drivers/media/rc/rc-ir-raw.c

index 30bcf188d3773006dd0afc1d1a314f044b8e8db8..182402f7b4d152ae8befc0255b36e32183d0118b 100644 (file)
@@ -47,9 +47,6 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev)
 {
        struct jvc_dec *data = &dev->raw->jvc;
 
-       if (!(dev->enabled_protocols & RC_BIT_JVC))
-               return 0;
-
        if (!is_timing_event(ev)) {
                if (ev.reset)
                        data->state = STATE_INACTIVE;
index 9f3c9b59f30ccf27bf96b00b9d9142057f5148cf..d80986251ee025490ccd01082dfdf8767b5522c2 100644 (file)
@@ -216,9 +216,6 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        unsigned long delay;
 
-       if (!(dev->enabled_protocols & RC_BIT_MCE_KBD))
-               return 0;
-
        if (!is_timing_event(ev)) {
                if (ev.reset)
                        data->state = STATE_INACTIVE;
index 7b81fec0820fe6abb54561dfef2f973175c512c9..bea0d1eedee04346abcef4bb9a2229a5f7614e48 100644 (file)
@@ -52,9 +52,6 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u8 address, not_address, command, not_command;
        bool send_32bits = false;
 
-       if (!(dev->enabled_protocols & RC_BIT_NEC))
-               return 0;
-
        if (!is_timing_event(ev)) {
                if (ev.reset)
                        data->state = STATE_INACTIVE;
index 84fa6e9b59a1acd9360364fbd30ca0a4e00d3a56..6ffe776abf6bd5c8d1a2553532437db7156ff9d4 100644 (file)
@@ -53,9 +53,6 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        enum rc_type protocol;
 
-       if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ)))
-               return 0;
-
        if (!is_timing_event(ev)) {
                if (ev.reset)
                        data->state = STATE_INACTIVE;
index d16bc67af732251998fb280b86d887835cf39e1b..e0e2edefa6510cdf39954f57e1b276f5bbacdb12 100644 (file)
@@ -90,11 +90,6 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u8 toggle;
        enum rc_type protocol;
 
-       if (!(dev->enabled_protocols &
-             (RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 |
-              RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE)))
-               return 0;
-
        if (!is_timing_event(ev)) {
                if (ev.reset)
                        data->state = STATE_INACTIVE;
index ad1dc6ae21fc1b5c499fd5b967b2e9e30cddb918..7331e5e7c497a384f34251676d05062df1ed484b 100644 (file)
@@ -58,9 +58,6 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        u8 address, command, not_command;
 
-       if (!(dev->enabled_protocols & RC_BIT_SANYO))
-               return 0;
-
        if (!is_timing_event(ev)) {
                if (ev.reset) {
                        IR_dprintk(1, "SANYO event reset received. reset to state 0\n");
index 1f331644d07c97933fbb87be0bdbc0c19f118b6c..317677f06f2c6e147d380bd3b4705df5e99224fe 100644 (file)
@@ -48,9 +48,6 @@ static int ir_sharp_decode(struct rc_dev *dev, struct ir_raw_event ev)
        struct sharp_dec *data = &dev->raw->sharp;
        u32 msg, echo, address, command, scancode;
 
-       if (!(dev->enabled_protocols & RC_BIT_SHARP))
-               return 0;
-
        if (!is_timing_event(ev)) {
                if (ev.reset)
                        data->state = STATE_INACTIVE;
index 58ef06f35175964e5412e340f9acd3ffef638fee..baa972c76e0e19a5f0b5651310df2c93daf0e8fa 100644 (file)
@@ -46,10 +46,6 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        u8 device, subdevice, function;
 
-       if (!(dev->enabled_protocols &
-             (RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20)))
-               return 0;
-
        if (!is_timing_event(ev)) {
                if (ev.reset)
                        data->state = STATE_INACTIVE;
index 1017d4816e8d55600e835962d813812121f7767a..18596190bbb8d63deef35db20e5a5c815958a375 100644 (file)
@@ -43,9 +43,6 @@ static int ir_xmp_decode(struct rc_dev *dev, struct ir_raw_event ev)
 {
        struct xmp_dec *data = &dev->raw->xmp;
 
-       if (!(dev->enabled_protocols & RC_BIT_XMP))
-               return 0;
-
        if (!is_timing_event(ev)) {
                if (ev.reset)
                        data->state = STATE_INACTIVE;
index 763f8a87e344cdc2e4c07c54dee66b49aa6df578..c6433e8f03b851927c6c7925b00ec6feb2e54ee4 100644 (file)
@@ -59,7 +59,9 @@ static int ir_raw_event_thread(void *data)
 
                mutex_lock(&ir_raw_handler_lock);
                list_for_each_entry(handler, &ir_raw_handler_list, list)
-                       handler->decode(raw->dev, ev);
+                       if (raw->dev->enabled_protocols & handler->protocols ||
+                           !handler->protocols)
+                               handler->decode(raw->dev, ev);
                raw->prev_ev = ev;
                mutex_unlock(&ir_raw_handler_lock);
        }