Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] media: rc: move check whether a protocol is enabled to the core

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>

authored by

Heiner Kallweit and committed by
Mauro Carvalho Chehab
d80ca8bd acc1c3c6

+3 -31
-3
drivers/media/rc/ir-jvc-decoder.c
··· 47 47 { 48 48 struct jvc_dec *data = &dev->raw->jvc; 49 49 50 - if (!(dev->enabled_protocols & RC_BIT_JVC)) 51 - return 0; 52 - 53 50 if (!is_timing_event(ev)) { 54 51 if (ev.reset) 55 52 data->state = STATE_INACTIVE;
-3
drivers/media/rc/ir-mce_kbd-decoder.c
··· 216 216 u32 scancode; 217 217 unsigned long delay; 218 218 219 - if (!(dev->enabled_protocols & RC_BIT_MCE_KBD)) 220 - return 0; 221 - 222 219 if (!is_timing_event(ev)) { 223 220 if (ev.reset) 224 221 data->state = STATE_INACTIVE;
-3
drivers/media/rc/ir-nec-decoder.c
··· 52 52 u8 address, not_address, command, not_command; 53 53 bool send_32bits = false; 54 54 55 - if (!(dev->enabled_protocols & RC_BIT_NEC)) 56 - return 0; 57 - 58 55 if (!is_timing_event(ev)) { 59 56 if (ev.reset) 60 57 data->state = STATE_INACTIVE;
-3
drivers/media/rc/ir-rc5-decoder.c
··· 53 53 u32 scancode; 54 54 enum rc_type protocol; 55 55 56 - if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ))) 57 - return 0; 58 - 59 56 if (!is_timing_event(ev)) { 60 57 if (ev.reset) 61 58 data->state = STATE_INACTIVE;
-5
drivers/media/rc/ir-rc6-decoder.c
··· 90 90 u8 toggle; 91 91 enum rc_type protocol; 92 92 93 - if (!(dev->enabled_protocols & 94 - (RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | 95 - RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE))) 96 - return 0; 97 - 98 93 if (!is_timing_event(ev)) { 99 94 if (ev.reset) 100 95 data->state = STATE_INACTIVE;
-3
drivers/media/rc/ir-sanyo-decoder.c
··· 58 58 u32 scancode; 59 59 u8 address, command, not_command; 60 60 61 - if (!(dev->enabled_protocols & RC_BIT_SANYO)) 62 - return 0; 63 - 64 61 if (!is_timing_event(ev)) { 65 62 if (ev.reset) { 66 63 IR_dprintk(1, "SANYO event reset received. reset to state 0\n");
-3
drivers/media/rc/ir-sharp-decoder.c
··· 48 48 struct sharp_dec *data = &dev->raw->sharp; 49 49 u32 msg, echo, address, command, scancode; 50 50 51 - if (!(dev->enabled_protocols & RC_BIT_SHARP)) 52 - return 0; 53 - 54 51 if (!is_timing_event(ev)) { 55 52 if (ev.reset) 56 53 data->state = STATE_INACTIVE;
-4
drivers/media/rc/ir-sony-decoder.c
··· 46 46 u32 scancode; 47 47 u8 device, subdevice, function; 48 48 49 - if (!(dev->enabled_protocols & 50 - (RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20))) 51 - return 0; 52 - 53 49 if (!is_timing_event(ev)) { 54 50 if (ev.reset) 55 51 data->state = STATE_INACTIVE;
-3
drivers/media/rc/ir-xmp-decoder.c
··· 43 43 { 44 44 struct xmp_dec *data = &dev->raw->xmp; 45 45 46 - if (!(dev->enabled_protocols & RC_BIT_XMP)) 47 - return 0; 48 - 49 46 if (!is_timing_event(ev)) { 50 47 if (ev.reset) 51 48 data->state = STATE_INACTIVE;
+3 -1
drivers/media/rc/rc-ir-raw.c
··· 59 59 60 60 mutex_lock(&ir_raw_handler_lock); 61 61 list_for_each_entry(handler, &ir_raw_handler_list, list) 62 - handler->decode(raw->dev, ev); 62 + if (raw->dev->enabled_protocols & handler->protocols || 63 + !handler->protocols) 64 + handler->decode(raw->dev, ev); 63 65 raw->prev_ev = ev; 64 66 mutex_unlock(&ir_raw_handler_lock); 65 67 }