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

[media] rc-core: remove the LIRC "protocol"

The LIRC protocol was always a bad fit and if we're ever going to expose
protocol numbers in a user-space API, it'd be better to get rid of the
LIRC "protocol" first.

The sysfs API is kept backwards compatible by always listing the lirc
protocol as present and enabled.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

David Härdeman and committed by
Mauro Carvalho Chehab
275ddb40 fcb13097

+29 -30
+1 -4
drivers/media/rc/ir-lirc-codec.c
··· 35 35 struct lirc_codec *lirc = &dev->raw->lirc; 36 36 int sample; 37 37 38 - if (!(dev->enabled_protocols & RC_BIT_LIRC)) 39 - return 0; 40 - 41 38 if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf) 42 39 return -EINVAL; 43 40 ··· 421 424 } 422 425 423 426 static struct ir_raw_handler lirc_handler = { 424 - .protocols = RC_BIT_LIRC, 427 + .protocols = 0, 425 428 .decode = ir_lirc_decode, 426 429 .raw_register = ir_lirc_register, 427 430 .raw_unregister = ir_lirc_unregister,
+1 -1
drivers/media/rc/keymaps/rc-lirc.c
··· 20 20 .map = { 21 21 .scan = lirc, 22 22 .size = ARRAY_SIZE(lirc), 23 - .rc_type = RC_TYPE_LIRC, 23 + .rc_type = RC_TYPE_OTHER, 24 24 .name = RC_MAP_LIRC, 25 25 } 26 26 };
+9 -5
drivers/media/rc/rc-main.c
··· 800 800 { RC_BIT_SANYO, "sanyo" }, 801 801 { RC_BIT_SHARP, "sharp" }, 802 802 { RC_BIT_MCE_KBD, "mce_kbd" }, 803 - { RC_BIT_LIRC, "lirc" }, 804 803 { RC_BIT_XMP, "xmp" }, 805 804 }; 806 805 ··· 884 885 allowed &= ~proto_names[i].type; 885 886 } 886 887 888 + if (dev->driver_type == RC_DRIVER_IR_RAW) 889 + tmp += sprintf(tmp, "[lirc] "); 890 + 887 891 if (tmp != buf) 888 892 tmp--; 889 893 *tmp = '\n'; ··· 938 936 } 939 937 940 938 if (i == ARRAY_SIZE(proto_names)) { 941 - IR_dprintk(1, "Unknown protocol: '%s'\n", tmp); 942 - return -EINVAL; 939 + if (!strcasecmp(tmp, "lirc")) 940 + mask = 0; 941 + else { 942 + IR_dprintk(1, "Unknown protocol: '%s'\n", tmp); 943 + return -EINVAL; 944 + } 943 945 } 944 946 945 947 count++; ··· 1431 1425 1432 1426 if (dev->change_protocol) { 1433 1427 u64 rc_type = (1ll << rc_map->rc_type); 1434 - if (dev->driver_type == RC_DRIVER_IR_RAW) 1435 - rc_type |= RC_BIT_LIRC; 1436 1428 rc = dev->change_protocol(dev, &rc_type); 1437 1429 if (rc < 0) 1438 1430 goto out_raw;
+18 -20
include/media/rc-map.h
··· 14 14 enum rc_type { 15 15 RC_TYPE_UNKNOWN = 0, /* Protocol not known */ 16 16 RC_TYPE_OTHER = 1, /* Protocol known but proprietary */ 17 - RC_TYPE_LIRC = 2, /* Pass raw IR to lirc userspace */ 18 - RC_TYPE_RC5 = 3, /* Philips RC5 protocol */ 19 - RC_TYPE_RC5X = 4, /* Philips RC5x protocol */ 20 - RC_TYPE_RC5_SZ = 5, /* StreamZap variant of RC5 */ 21 - RC_TYPE_JVC = 6, /* JVC protocol */ 22 - RC_TYPE_SONY12 = 7, /* Sony 12 bit protocol */ 23 - RC_TYPE_SONY15 = 8, /* Sony 15 bit protocol */ 24 - RC_TYPE_SONY20 = 9, /* Sony 20 bit protocol */ 25 - RC_TYPE_NEC = 10, /* NEC protocol */ 26 - RC_TYPE_SANYO = 11, /* Sanyo protocol */ 27 - RC_TYPE_MCE_KBD = 12, /* RC6-ish MCE keyboard/mouse */ 28 - RC_TYPE_RC6_0 = 13, /* Philips RC6-0-16 protocol */ 29 - RC_TYPE_RC6_6A_20 = 14, /* Philips RC6-6A-20 protocol */ 30 - RC_TYPE_RC6_6A_24 = 15, /* Philips RC6-6A-24 protocol */ 31 - RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */ 32 - RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */ 33 - RC_TYPE_SHARP = 18, /* Sharp protocol */ 34 - RC_TYPE_XMP = 19, /* XMP protocol */ 17 + RC_TYPE_RC5 = 2, /* Philips RC5 protocol */ 18 + RC_TYPE_RC5X = 3, /* Philips RC5x protocol */ 19 + RC_TYPE_RC5_SZ = 4, /* StreamZap variant of RC5 */ 20 + RC_TYPE_JVC = 5, /* JVC protocol */ 21 + RC_TYPE_SONY12 = 6, /* Sony 12 bit protocol */ 22 + RC_TYPE_SONY15 = 7, /* Sony 15 bit protocol */ 23 + RC_TYPE_SONY20 = 8, /* Sony 20 bit protocol */ 24 + RC_TYPE_NEC = 9, /* NEC protocol */ 25 + RC_TYPE_SANYO = 10, /* Sanyo protocol */ 26 + RC_TYPE_MCE_KBD = 11, /* RC6-ish MCE keyboard/mouse */ 27 + RC_TYPE_RC6_0 = 12, /* Philips RC6-0-16 protocol */ 28 + RC_TYPE_RC6_6A_20 = 13, /* Philips RC6-6A-20 protocol */ 29 + RC_TYPE_RC6_6A_24 = 14, /* Philips RC6-6A-24 protocol */ 30 + RC_TYPE_RC6_6A_32 = 15, /* Philips RC6-6A-32 protocol */ 31 + RC_TYPE_RC6_MCE = 16, /* MCE (Philips RC6-6A-32 subtype) protocol */ 32 + RC_TYPE_SHARP = 17, /* Sharp protocol */ 33 + RC_TYPE_XMP = 18, /* XMP protocol */ 35 34 }; 36 35 37 36 #define RC_BIT_NONE 0 38 37 #define RC_BIT_UNKNOWN (1 << RC_TYPE_UNKNOWN) 39 38 #define RC_BIT_OTHER (1 << RC_TYPE_OTHER) 40 - #define RC_BIT_LIRC (1 << RC_TYPE_LIRC) 41 39 #define RC_BIT_RC5 (1 << RC_TYPE_RC5) 42 40 #define RC_BIT_RC5X (1 << RC_TYPE_RC5X) 43 41 #define RC_BIT_RC5_SZ (1 << RC_TYPE_RC5_SZ) ··· 54 56 #define RC_BIT_SHARP (1 << RC_TYPE_SHARP) 55 57 #define RC_BIT_XMP (1 << RC_TYPE_XMP) 56 58 57 - #define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \ 59 + #define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | \ 58 60 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \ 59 61 RC_BIT_JVC | \ 60 62 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \