diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-11 09:20:59 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-15 21:18:45 -0500 |
commit | 579e7d60ba0035228aadad69eb2ffeb138c51311 (patch) | |
tree | 0872698fe02dba92cead8e9d9a7ca7e7f38e1291 /drivers | |
parent | 38ef6aa884e3fd389f7d444b8dd36c16832e36b4 (diff) |
V4L/DVB (13617): ir: move input_register_device() to happen inside ir_input_register()
We'll need to register a sysfs class for the IR devices. As such, the better
is to have the input_register_device()/input_unregister_device() inside
the ir register/unregister functions.
Also, solves a naming problem with V4L ir_input_init() function, that were,
in fact, registering a device.
While here, do a few cleanups at budget-ci IR logic.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/IR/ir-functions.c | 4 | ||||
-rw-r--r-- | drivers/media/IR/ir-keytable.c | 20 | ||||
-rw-r--r-- | drivers/media/dvb/dm1105/dm1105.c | 12 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 50 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv-input.c | 7 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-input.c | 8 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-input.c | 7 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-input.c | 7 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-input.c | 8 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 7 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 7 |
11 files changed, 47 insertions, 90 deletions
diff --git a/drivers/media/IR/ir-functions.c b/drivers/media/IR/ir-functions.c index 7401a7989719..776a136616d6 100644 --- a/drivers/media/IR/ir-functions.c +++ b/drivers/media/IR/ir-functions.c | |||
@@ -52,15 +52,13 @@ static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) | |||
52 | /* -------------------------------------------------------------------------- */ | 52 | /* -------------------------------------------------------------------------- */ |
53 | 53 | ||
54 | int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | 54 | int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, |
55 | int ir_type, struct ir_scancode_table *ir_codes) | 55 | int ir_type) |
56 | { | 56 | { |
57 | ir->ir_type = ir_type; | 57 | ir->ir_type = ir_type; |
58 | 58 | ||
59 | if (repeat) | 59 | if (repeat) |
60 | set_bit(EV_REP, dev->evbit); | 60 | set_bit(EV_REP, dev->evbit); |
61 | 61 | ||
62 | ir_input_register(dev, ir_codes); | ||
63 | |||
64 | return 0; | 62 | return 0; |
65 | } | 63 | } |
66 | EXPORT_SYMBOL_GPL(ir_input_init); | 64 | EXPORT_SYMBOL_GPL(ir_input_init); |
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index e9c9bd34af65..bff7a5356037 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c | |||
@@ -12,8 +12,8 @@ | |||
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/usb/input.h> | ||
16 | 15 | ||
16 | #include <linux/usb/input.h> | ||
17 | #include <media/ir-common.h> | 17 | #include <media/ir-common.h> |
18 | 18 | ||
19 | #define IR_TAB_MIN_SIZE 32 | 19 | #define IR_TAB_MIN_SIZE 32 |
@@ -408,7 +408,7 @@ int ir_input_register(struct input_dev *input_dev, | |||
408 | { | 408 | { |
409 | struct ir_input_dev *ir_dev; | 409 | struct ir_input_dev *ir_dev; |
410 | struct ir_scancode *keymap = rc_tab->scan; | 410 | struct ir_scancode *keymap = rc_tab->scan; |
411 | int i; | 411 | int i, rc; |
412 | 412 | ||
413 | if (rc_tab->scan == NULL || !rc_tab->size) | 413 | if (rc_tab->scan == NULL || !rc_tab->size) |
414 | return -EINVAL; | 414 | return -EINVAL; |
@@ -446,26 +446,34 @@ int ir_input_register(struct input_dev *input_dev, | |||
446 | input_dev->setkeycode = ir_setkeycode; | 446 | input_dev->setkeycode = ir_setkeycode; |
447 | input_set_drvdata(input_dev, ir_dev); | 447 | input_set_drvdata(input_dev, ir_dev); |
448 | 448 | ||
449 | return 0; | 449 | rc = input_register_device(input_dev); |
450 | if (rc < 0) { | ||
451 | kfree(rc_tab->scan); | ||
452 | kfree(ir_dev); | ||
453 | input_set_drvdata(input_dev, NULL); | ||
454 | } | ||
455 | |||
456 | return rc; | ||
450 | } | 457 | } |
451 | EXPORT_SYMBOL_GPL(ir_input_register); | 458 | EXPORT_SYMBOL_GPL(ir_input_register); |
452 | 459 | ||
453 | void ir_input_unregister(struct input_dev *dev) | 460 | void ir_input_unregister(struct input_dev *dev) |
454 | { | 461 | { |
455 | struct ir_input_dev *ir_dev = input_get_drvdata(dev); | 462 | struct ir_input_dev *ir_dev = input_get_drvdata(dev); |
456 | struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; | 463 | struct ir_scancode_table *rc_tab; |
457 | 464 | ||
458 | if (!rc_tab) | 465 | if (!ir_dev) |
459 | return; | 466 | return; |
460 | 467 | ||
461 | IR_dprintk(1, "Freed keycode table\n"); | 468 | IR_dprintk(1, "Freed keycode table\n"); |
462 | 469 | ||
470 | rc_tab = &ir_dev->rc_tab; | ||
463 | rc_tab->size = 0; | 471 | rc_tab->size = 0; |
464 | kfree(rc_tab->scan); | 472 | kfree(rc_tab->scan); |
465 | rc_tab->scan = NULL; | 473 | rc_tab->scan = NULL; |
466 | 474 | ||
467 | kfree(ir_dev); | 475 | kfree(ir_dev); |
468 | input_set_drvdata(dev, NULL); | 476 | input_unregister_device(dev); |
469 | } | 477 | } |
470 | EXPORT_SYMBOL_GPL(ir_input_unregister); | 478 | EXPORT_SYMBOL_GPL(ir_input_unregister); |
471 | 479 | ||
diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 34e4e569cc7d..f0f483ac8b89 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c | |||
@@ -589,7 +589,7 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105) | |||
589 | snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys), | 589 | snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys), |
590 | "pci-%s/ir0", pci_name(dm1105->pdev)); | 590 | "pci-%s/ir0", pci_name(dm1105->pdev)); |
591 | 591 | ||
592 | err = ir_input_init(input_dev, &dm1105->ir.ir, ir_type, ir_codes); | 592 | err = ir_input_init(input_dev, &dm1105->ir.ir, ir_type); |
593 | if (err < 0) { | 593 | if (err < 0) { |
594 | input_free_device(input_dev); | 594 | input_free_device(input_dev); |
595 | return err; | 595 | return err; |
@@ -611,20 +611,14 @@ int __devinit dm1105_ir_init(struct dm1105dvb *dm1105) | |||
611 | 611 | ||
612 | INIT_WORK(&dm1105->ir.work, dm1105_emit_key); | 612 | INIT_WORK(&dm1105->ir.work, dm1105_emit_key); |
613 | 613 | ||
614 | err = input_register_device(input_dev); | 614 | err = ir_input_register(input_dev, ir_codes); |
615 | if (err) { | ||
616 | ir_input_unregister(input_dev); | ||
617 | input_free_device(input_dev); | ||
618 | return err; | ||
619 | } | ||
620 | 615 | ||
621 | return 0; | 616 | return err; |
622 | } | 617 | } |
623 | 618 | ||
624 | void __devexit dm1105_ir_exit(struct dm1105dvb *dm1105) | 619 | void __devexit dm1105_ir_exit(struct dm1105dvb *dm1105) |
625 | { | 620 | { |
626 | ir_input_unregister(dm1105->ir.input_dev); | 621 | ir_input_unregister(dm1105->ir.input_dev); |
627 | input_unregister_device(dm1105->ir.input_dev); | ||
628 | } | 622 | } |
629 | 623 | ||
630 | static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb) | 624 | static int __devinit dm1105dvb_hw_init(struct dm1105dvb *dm1105dvb) |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 9c9070a403dd..9782e0593733 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -190,12 +190,13 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
190 | struct saa7146_dev *saa = budget_ci->budget.dev; | 190 | struct saa7146_dev *saa = budget_ci->budget.dev; |
191 | struct input_dev *input_dev = budget_ci->ir.dev; | 191 | struct input_dev *input_dev = budget_ci->ir.dev; |
192 | int error; | 192 | int error; |
193 | struct ir_scancode_table *ir_codes; | ||
194 | |||
193 | 195 | ||
194 | budget_ci->ir.dev = input_dev = input_allocate_device(); | 196 | budget_ci->ir.dev = input_dev = input_allocate_device(); |
195 | if (!input_dev) { | 197 | if (!input_dev) { |
196 | printk(KERN_ERR "budget_ci: IR interface initialisation failed\n"); | 198 | printk(KERN_ERR "budget_ci: IR interface initialisation failed\n"); |
197 | error = -ENOMEM; | 199 | return -ENOMEM; |
198 | goto out1; | ||
199 | } | 200 | } |
200 | 201 | ||
201 | snprintf(budget_ci->ir.name, sizeof(budget_ci->ir.name), | 202 | snprintf(budget_ci->ir.name, sizeof(budget_ci->ir.name), |
@@ -217,6 +218,11 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
217 | } | 218 | } |
218 | input_dev->dev.parent = &saa->pci->dev; | 219 | input_dev->dev.parent = &saa->pci->dev; |
219 | 220 | ||
221 | if (rc5_device < 0) | ||
222 | budget_ci->ir.rc5_device = IR_DEVICE_ANY; | ||
223 | else | ||
224 | budget_ci->ir.rc5_device = rc5_device; | ||
225 | |||
220 | /* Select keymap and address */ | 226 | /* Select keymap and address */ |
221 | switch (budget_ci->budget.dev->pci->subsystem_device) { | 227 | switch (budget_ci->budget.dev->pci->subsystem_device) { |
222 | case 0x100c: | 228 | case 0x100c: |
@@ -224,53 +230,34 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
224 | case 0x1011: | 230 | case 0x1011: |
225 | case 0x1012: | 231 | case 0x1012: |
226 | /* The hauppauge keymap is a superset of these remotes */ | 232 | /* The hauppauge keymap is a superset of these remotes */ |
227 | error = ir_input_init(input_dev, &budget_ci->ir.state, | 233 | ir_codes = &ir_codes_hauppauge_new_table; |
228 | IR_TYPE_RC5, &ir_codes_hauppauge_new_table); | ||
229 | if (error < 0) | ||
230 | goto out2; | ||
231 | 234 | ||
232 | if (rc5_device < 0) | 235 | if (rc5_device < 0) |
233 | budget_ci->ir.rc5_device = 0x1f; | 236 | budget_ci->ir.rc5_device = 0x1f; |
234 | else | ||
235 | budget_ci->ir.rc5_device = rc5_device; | ||
236 | break; | 237 | break; |
237 | case 0x1010: | 238 | case 0x1010: |
238 | case 0x1017: | 239 | case 0x1017: |
239 | case 0x101a: | 240 | case 0x101a: |
240 | /* for the Technotrend 1500 bundled remote */ | 241 | /* for the Technotrend 1500 bundled remote */ |
241 | error = ir_input_init(input_dev, &budget_ci->ir.state, | 242 | ir_codes = &ir_codes_tt_1500_table; |
242 | IR_TYPE_RC5, &ir_codes_tt_1500_table); | ||
243 | if (error < 0) | ||
244 | goto out2; | ||
245 | |||
246 | if (rc5_device < 0) | ||
247 | budget_ci->ir.rc5_device = IR_DEVICE_ANY; | ||
248 | else | ||
249 | budget_ci->ir.rc5_device = rc5_device; | ||
250 | break; | 243 | break; |
251 | default: | 244 | default: |
252 | /* unknown remote */ | 245 | /* unknown remote */ |
253 | error = ir_input_init(input_dev, &budget_ci->ir.state, | 246 | ir_codes = &ir_codes_budget_ci_old_table; |
254 | IR_TYPE_RC5, &ir_codes_budget_ci_old_table); | ||
255 | if (error < 0) | ||
256 | goto out2; | ||
257 | |||
258 | if (rc5_device < 0) | ||
259 | budget_ci->ir.rc5_device = IR_DEVICE_ANY; | ||
260 | else | ||
261 | budget_ci->ir.rc5_device = rc5_device; | ||
262 | break; | 247 | break; |
263 | } | 248 | } |
264 | 249 | ||
250 | ir_input_init(input_dev, &budget_ci->ir.state, IR_TYPE_RC5); | ||
251 | |||
265 | /* initialise the key-up timeout handler */ | 252 | /* initialise the key-up timeout handler */ |
266 | init_timer(&budget_ci->ir.timer_keyup); | 253 | init_timer(&budget_ci->ir.timer_keyup); |
267 | budget_ci->ir.timer_keyup.function = msp430_ir_keyup; | 254 | budget_ci->ir.timer_keyup.function = msp430_ir_keyup; |
268 | budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; | 255 | budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; |
269 | budget_ci->ir.last_raw = 0xffff; /* An impossible value */ | 256 | budget_ci->ir.last_raw = 0xffff; /* An impossible value */ |
270 | error = input_register_device(input_dev); | 257 | error = ir_input_register(input_dev, ir_codes); |
271 | if (error) { | 258 | if (error) { |
272 | printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); | 259 | printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); |
273 | goto out2; | 260 | return error; |
274 | } | 261 | } |
275 | 262 | ||
276 | /* note: these must be after input_register_device */ | 263 | /* note: these must be after input_register_device */ |
@@ -284,12 +271,6 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
284 | saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI); | 271 | saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI); |
285 | 272 | ||
286 | return 0; | 273 | return 0; |
287 | |||
288 | out2: | ||
289 | ir_input_unregister(input_dev); | ||
290 | input_free_device(input_dev); | ||
291 | out1: | ||
292 | return error; | ||
293 | } | 274 | } |
294 | 275 | ||
295 | static void msp430_ir_deinit(struct budget_ci *budget_ci) | 276 | static void msp430_ir_deinit(struct budget_ci *budget_ci) |
@@ -305,7 +286,6 @@ static void msp430_ir_deinit(struct budget_ci *budget_ci) | |||
305 | ir_input_nokey(dev, &budget_ci->ir.state); | 286 | ir_input_nokey(dev, &budget_ci->ir.state); |
306 | 287 | ||
307 | ir_input_unregister(dev); | 288 | ir_input_unregister(dev); |
308 | input_unregister_device(dev); | ||
309 | } | 289 | } |
310 | 290 | ||
311 | static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address) | 291 | static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int address) |
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index 0e1a7aabefba..277a092e1214 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c | |||
@@ -368,7 +368,7 @@ int bttv_input_init(struct bttv *btv) | |||
368 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | 368 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", |
369 | pci_name(btv->c.pci)); | 369 | pci_name(btv->c.pci)); |
370 | 370 | ||
371 | err = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); | 371 | err = ir_input_init(input_dev, &ir->ir, ir_type); |
372 | if (err < 0) | 372 | if (err < 0) |
373 | goto err_out_free; | 373 | goto err_out_free; |
374 | 374 | ||
@@ -389,7 +389,7 @@ int bttv_input_init(struct bttv *btv) | |||
389 | bttv_ir_start(btv, ir); | 389 | bttv_ir_start(btv, ir); |
390 | 390 | ||
391 | /* all done */ | 391 | /* all done */ |
392 | err = input_register_device(btv->remote->dev); | 392 | err = ir_input_register(btv->remote->dev, ir_codes); |
393 | if (err) | 393 | if (err) |
394 | goto err_out_stop; | 394 | goto err_out_stop; |
395 | 395 | ||
@@ -403,8 +403,6 @@ int bttv_input_init(struct bttv *btv) | |||
403 | bttv_ir_stop(btv); | 403 | bttv_ir_stop(btv); |
404 | btv->remote = NULL; | 404 | btv->remote = NULL; |
405 | err_out_free: | 405 | err_out_free: |
406 | ir_input_unregister(input_dev); | ||
407 | input_free_device(input_dev); | ||
408 | kfree(ir); | 406 | kfree(ir); |
409 | return err; | 407 | return err; |
410 | } | 408 | } |
@@ -416,7 +414,6 @@ void bttv_input_fini(struct bttv *btv) | |||
416 | 414 | ||
417 | bttv_ir_stop(btv); | 415 | bttv_ir_stop(btv); |
418 | ir_input_unregister(btv->remote->dev); | 416 | ir_input_unregister(btv->remote->dev); |
419 | input_unregister_device(btv->remote->dev); | ||
420 | kfree(btv->remote); | 417 | kfree(btv->remote); |
421 | btv->remote = NULL; | 418 | btv->remote = NULL; |
422 | } | 419 | } |
diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c index 5eba1ec1205b..15826f98b688 100644 --- a/drivers/media/video/cx231xx/cx231xx-input.c +++ b/drivers/media/video/cx231xx/cx231xx-input.c | |||
@@ -197,8 +197,7 @@ int cx231xx_ir_init(struct cx231xx *dev) | |||
197 | usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); | 197 | usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); |
198 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); | 198 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); |
199 | 199 | ||
200 | err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER, | 200 | err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER); |
201 | dev->board.ir_codes); | ||
202 | if (err < 0) | 201 | if (err < 0) |
203 | goto err_out_free; | 202 | goto err_out_free; |
204 | 203 | ||
@@ -217,7 +216,7 @@ int cx231xx_ir_init(struct cx231xx *dev) | |||
217 | cx231xx_ir_start(ir); | 216 | cx231xx_ir_start(ir); |
218 | 217 | ||
219 | /* all done */ | 218 | /* all done */ |
220 | err = input_register_device(ir->input); | 219 | err = ir_input_register(ir->input, dev->board.ir_codes); |
221 | if (err) | 220 | if (err) |
222 | goto err_out_stop; | 221 | goto err_out_stop; |
223 | 222 | ||
@@ -226,8 +225,6 @@ err_out_stop: | |||
226 | cx231xx_ir_stop(ir); | 225 | cx231xx_ir_stop(ir); |
227 | dev->ir = NULL; | 226 | dev->ir = NULL; |
228 | err_out_free: | 227 | err_out_free: |
229 | ir_input_unregister(input_dev); | ||
230 | input_free_device(input_dev); | ||
231 | kfree(ir); | 228 | kfree(ir); |
232 | return err; | 229 | return err; |
233 | } | 230 | } |
@@ -242,7 +239,6 @@ int cx231xx_ir_fini(struct cx231xx *dev) | |||
242 | 239 | ||
243 | cx231xx_ir_stop(ir); | 240 | cx231xx_ir_stop(ir); |
244 | ir_input_unregister(ir->input); | 241 | ir_input_unregister(ir->input); |
245 | input_unregister_device(ir->input); | ||
246 | kfree(ir); | 242 | kfree(ir); |
247 | 243 | ||
248 | /* done */ | 244 | /* done */ |
diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index 2a5e4d959e8e..768eec92ccf9 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c | |||
@@ -377,7 +377,7 @@ int cx23885_input_init(struct cx23885_dev *dev) | |||
377 | cx23885_boards[dev->board].name); | 377 | cx23885_boards[dev->board].name); |
378 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); | 378 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); |
379 | 379 | ||
380 | ret = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); | 380 | ret = ir_input_init(input_dev, &ir->ir, ir_type); |
381 | if (ret < 0) | 381 | if (ret < 0) |
382 | goto err_out_free; | 382 | goto err_out_free; |
383 | 383 | ||
@@ -397,7 +397,7 @@ int cx23885_input_init(struct cx23885_dev *dev) | |||
397 | dev->ir_input = ir; | 397 | dev->ir_input = ir; |
398 | cx23885_input_ir_start(dev); | 398 | cx23885_input_ir_start(dev); |
399 | 399 | ||
400 | ret = input_register_device(ir->dev); | 400 | ret = ir_input_register(ir->dev, ir_codes); |
401 | if (ret) | 401 | if (ret) |
402 | goto err_out_stop; | 402 | goto err_out_stop; |
403 | 403 | ||
@@ -407,8 +407,6 @@ err_out_stop: | |||
407 | cx23885_input_ir_stop(dev); | 407 | cx23885_input_ir_stop(dev); |
408 | dev->ir_input = NULL; | 408 | dev->ir_input = NULL; |
409 | err_out_free: | 409 | err_out_free: |
410 | ir_input_unregister(input_dev); | ||
411 | input_free_device(input_dev); | ||
412 | kfree(ir); | 410 | kfree(ir); |
413 | return ret; | 411 | return ret; |
414 | } | 412 | } |
@@ -421,7 +419,6 @@ void cx23885_input_fini(struct cx23885_dev *dev) | |||
421 | if (dev->ir_input == NULL) | 419 | if (dev->ir_input == NULL) |
422 | return; | 420 | return; |
423 | ir_input_unregister(dev->ir_input->dev); | 421 | ir_input_unregister(dev->ir_input->dev); |
424 | input_unregister_device(dev->ir_input->dev); | ||
425 | kfree(dev->ir_input); | 422 | kfree(dev->ir_input); |
426 | dev->ir_input = NULL; | 423 | dev->ir_input = NULL; |
427 | } | 424 | } |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index d4dc2c2a3cbc..f9fda18b410c 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -360,7 +360,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
360 | snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); | 360 | snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); |
361 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); | 361 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); |
362 | 362 | ||
363 | err = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); | 363 | err = ir_input_init(input_dev, &ir->ir, ir_type); |
364 | if (err < 0) | 364 | if (err < 0) |
365 | goto err_out_free; | 365 | goto err_out_free; |
366 | 366 | ||
@@ -383,7 +383,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
383 | cx88_ir_start(core, ir); | 383 | cx88_ir_start(core, ir); |
384 | 384 | ||
385 | /* all done */ | 385 | /* all done */ |
386 | err = input_register_device(ir->input); | 386 | err = ir_input_register(ir->input, ir_codes); |
387 | if (err) | 387 | if (err) |
388 | goto err_out_stop; | 388 | goto err_out_stop; |
389 | 389 | ||
@@ -393,8 +393,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
393 | cx88_ir_stop(core, ir); | 393 | cx88_ir_stop(core, ir); |
394 | core->ir = NULL; | 394 | core->ir = NULL; |
395 | err_out_free: | 395 | err_out_free: |
396 | ir_input_unregister(input_dev); | ||
397 | input_free_device(input_dev); | ||
398 | kfree(ir); | 396 | kfree(ir); |
399 | return err; | 397 | return err; |
400 | } | 398 | } |
@@ -409,7 +407,6 @@ int cx88_ir_fini(struct cx88_core *core) | |||
409 | 407 | ||
410 | cx88_ir_stop(core, ir); | 408 | cx88_ir_stop(core, ir); |
411 | ir_input_unregister(ir->input); | 409 | ir_input_unregister(ir->input); |
412 | input_unregister_device(ir->input); | ||
413 | kfree(ir); | 410 | kfree(ir); |
414 | 411 | ||
415 | /* done */ | 412 | /* done */ |
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 9dc4e142726b..af0d935c29be 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c | |||
@@ -393,8 +393,7 @@ int em28xx_ir_init(struct em28xx *dev) | |||
393 | usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); | 393 | usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); |
394 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); | 394 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); |
395 | 395 | ||
396 | err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER, | 396 | err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER); |
397 | dev->board.ir_codes); | ||
398 | if (err < 0) | 397 | if (err < 0) |
399 | goto err_out_free; | 398 | goto err_out_free; |
400 | 399 | ||
@@ -413,7 +412,7 @@ int em28xx_ir_init(struct em28xx *dev) | |||
413 | em28xx_ir_start(ir); | 412 | em28xx_ir_start(ir); |
414 | 413 | ||
415 | /* all done */ | 414 | /* all done */ |
416 | err = input_register_device(ir->input); | 415 | err = ir_input_register(ir->input, dev->board.ir_codes); |
417 | if (err) | 416 | if (err) |
418 | goto err_out_stop; | 417 | goto err_out_stop; |
419 | 418 | ||
@@ -422,8 +421,6 @@ int em28xx_ir_init(struct em28xx *dev) | |||
422 | em28xx_ir_stop(ir); | 421 | em28xx_ir_stop(ir); |
423 | dev->ir = NULL; | 422 | dev->ir = NULL; |
424 | err_out_free: | 423 | err_out_free: |
425 | ir_input_unregister(input_dev); | ||
426 | input_free_device(input_dev); | ||
427 | kfree(ir); | 424 | kfree(ir); |
428 | return err; | 425 | return err; |
429 | } | 426 | } |
@@ -438,7 +435,6 @@ int em28xx_ir_fini(struct em28xx *dev) | |||
438 | 435 | ||
439 | em28xx_ir_stop(ir); | 436 | em28xx_ir_stop(ir); |
440 | ir_input_unregister(ir->input); | 437 | ir_input_unregister(ir->input); |
441 | input_unregister_device(ir->input); | ||
442 | kfree(ir); | 438 | kfree(ir); |
443 | 439 | ||
444 | /* done */ | 440 | /* done */ |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 9d8e78dc614e..b86e35386cee 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -438,7 +438,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
438 | dev_name(&client->dev)); | 438 | dev_name(&client->dev)); |
439 | 439 | ||
440 | /* init + register input device */ | 440 | /* init + register input device */ |
441 | err = ir_input_init(input_dev, &ir->ir, ir_type, ir->ir_codes); | 441 | err = ir_input_init(input_dev, &ir->ir, ir_type); |
442 | if (err < 0) | 442 | if (err < 0) |
443 | goto err_out_free; | 443 | goto err_out_free; |
444 | 444 | ||
@@ -446,7 +446,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
446 | input_dev->name = ir->name; | 446 | input_dev->name = ir->name; |
447 | input_dev->phys = ir->phys; | 447 | input_dev->phys = ir->phys; |
448 | 448 | ||
449 | err = input_register_device(ir->input); | 449 | err = ir_input_register(ir->input, ir->ir_codes); |
450 | if (err) | 450 | if (err) |
451 | goto err_out_free; | 451 | goto err_out_free; |
452 | 452 | ||
@@ -460,8 +460,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
460 | return 0; | 460 | return 0; |
461 | 461 | ||
462 | err_out_free: | 462 | err_out_free: |
463 | ir_input_unregister(input_dev); | ||
464 | input_free_device(input_dev); | ||
465 | kfree(ir); | 463 | kfree(ir); |
466 | return err; | 464 | return err; |
467 | } | 465 | } |
@@ -475,7 +473,6 @@ static int ir_remove(struct i2c_client *client) | |||
475 | 473 | ||
476 | /* unregister device */ | 474 | /* unregister device */ |
477 | ir_input_unregister(ir->input); | 475 | ir_input_unregister(ir->input); |
478 | input_unregister_device(ir->input); | ||
479 | 476 | ||
480 | /* free memory */ | 477 | /* free memory */ |
481 | kfree(ir); | 478 | kfree(ir); |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 5093e7a0d58c..f8e985989ca0 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -708,7 +708,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
708 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | 708 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", |
709 | pci_name(dev->pci)); | 709 | pci_name(dev->pci)); |
710 | 710 | ||
711 | err = ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); | 711 | err = ir_input_init(input_dev, &ir->ir, ir_type); |
712 | if (err < 0) | 712 | if (err < 0) |
713 | goto err_out_free; | 713 | goto err_out_free; |
714 | 714 | ||
@@ -728,7 +728,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
728 | dev->remote = ir; | 728 | dev->remote = ir; |
729 | saa7134_ir_start(dev, ir); | 729 | saa7134_ir_start(dev, ir); |
730 | 730 | ||
731 | err = input_register_device(ir->dev); | 731 | err = ir_input_register(ir->dev, ir_codes); |
732 | if (err) | 732 | if (err) |
733 | goto err_out_stop; | 733 | goto err_out_stop; |
734 | 734 | ||
@@ -742,8 +742,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
742 | saa7134_ir_stop(dev); | 742 | saa7134_ir_stop(dev); |
743 | dev->remote = NULL; | 743 | dev->remote = NULL; |
744 | err_out_free: | 744 | err_out_free: |
745 | ir_input_unregister(input_dev); | ||
746 | input_free_device(input_dev); | ||
747 | kfree(ir); | 745 | kfree(ir); |
748 | return err; | 746 | return err; |
749 | } | 747 | } |
@@ -755,7 +753,6 @@ void saa7134_input_fini(struct saa7134_dev *dev) | |||
755 | 753 | ||
756 | saa7134_ir_stop(dev); | 754 | saa7134_ir_stop(dev); |
757 | ir_input_unregister(dev->remote->dev); | 755 | ir_input_unregister(dev->remote->dev); |
758 | input_unregister_device(dev->remote->dev); | ||
759 | kfree(dev->remote); | 756 | kfree(dev->remote); |
760 | dev->remote = NULL; | 757 | dev->remote = NULL; |
761 | } | 758 | } |