diff options
Diffstat (limited to 'drivers/media/rc/rc-main.c')
-rw-r--r-- | drivers/media/rc/rc-main.c | 253 |
1 files changed, 224 insertions, 29 deletions
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 02e2f38c9c85..99697aae92ff 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* rc-main.c - Remote Controller core module | 1 | /* rc-main.c - Remote Controller core module |
2 | * | 2 | * |
3 | * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | 3 | * Copyright (C) 2009-2010 by Mauro Carvalho Chehab |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | /* Bitmap to store allocated device numbers from 0 to IRRCV_NUM_DEVICES - 1 */ | 25 | /* Bitmap to store allocated device numbers from 0 to IRRCV_NUM_DEVICES - 1 */ |
26 | #define IRRCV_NUM_DEVICES 256 | 26 | #define IRRCV_NUM_DEVICES 256 |
27 | DECLARE_BITMAP(ir_core_dev_number, IRRCV_NUM_DEVICES); | 27 | static DECLARE_BITMAP(ir_core_dev_number, IRRCV_NUM_DEVICES); |
28 | 28 | ||
29 | /* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */ | 29 | /* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */ |
30 | #define IR_TAB_MIN_SIZE 256 | 30 | #define IR_TAB_MIN_SIZE 256 |
@@ -62,7 +62,7 @@ struct rc_map *rc_map_get(const char *name) | |||
62 | map = seek_rc_map(name); | 62 | map = seek_rc_map(name); |
63 | #ifdef MODULE | 63 | #ifdef MODULE |
64 | if (!map) { | 64 | if (!map) { |
65 | int rc = request_module(name); | 65 | int rc = request_module("%s", name); |
66 | if (rc < 0) { | 66 | if (rc < 0) { |
67 | printk(KERN_ERR "Couldn't load IR keymap %s\n", name); | 67 | printk(KERN_ERR "Couldn't load IR keymap %s\n", name); |
68 | return NULL; | 68 | return NULL; |
@@ -633,6 +633,7 @@ EXPORT_SYMBOL_GPL(rc_repeat); | |||
633 | static void ir_do_keydown(struct rc_dev *dev, int scancode, | 633 | static void ir_do_keydown(struct rc_dev *dev, int scancode, |
634 | u32 keycode, u8 toggle) | 634 | u32 keycode, u8 toggle) |
635 | { | 635 | { |
636 | struct rc_scancode_filter *filter; | ||
636 | bool new_event = !dev->keypressed || | 637 | bool new_event = !dev->keypressed || |
637 | dev->last_scancode != scancode || | 638 | dev->last_scancode != scancode || |
638 | dev->last_toggle != toggle; | 639 | dev->last_toggle != toggle; |
@@ -640,6 +641,11 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode, | |||
640 | if (new_event && dev->keypressed) | 641 | if (new_event && dev->keypressed) |
641 | ir_do_keyup(dev, false); | 642 | ir_do_keyup(dev, false); |
642 | 643 | ||
644 | /* Generic scancode filtering */ | ||
645 | filter = &dev->scancode_filters[RC_FILTER_NORMAL]; | ||
646 | if (filter->mask && ((scancode ^ filter->data) & filter->mask)) | ||
647 | return; | ||
648 | |||
643 | input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode); | 649 | input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode); |
644 | 650 | ||
645 | if (new_event && keycode != KEY_RESERVED) { | 651 | if (new_event && keycode != KEY_RESERVED) { |
@@ -653,9 +659,10 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode, | |||
653 | "key 0x%04x, scancode 0x%04x\n", | 659 | "key 0x%04x, scancode 0x%04x\n", |
654 | dev->input_name, keycode, scancode); | 660 | dev->input_name, keycode, scancode); |
655 | input_report_key(dev->input_dev, keycode, 1); | 661 | input_report_key(dev->input_dev, keycode, 1); |
662 | |||
663 | led_trigger_event(led_feedback, LED_FULL); | ||
656 | } | 664 | } |
657 | 665 | ||
658 | led_trigger_event(led_feedback, LED_FULL); | ||
659 | input_sync(dev->input_dev); | 666 | input_sync(dev->input_dev); |
660 | } | 667 | } |
661 | 668 | ||
@@ -790,18 +797,44 @@ static struct { | |||
790 | RC_BIT_SONY20, "sony" }, | 797 | RC_BIT_SONY20, "sony" }, |
791 | { RC_BIT_RC5_SZ, "rc-5-sz" }, | 798 | { RC_BIT_RC5_SZ, "rc-5-sz" }, |
792 | { RC_BIT_SANYO, "sanyo" }, | 799 | { RC_BIT_SANYO, "sanyo" }, |
800 | { RC_BIT_SHARP, "sharp" }, | ||
793 | { RC_BIT_MCE_KBD, "mce_kbd" }, | 801 | { RC_BIT_MCE_KBD, "mce_kbd" }, |
794 | { RC_BIT_LIRC, "lirc" }, | 802 | { RC_BIT_LIRC, "lirc" }, |
795 | }; | 803 | }; |
796 | 804 | ||
797 | /** | 805 | /** |
798 | * show_protocols() - shows the current IR protocol(s) | 806 | * struct rc_filter_attribute - Device attribute relating to a filter type. |
807 | * @attr: Device attribute. | ||
808 | * @type: Filter type. | ||
809 | * @mask: false for filter value, true for filter mask. | ||
810 | */ | ||
811 | struct rc_filter_attribute { | ||
812 | struct device_attribute attr; | ||
813 | enum rc_filter_type type; | ||
814 | bool mask; | ||
815 | }; | ||
816 | #define to_rc_filter_attr(a) container_of(a, struct rc_filter_attribute, attr) | ||
817 | |||
818 | #define RC_PROTO_ATTR(_name, _mode, _show, _store, _type) \ | ||
819 | struct rc_filter_attribute dev_attr_##_name = { \ | ||
820 | .attr = __ATTR(_name, _mode, _show, _store), \ | ||
821 | .type = (_type), \ | ||
822 | } | ||
823 | #define RC_FILTER_ATTR(_name, _mode, _show, _store, _type, _mask) \ | ||
824 | struct rc_filter_attribute dev_attr_##_name = { \ | ||
825 | .attr = __ATTR(_name, _mode, _show, _store), \ | ||
826 | .type = (_type), \ | ||
827 | .mask = (_mask), \ | ||
828 | } | ||
829 | |||
830 | /** | ||
831 | * show_protocols() - shows the current/wakeup IR protocol(s) | ||
799 | * @device: the device descriptor | 832 | * @device: the device descriptor |
800 | * @mattr: the device attribute struct (unused) | 833 | * @mattr: the device attribute struct (unused) |
801 | * @buf: a pointer to the output buffer | 834 | * @buf: a pointer to the output buffer |
802 | * | 835 | * |
803 | * This routine is a callback routine for input read the IR protocol type(s). | 836 | * This routine is a callback routine for input read the IR protocol type(s). |
804 | * it is trigged by reading /sys/class/rc/rc?/protocols. | 837 | * it is trigged by reading /sys/class/rc/rc?/[wakeup_]protocols. |
805 | * It returns the protocol names of supported protocols. | 838 | * It returns the protocol names of supported protocols. |
806 | * Enabled protocols are printed in brackets. | 839 | * Enabled protocols are printed in brackets. |
807 | * | 840 | * |
@@ -812,6 +845,7 @@ static ssize_t show_protocols(struct device *device, | |||
812 | struct device_attribute *mattr, char *buf) | 845 | struct device_attribute *mattr, char *buf) |
813 | { | 846 | { |
814 | struct rc_dev *dev = to_rc_dev(device); | 847 | struct rc_dev *dev = to_rc_dev(device); |
848 | struct rc_filter_attribute *fattr = to_rc_filter_attr(mattr); | ||
815 | u64 allowed, enabled; | 849 | u64 allowed, enabled; |
816 | char *tmp = buf; | 850 | char *tmp = buf; |
817 | int i; | 851 | int i; |
@@ -822,9 +856,10 @@ static ssize_t show_protocols(struct device *device, | |||
822 | 856 | ||
823 | mutex_lock(&dev->lock); | 857 | mutex_lock(&dev->lock); |
824 | 858 | ||
825 | enabled = dev->enabled_protocols; | 859 | enabled = dev->enabled_protocols[fattr->type]; |
826 | if (dev->driver_type == RC_DRIVER_SCANCODE) | 860 | if (dev->driver_type == RC_DRIVER_SCANCODE || |
827 | allowed = dev->allowed_protos; | 861 | fattr->type == RC_FILTER_WAKEUP) |
862 | allowed = dev->allowed_protocols[fattr->type]; | ||
828 | else if (dev->raw) | 863 | else if (dev->raw) |
829 | allowed = ir_raw_get_allowed_protocols(); | 864 | allowed = ir_raw_get_allowed_protocols(); |
830 | else { | 865 | else { |
@@ -856,14 +891,14 @@ static ssize_t show_protocols(struct device *device, | |||
856 | } | 891 | } |
857 | 892 | ||
858 | /** | 893 | /** |
859 | * store_protocols() - changes the current IR protocol(s) | 894 | * store_protocols() - changes the current/wakeup IR protocol(s) |
860 | * @device: the device descriptor | 895 | * @device: the device descriptor |
861 | * @mattr: the device attribute struct (unused) | 896 | * @mattr: the device attribute struct (unused) |
862 | * @buf: a pointer to the input buffer | 897 | * @buf: a pointer to the input buffer |
863 | * @len: length of the input buffer | 898 | * @len: length of the input buffer |
864 | * | 899 | * |
865 | * This routine is for changing the IR protocol type. | 900 | * This routine is for changing the IR protocol type. |
866 | * It is trigged by writing to /sys/class/rc/rc?/protocols. | 901 | * It is trigged by writing to /sys/class/rc/rc?/[wakeup_]protocols. |
867 | * Writing "+proto" will add a protocol to the list of enabled protocols. | 902 | * Writing "+proto" will add a protocol to the list of enabled protocols. |
868 | * Writing "-proto" will remove a protocol from the list of enabled protocols. | 903 | * Writing "-proto" will remove a protocol from the list of enabled protocols. |
869 | * Writing "proto" will enable only "proto". | 904 | * Writing "proto" will enable only "proto". |
@@ -880,12 +915,15 @@ static ssize_t store_protocols(struct device *device, | |||
880 | size_t len) | 915 | size_t len) |
881 | { | 916 | { |
882 | struct rc_dev *dev = to_rc_dev(device); | 917 | struct rc_dev *dev = to_rc_dev(device); |
918 | struct rc_filter_attribute *fattr = to_rc_filter_attr(mattr); | ||
883 | bool enable, disable; | 919 | bool enable, disable; |
884 | const char *tmp; | 920 | const char *tmp; |
885 | u64 type; | 921 | u64 old_type, type; |
886 | u64 mask; | 922 | u64 mask; |
887 | int rc, i, count = 0; | 923 | int rc, i, count = 0; |
888 | ssize_t ret; | 924 | ssize_t ret; |
925 | int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); | ||
926 | struct rc_scancode_filter local_filter, *filter; | ||
889 | 927 | ||
890 | /* Device is being removed */ | 928 | /* Device is being removed */ |
891 | if (!dev) | 929 | if (!dev) |
@@ -898,7 +936,8 @@ static ssize_t store_protocols(struct device *device, | |||
898 | ret = -EINVAL; | 936 | ret = -EINVAL; |
899 | goto out; | 937 | goto out; |
900 | } | 938 | } |
901 | type = dev->enabled_protocols; | 939 | old_type = dev->enabled_protocols[fattr->type]; |
940 | type = old_type; | ||
902 | 941 | ||
903 | while ((tmp = strsep((char **) &data, " \n")) != NULL) { | 942 | while ((tmp = strsep((char **) &data, " \n")) != NULL) { |
904 | if (!*tmp) | 943 | if (!*tmp) |
@@ -946,8 +985,10 @@ static ssize_t store_protocols(struct device *device, | |||
946 | goto out; | 985 | goto out; |
947 | } | 986 | } |
948 | 987 | ||
949 | if (dev->change_protocol) { | 988 | change_protocol = (fattr->type == RC_FILTER_NORMAL) |
950 | rc = dev->change_protocol(dev, &type); | 989 | ? dev->change_protocol : dev->change_wakeup_protocol; |
990 | if (change_protocol) { | ||
991 | rc = change_protocol(dev, &type); | ||
951 | if (rc < 0) { | 992 | if (rc < 0) { |
952 | IR_dprintk(1, "Error setting protocols to 0x%llx\n", | 993 | IR_dprintk(1, "Error setting protocols to 0x%llx\n", |
953 | (long long)type); | 994 | (long long)type); |
@@ -956,10 +997,40 @@ static ssize_t store_protocols(struct device *device, | |||
956 | } | 997 | } |
957 | } | 998 | } |
958 | 999 | ||
959 | dev->enabled_protocols = type; | 1000 | dev->enabled_protocols[fattr->type] = type; |
960 | IR_dprintk(1, "Current protocol(s): 0x%llx\n", | 1001 | IR_dprintk(1, "Current protocol(s): 0x%llx\n", |
961 | (long long)type); | 1002 | (long long)type); |
962 | 1003 | ||
1004 | /* | ||
1005 | * If the protocol is changed the filter needs updating. | ||
1006 | * Try setting the same filter with the new protocol (if any). | ||
1007 | * Fall back to clearing the filter. | ||
1008 | */ | ||
1009 | filter = &dev->scancode_filters[fattr->type]; | ||
1010 | if (old_type != type && filter->mask) { | ||
1011 | local_filter = *filter; | ||
1012 | if (!type) { | ||
1013 | /* no protocol => clear filter */ | ||
1014 | ret = -1; | ||
1015 | } else if (!dev->s_filter) { | ||
1016 | /* generic filtering => accept any filter */ | ||
1017 | ret = 0; | ||
1018 | } else { | ||
1019 | /* hardware filtering => try setting, otherwise clear */ | ||
1020 | ret = dev->s_filter(dev, fattr->type, &local_filter); | ||
1021 | } | ||
1022 | if (ret < 0) { | ||
1023 | /* clear the filter */ | ||
1024 | local_filter.data = 0; | ||
1025 | local_filter.mask = 0; | ||
1026 | if (dev->s_filter) | ||
1027 | dev->s_filter(dev, fattr->type, &local_filter); | ||
1028 | } | ||
1029 | |||
1030 | /* commit the new filter */ | ||
1031 | *filter = local_filter; | ||
1032 | } | ||
1033 | |||
963 | ret = len; | 1034 | ret = len; |
964 | 1035 | ||
965 | out: | 1036 | out: |
@@ -967,6 +1038,115 @@ out: | |||
967 | return ret; | 1038 | return ret; |
968 | } | 1039 | } |
969 | 1040 | ||
1041 | /** | ||
1042 | * show_filter() - shows the current scancode filter value or mask | ||
1043 | * @device: the device descriptor | ||
1044 | * @attr: the device attribute struct | ||
1045 | * @buf: a pointer to the output buffer | ||
1046 | * | ||
1047 | * This routine is a callback routine to read a scancode filter value or mask. | ||
1048 | * It is trigged by reading /sys/class/rc/rc?/[wakeup_]filter[_mask]. | ||
1049 | * It prints the current scancode filter value or mask of the appropriate filter | ||
1050 | * type in hexadecimal into @buf and returns the size of the buffer. | ||
1051 | * | ||
1052 | * Bits of the filter value corresponding to set bits in the filter mask are | ||
1053 | * compared against input scancodes and non-matching scancodes are discarded. | ||
1054 | * | ||
1055 | * dev->lock is taken to guard against races between device registration, | ||
1056 | * store_filter and show_filter. | ||
1057 | */ | ||
1058 | static ssize_t show_filter(struct device *device, | ||
1059 | struct device_attribute *attr, | ||
1060 | char *buf) | ||
1061 | { | ||
1062 | struct rc_dev *dev = to_rc_dev(device); | ||
1063 | struct rc_filter_attribute *fattr = to_rc_filter_attr(attr); | ||
1064 | u32 val; | ||
1065 | |||
1066 | /* Device is being removed */ | ||
1067 | if (!dev) | ||
1068 | return -EINVAL; | ||
1069 | |||
1070 | mutex_lock(&dev->lock); | ||
1071 | if (fattr->mask) | ||
1072 | val = dev->scancode_filters[fattr->type].mask; | ||
1073 | else | ||
1074 | val = dev->scancode_filters[fattr->type].data; | ||
1075 | mutex_unlock(&dev->lock); | ||
1076 | |||
1077 | return sprintf(buf, "%#x\n", val); | ||
1078 | } | ||
1079 | |||
1080 | /** | ||
1081 | * store_filter() - changes the scancode filter value | ||
1082 | * @device: the device descriptor | ||
1083 | * @attr: the device attribute struct | ||
1084 | * @buf: a pointer to the input buffer | ||
1085 | * @len: length of the input buffer | ||
1086 | * | ||
1087 | * This routine is for changing a scancode filter value or mask. | ||
1088 | * It is trigged by writing to /sys/class/rc/rc?/[wakeup_]filter[_mask]. | ||
1089 | * Returns -EINVAL if an invalid filter value for the current protocol was | ||
1090 | * specified or if scancode filtering is not supported by the driver, otherwise | ||
1091 | * returns @len. | ||
1092 | * | ||
1093 | * Bits of the filter value corresponding to set bits in the filter mask are | ||
1094 | * compared against input scancodes and non-matching scancodes are discarded. | ||
1095 | * | ||
1096 | * dev->lock is taken to guard against races between device registration, | ||
1097 | * store_filter and show_filter. | ||
1098 | */ | ||
1099 | static ssize_t store_filter(struct device *device, | ||
1100 | struct device_attribute *attr, | ||
1101 | const char *buf, | ||
1102 | size_t count) | ||
1103 | { | ||
1104 | struct rc_dev *dev = to_rc_dev(device); | ||
1105 | struct rc_filter_attribute *fattr = to_rc_filter_attr(attr); | ||
1106 | struct rc_scancode_filter local_filter, *filter; | ||
1107 | int ret; | ||
1108 | unsigned long val; | ||
1109 | |||
1110 | /* Device is being removed */ | ||
1111 | if (!dev) | ||
1112 | return -EINVAL; | ||
1113 | |||
1114 | ret = kstrtoul(buf, 0, &val); | ||
1115 | if (ret < 0) | ||
1116 | return ret; | ||
1117 | |||
1118 | /* Scancode filter not supported (but still accept 0) */ | ||
1119 | if (!dev->s_filter && fattr->type != RC_FILTER_NORMAL) | ||
1120 | return val ? -EINVAL : count; | ||
1121 | |||
1122 | mutex_lock(&dev->lock); | ||
1123 | |||
1124 | /* Tell the driver about the new filter */ | ||
1125 | filter = &dev->scancode_filters[fattr->type]; | ||
1126 | local_filter = *filter; | ||
1127 | if (fattr->mask) | ||
1128 | local_filter.mask = val; | ||
1129 | else | ||
1130 | local_filter.data = val; | ||
1131 | if (!dev->enabled_protocols[fattr->type] && local_filter.mask) { | ||
1132 | /* refuse to set a filter unless a protocol is enabled */ | ||
1133 | ret = -EINVAL; | ||
1134 | goto unlock; | ||
1135 | } | ||
1136 | if (dev->s_filter) { | ||
1137 | ret = dev->s_filter(dev, fattr->type, &local_filter); | ||
1138 | if (ret < 0) | ||
1139 | goto unlock; | ||
1140 | } | ||
1141 | |||
1142 | /* Success, commit the new filter */ | ||
1143 | *filter = local_filter; | ||
1144 | |||
1145 | unlock: | ||
1146 | mutex_unlock(&dev->lock); | ||
1147 | return (ret < 0) ? ret : count; | ||
1148 | } | ||
1149 | |||
970 | static void rc_dev_release(struct device *device) | 1150 | static void rc_dev_release(struct device *device) |
971 | { | 1151 | { |
972 | } | 1152 | } |
@@ -996,11 +1176,26 @@ static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) | |||
996 | /* | 1176 | /* |
997 | * Static device attribute struct with the sysfs attributes for IR's | 1177 | * Static device attribute struct with the sysfs attributes for IR's |
998 | */ | 1178 | */ |
999 | static DEVICE_ATTR(protocols, S_IRUGO | S_IWUSR, | 1179 | static RC_PROTO_ATTR(protocols, S_IRUGO | S_IWUSR, |
1000 | show_protocols, store_protocols); | 1180 | show_protocols, store_protocols, RC_FILTER_NORMAL); |
1181 | static RC_PROTO_ATTR(wakeup_protocols, S_IRUGO | S_IWUSR, | ||
1182 | show_protocols, store_protocols, RC_FILTER_WAKEUP); | ||
1183 | static RC_FILTER_ATTR(filter, S_IRUGO|S_IWUSR, | ||
1184 | show_filter, store_filter, RC_FILTER_NORMAL, false); | ||
1185 | static RC_FILTER_ATTR(filter_mask, S_IRUGO|S_IWUSR, | ||
1186 | show_filter, store_filter, RC_FILTER_NORMAL, true); | ||
1187 | static RC_FILTER_ATTR(wakeup_filter, S_IRUGO|S_IWUSR, | ||
1188 | show_filter, store_filter, RC_FILTER_WAKEUP, false); | ||
1189 | static RC_FILTER_ATTR(wakeup_filter_mask, S_IRUGO|S_IWUSR, | ||
1190 | show_filter, store_filter, RC_FILTER_WAKEUP, true); | ||
1001 | 1191 | ||
1002 | static struct attribute *rc_dev_attrs[] = { | 1192 | static struct attribute *rc_dev_attrs[] = { |
1003 | &dev_attr_protocols.attr, | 1193 | &dev_attr_protocols.attr.attr, |
1194 | &dev_attr_wakeup_protocols.attr.attr, | ||
1195 | &dev_attr_filter.attr.attr, | ||
1196 | &dev_attr_filter_mask.attr.attr, | ||
1197 | &dev_attr_wakeup_filter.attr.attr, | ||
1198 | &dev_attr_wakeup_filter_mask.attr.attr, | ||
1004 | NULL, | 1199 | NULL, |
1005 | }; | 1200 | }; |
1006 | 1201 | ||
@@ -1091,14 +1286,6 @@ int rc_register_device(struct rc_dev *dev) | |||
1091 | if (dev->close) | 1286 | if (dev->close) |
1092 | dev->input_dev->close = ir_close; | 1287 | dev->input_dev->close = ir_close; |
1093 | 1288 | ||
1094 | /* | ||
1095 | * Take the lock here, as the device sysfs node will appear | ||
1096 | * when device_add() is called, which may trigger an ir-keytable udev | ||
1097 | * rule, which will in turn call show_protocols and access | ||
1098 | * dev->enabled_protocols before it has been initialized. | ||
1099 | */ | ||
1100 | mutex_lock(&dev->lock); | ||
1101 | |||
1102 | do { | 1289 | do { |
1103 | devno = find_first_zero_bit(ir_core_dev_number, | 1290 | devno = find_first_zero_bit(ir_core_dev_number, |
1104 | IRRCV_NUM_DEVICES); | 1291 | IRRCV_NUM_DEVICES); |
@@ -1107,6 +1294,14 @@ int rc_register_device(struct rc_dev *dev) | |||
1107 | return -ENOMEM; | 1294 | return -ENOMEM; |
1108 | } while (test_and_set_bit(devno, ir_core_dev_number)); | 1295 | } while (test_and_set_bit(devno, ir_core_dev_number)); |
1109 | 1296 | ||
1297 | /* | ||
1298 | * Take the lock here, as the device sysfs node will appear | ||
1299 | * when device_add() is called, which may trigger an ir-keytable udev | ||
1300 | * rule, which will in turn call show_protocols and access | ||
1301 | * dev->enabled_protocols before it has been initialized. | ||
1302 | */ | ||
1303 | mutex_lock(&dev->lock); | ||
1304 | |||
1110 | dev->devno = devno; | 1305 | dev->devno = devno; |
1111 | dev_set_name(&dev->dev, "rc%ld", dev->devno); | 1306 | dev_set_name(&dev->dev, "rc%ld", dev->devno); |
1112 | dev_set_drvdata(&dev->dev, dev); | 1307 | dev_set_drvdata(&dev->dev, dev); |
@@ -1172,7 +1367,7 @@ int rc_register_device(struct rc_dev *dev) | |||
1172 | rc = dev->change_protocol(dev, &rc_type); | 1367 | rc = dev->change_protocol(dev, &rc_type); |
1173 | if (rc < 0) | 1368 | if (rc < 0) |
1174 | goto out_raw; | 1369 | goto out_raw; |
1175 | dev->enabled_protocols = rc_type; | 1370 | dev->enabled_protocols[RC_FILTER_NORMAL] = rc_type; |
1176 | } | 1371 | } |
1177 | 1372 | ||
1178 | mutex_unlock(&dev->lock); | 1373 | mutex_unlock(&dev->lock); |
@@ -1260,5 +1455,5 @@ int rc_core_debug; /* ir_debug level (0,1,2) */ | |||
1260 | EXPORT_SYMBOL_GPL(rc_core_debug); | 1455 | EXPORT_SYMBOL_GPL(rc_core_debug); |
1261 | module_param_named(debug, rc_core_debug, int, 0644); | 1456 | module_param_named(debug, rc_core_debug, int, 0644); |
1262 | 1457 | ||
1263 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | 1458 | MODULE_AUTHOR("Mauro Carvalho Chehab"); |
1264 | MODULE_LICENSE("GPL"); | 1459 | MODULE_LICENSE("GPL"); |