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/media/video | |
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/media/video')
-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 |
7 files changed, 14 insertions, 37 deletions
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 | } |