aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2010-11-10 09:04:19 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:16:37 -0500
commit4c7b355df6e7f05304e05f6b7a286e59a5f1cc54 (patch)
treef098aab1e058de26013639a0d7924fdf30a86d7e /drivers/media
parent631493ecacd81f1af74de459c1d16f7ffa6c82c0 (diff)
[media] rc-core: Code cleanup after merging rc-sysfs and rc-map into rc-main
[mchehab@redhat.com: this patch were originally bundled with some renaming stuff and with the file merges, as seen at: https://patchwork.kernel.org/patch/291092/. Instead of using the original approach, I wrote the rename patches and the code merge as separate changes, then applied the difference on this patch. This way, it is easier to see the real changes at the code, and will be easier to merge upstream, especially if some conflict rises on the renaming patches] Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Jarod Wilson <jarod@redhat.com> Tested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/rc/rc-core-priv.h10
-rw-r--r--drivers/media/rc/rc-main.c30
2 files changed, 13 insertions, 27 deletions
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index 81c936bd793..4be075780ad 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -129,14 +129,6 @@ static inline bool is_timing_event(struct ir_raw_event ev)
129 129
130#define TO_US(duration) DIV_ROUND_CLOSEST((duration), 1000) 130#define TO_US(duration) DIV_ROUND_CLOSEST((duration), 1000)
131#define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space") 131#define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space")
132/*
133 * Routines from ir-sysfs.c - Meant to be called only internally inside
134 * ir-core
135 */
136int ir_register_input(struct input_dev *input_dev);
137
138int ir_register_class(struct input_dev *input_dev);
139void ir_unregister_class(struct input_dev *input_dev);
140 132
141/* 133/*
142 * Routines from ir-raw-event.c to be used internally and by decoders 134 * Routines from ir-raw-event.c to be used internally and by decoders
@@ -148,8 +140,6 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler);
148void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler); 140void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler);
149void ir_raw_init(void); 141void ir_raw_init(void);
150 142
151int ir_rcmap_init(void);
152void ir_rcmap_cleanup(void);
153/* 143/*
154 * Decoder initialization code 144 * Decoder initialization code
155 * 145 *
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index afcf0a88464..67a6bd5d949 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -32,10 +32,16 @@ static unsigned long ir_core_dev_number;
32/* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */ 32/* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */
33#define IR_KEYPRESS_TIMEOUT 250 33#define IR_KEYPRESS_TIMEOUT 250
34 34
35/* Used to handle IR raw handler extensions */ 35/* Used to keep track of known keymaps */
36static LIST_HEAD(rc_map_list); 36static LIST_HEAD(rc_map_list);
37static DEFINE_SPINLOCK(rc_map_lock); 37static DEFINE_SPINLOCK(rc_map_lock);
38 38
39/* Forward declarations */
40static int ir_register_class(struct input_dev *input_dev);
41static void ir_unregister_class(struct input_dev *input_dev);
42static int ir_register_input(struct input_dev *input_dev);
43
44
39static struct rc_keymap *seek_rc_map(const char *name) 45static struct rc_keymap *seek_rc_map(const char *name)
40{ 46{
41 struct rc_keymap *map = NULL; 47 struct rc_keymap *map = NULL;
@@ -112,16 +118,6 @@ static struct rc_keymap empty_map = {
112 } 118 }
113}; 119};
114 120
115int ir_rcmap_init(void)
116{
117 return ir_register_map(&empty_map);
118}
119
120void ir_rcmap_cleanup(void)
121{
122 ir_unregister_map(&empty_map);
123}
124
125/** 121/**
126 * ir_create_table() - initializes a scancode table 122 * ir_create_table() - initializes a scancode table
127 * @rc_tab: the ir_scancode_table to initialize 123 * @rc_tab: the ir_scancode_table to initialize
@@ -265,7 +261,7 @@ static unsigned int ir_update_mapping(struct input_dev *dev,
265} 261}
266 262
267/** 263/**
268 * ir_locate_scancode() - set a keycode in the scancode->keycode table 264 * ir_establish_scancode() - set a keycode in the scancode->keycode table
269 * @ir_dev: the struct ir_input_dev device descriptor 265 * @ir_dev: the struct ir_input_dev device descriptor
270 * @rc_tab: scancode table to be searched 266 * @rc_tab: scancode table to be searched
271 * @scancode: the desired scancode 267 * @scancode: the desired scancode
@@ -1097,7 +1093,7 @@ static struct device_type rc_dev_type = {
1097 * 1093 *
1098 * This routine is used to register the syfs code for IR class 1094 * This routine is used to register the syfs code for IR class
1099 */ 1095 */
1100int ir_register_class(struct input_dev *input_dev) 1096static int ir_register_class(struct input_dev *input_dev)
1101{ 1097{
1102 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); 1098 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
1103 int devno = find_first_zero_bit(&ir_core_dev_number, 1099 int devno = find_first_zero_bit(&ir_core_dev_number,
@@ -1122,7 +1118,7 @@ int ir_register_class(struct input_dev *input_dev)
1122 * @input_dev: the struct input_dev descriptor of the device 1118 * @input_dev: the struct input_dev descriptor of the device
1123 */ 1119 */
1124 1120
1125int ir_register_input(struct input_dev *input_dev) 1121static int ir_register_input(struct input_dev *input_dev)
1126{ 1122{
1127 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); 1123 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
1128 int rc; 1124 int rc;
@@ -1155,7 +1151,7 @@ int ir_register_input(struct input_dev *input_dev)
1155 * 1151 *
1156 * This routine is used to unregister the syfs code for IR class 1152 * This routine is used to unregister the syfs code for IR class
1157 */ 1153 */
1158void ir_unregister_class(struct input_dev *input_dev) 1154static void ir_unregister_class(struct input_dev *input_dev)
1159{ 1155{
1160 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); 1156 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
1161 1157
@@ -1181,7 +1177,7 @@ static int __init ir_core_init(void)
1181 1177
1182 /* Initialize/load the decoders/keymap code that will be used */ 1178 /* Initialize/load the decoders/keymap code that will be used */
1183 ir_raw_init(); 1179 ir_raw_init();
1184 ir_rcmap_init(); 1180 ir_register_map(&empty_map);
1185 1181
1186 return 0; 1182 return 0;
1187} 1183}
@@ -1189,7 +1185,7 @@ static int __init ir_core_init(void)
1189static void __exit ir_core_exit(void) 1185static void __exit ir_core_exit(void)
1190{ 1186{
1191 class_unregister(&ir_input_class); 1187 class_unregister(&ir_input_class);
1192 ir_rcmap_cleanup(); 1188 ir_unregister_map(&empty_map);
1193} 1189}
1194 1190
1195module_init(ir_core_init); 1191module_init(ir_core_init);