aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/IR')
-rw-r--r--drivers/media/IR/ir-keytable.c17
-rw-r--r--drivers/media/IR/ir-raw-event.c2
-rw-r--r--drivers/media/IR/ir-sysfs.c25
3 files changed, 30 insertions, 14 deletions
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index af7400bc906f..1fdb528737fe 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -488,11 +488,19 @@ int __ir_input_register(struct input_dev *input_dev,
488 if (rc < 0) 488 if (rc < 0)
489 goto out_table; 489 goto out_table;
490 490
491 if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) {
492 rc = ir_raw_event_register(input_dev);
493 if (rc < 0)
494 goto out_event;
495 }
496
491 IR_dprintk(1, "Registered input device on %s for %s remote.\n", 497 IR_dprintk(1, "Registered input device on %s for %s remote.\n",
492 driver_name, rc_tab->name); 498 driver_name, rc_tab->name);
493 499
494 return 0; 500 return 0;
495 501
502out_event:
503 ir_unregister_class(input_dev);
496out_table: 504out_table:
497 kfree(ir_dev->rc_tab.scan); 505 kfree(ir_dev->rc_tab.scan);
498out_name: 506out_name:
@@ -509,22 +517,25 @@ EXPORT_SYMBOL_GPL(__ir_input_register);
509 517
510 * This routine is used to free memory and de-register interfaces. 518 * This routine is used to free memory and de-register interfaces.
511 */ 519 */
512void ir_input_unregister(struct input_dev *dev) 520void ir_input_unregister(struct input_dev *input_dev)
513{ 521{
514 struct ir_input_dev *ir_dev = input_get_drvdata(dev); 522 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
515 struct ir_scancode_table *rc_tab; 523 struct ir_scancode_table *rc_tab;
516 524
517 if (!ir_dev) 525 if (!ir_dev)
518 return; 526 return;
519 527
520 IR_dprintk(1, "Freed keycode table\n"); 528 IR_dprintk(1, "Freed keycode table\n");
529
521 del_timer_sync(&ir_dev->timer_keyup); 530 del_timer_sync(&ir_dev->timer_keyup);
531 if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW)
532 ir_raw_event_unregister(input_dev);
522 rc_tab = &ir_dev->rc_tab; 533 rc_tab = &ir_dev->rc_tab;
523 rc_tab->size = 0; 534 rc_tab->size = 0;
524 kfree(rc_tab->scan); 535 kfree(rc_tab->scan);
525 rc_tab->scan = NULL; 536 rc_tab->scan = NULL;
526 537
527 ir_unregister_class(dev); 538 ir_unregister_class(input_dev);
528 539
529 kfree(ir_dev->driver_name); 540 kfree(ir_dev->driver_name);
530 kfree(ir_dev); 541 kfree(ir_dev);
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
index ddb3365adc82..bc4ca08adf4a 100644
--- a/drivers/media/IR/ir-raw-event.c
+++ b/drivers/media/IR/ir-raw-event.c
@@ -82,7 +82,6 @@ int ir_raw_event_register(struct input_dev *input_dev)
82 82
83 return rc; 83 return rc;
84} 84}
85EXPORT_SYMBOL_GPL(ir_raw_event_register);
86 85
87void ir_raw_event_unregister(struct input_dev *input_dev) 86void ir_raw_event_unregister(struct input_dev *input_dev)
88{ 87{
@@ -97,7 +96,6 @@ void ir_raw_event_unregister(struct input_dev *input_dev)
97 kfree(ir->raw); 96 kfree(ir->raw);
98 ir->raw = NULL; 97 ir->raw = NULL;
99} 98}
100EXPORT_SYMBOL_GPL(ir_raw_event_unregister);
101 99
102int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type) 100int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type)
103{ 101{
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index c33333f1f60e..81eebd8eae5a 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -152,22 +152,26 @@ static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env)
152static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR, 152static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR,
153 show_protocol, store_protocol); 153 show_protocol, store_protocol);
154 154
155static struct attribute *ir_dev_attrs[] = { 155static struct attribute *ir_hw_dev_attrs[] = {
156 &dev_attr_current_protocol.attr, 156 &dev_attr_current_protocol.attr,
157 NULL, 157 NULL,
158}; 158};
159 159
160static struct attribute_group ir_dev_attr_grp = { 160static struct attribute_group ir_hw_dev_attr_grp = {
161 .attrs = ir_dev_attrs, 161 .attrs = ir_hw_dev_attrs,
162}; 162};
163 163
164static const struct attribute_group *ir_dev_attr_groups[] = { 164static const struct attribute_group *ir_hw_dev_attr_groups[] = {
165 &ir_dev_attr_grp, 165 &ir_hw_dev_attr_grp,
166 NULL 166 NULL
167}; 167};
168 168
169static struct device_type ir_dev_type = { 169static struct device_type rc_dev_type = {
170 .groups = ir_dev_attr_groups, 170 .groups = ir_hw_dev_attr_groups,
171 .uevent = ir_dev_uevent,
172};
173
174static struct device_type ir_raw_dev_type = {
171 .uevent = ir_dev_uevent, 175 .uevent = ir_dev_uevent,
172}; 176};
173 177
@@ -181,7 +185,6 @@ int ir_register_class(struct input_dev *input_dev)
181{ 185{
182 int rc; 186 int rc;
183 const char *path; 187 const char *path;
184
185 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); 188 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
186 int devno = find_first_zero_bit(&ir_core_dev_number, 189 int devno = find_first_zero_bit(&ir_core_dev_number,
187 IRRCV_NUM_DEVICES); 190 IRRCV_NUM_DEVICES);
@@ -189,7 +192,11 @@ int ir_register_class(struct input_dev *input_dev)
189 if (unlikely(devno < 0)) 192 if (unlikely(devno < 0))
190 return devno; 193 return devno;
191 194
192 ir_dev->dev.type = &ir_dev_type; 195 if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE)
196 ir_dev->dev.type = &rc_dev_type;
197 else
198 ir_dev->dev.type = &ir_raw_dev_type;
199
193 ir_dev->dev.class = &ir_input_class; 200 ir_dev->dev.class = &ir_input_class;
194 ir_dev->dev.parent = input_dev->dev.parent; 201 ir_dev->dev.parent = input_dev->dev.parent;
195 dev_set_name(&ir_dev->dev, "rc%d", devno); 202 dev_set_name(&ir_dev->dev, "rc%d", devno);