diff options
author | David Härdeman <david@hardeman.nu> | 2010-10-29 15:08:23 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-29 05:16:37 -0500 |
commit | d8b4b5822f51e2142b731b42c81e3f03eec475b2 (patch) | |
tree | fce9a9b7ca5031adc95fbd6be118352fb2527da5 /drivers/media/dvb/dm1105/dm1105.c | |
parent | 4c7b355df6e7f05304e05f6b7a286e59a5f1cc54 (diff) |
[media] ir-core: make struct rc_dev the primary interface
This patch merges the ir_input_dev and ir_dev_props structs into a single
struct called rc_dev. The drivers and various functions in rc-core used
by the drivers are also changed to use rc_dev as the primary interface
when dealing with rc-core.
This means that the input_dev is abstracted away from the drivers which
is necessary if we ever want to support multiple input devs per rc device.
The new API is similar to what the input subsystem uses, i.e:
rc_device_alloc()
rc_device_free()
rc_device_register()
rc_device_unregister()
[mchehab@redhat.com: Fix compilation on mceusb and cx231xx, due to merge conflicts]
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/dvb/dm1105/dm1105.c')
-rw-r--r-- | drivers/media/dvb/dm1105/dm1105.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 5d404f1bf036..d1a43858f29c 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/proc_fs.h> | 26 | #include <linux/proc_fs.h> |
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
29 | #include <linux/input.h> | ||
30 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
31 | #include <media/ir-core.h> | 30 | #include <media/ir-core.h> |
32 | 31 | ||
@@ -266,7 +265,7 @@ static void dm1105_card_list(struct pci_dev *pci) | |||
266 | 265 | ||
267 | /* infrared remote control */ | 266 | /* infrared remote control */ |
268 | struct infrared { | 267 | struct infrared { |
269 | struct input_dev *input_dev; | 268 | struct rc_dev *dev; |
270 | char input_phys[32]; | 269 | char input_phys[32]; |
271 | struct work_struct work; | 270 | struct work_struct work; |
272 | u32 ir_command; | 271 | u32 ir_command; |
@@ -532,7 +531,7 @@ static void dm1105_emit_key(struct work_struct *work) | |||
532 | 531 | ||
533 | data = (ircom >> 8) & 0x7f; | 532 | data = (ircom >> 8) & 0x7f; |
534 | 533 | ||
535 | ir_keydown(ir->input_dev, data, 0); | 534 | ir_keydown(ir->dev, data, 0); |
536 | } | 535 | } |
537 | 536 | ||
538 | /* work handler */ | 537 | /* work handler */ |
@@ -593,46 +592,47 @@ static irqreturn_t dm1105_irq(int irq, void *dev_id) | |||
593 | 592 | ||
594 | int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) | 593 | int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) |
595 | { | 594 | { |
596 | struct input_dev *input_dev; | 595 | struct rc_dev *dev; |
597 | char *ir_codes = RC_MAP_DM1105_NEC; | ||
598 | int err = -ENOMEM; | 596 | int err = -ENOMEM; |
599 | 597 | ||
600 | input_dev = input_allocate_device(); | 598 | dev = rc_allocate_device(); |
601 | if (!input_dev) | 599 | if (!dev) |
602 | return -ENOMEM; | 600 | return -ENOMEM; |
603 | 601 | ||
604 | dm1105->ir.input_dev = input_dev; | ||
605 | snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys), | 602 | snprintf(dm1105->ir.input_phys, sizeof(dm1105->ir.input_phys), |
606 | "pci-%s/ir0", pci_name(dm1105->pdev)); | 603 | "pci-%s/ir0", pci_name(dm1105->pdev)); |
607 | 604 | ||
608 | input_dev->name = "DVB on-card IR receiver"; | 605 | dev->driver_name = MODULE_NAME; |
609 | input_dev->phys = dm1105->ir.input_phys; | 606 | dev->map_name = RC_MAP_DM1105_NEC; |
610 | input_dev->id.bustype = BUS_PCI; | 607 | dev->driver_type = RC_DRIVER_SCANCODE; |
611 | input_dev->id.version = 1; | 608 | dev->input_name = "DVB on-card IR receiver"; |
609 | dev->input_phys = dm1105->ir.input_phys; | ||
610 | dev->input_id.bustype = BUS_PCI; | ||
611 | dev->input_id.version = 1; | ||
612 | if (dm1105->pdev->subsystem_vendor) { | 612 | if (dm1105->pdev->subsystem_vendor) { |
613 | input_dev->id.vendor = dm1105->pdev->subsystem_vendor; | 613 | dev->input_id.vendor = dm1105->pdev->subsystem_vendor; |
614 | input_dev->id.product = dm1105->pdev->subsystem_device; | 614 | dev->input_id.product = dm1105->pdev->subsystem_device; |
615 | } else { | 615 | } else { |
616 | input_dev->id.vendor = dm1105->pdev->vendor; | 616 | dev->input_id.vendor = dm1105->pdev->vendor; |
617 | input_dev->id.product = dm1105->pdev->device; | 617 | dev->input_id.product = dm1105->pdev->device; |
618 | } | 618 | } |
619 | 619 | dev->dev.parent = &dm1105->pdev->dev; | |
620 | input_dev->dev.parent = &dm1105->pdev->dev; | ||
621 | 620 | ||
622 | INIT_WORK(&dm1105->ir.work, dm1105_emit_key); | 621 | INIT_WORK(&dm1105->ir.work, dm1105_emit_key); |
623 | 622 | ||
624 | err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); | 623 | err = rc_register_device(dev); |
625 | if (err < 0) { | 624 | if (err < 0) { |
626 | input_free_device(input_dev); | 625 | rc_free_device(dev); |
627 | return err; | 626 | return err; |
628 | } | 627 | } |
629 | 628 | ||
629 | dm1105->ir.dev = dev; | ||
630 | return 0; | 630 | return 0; |
631 | } | 631 | } |
632 | 632 | ||
633 | void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105) | 633 | void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105) |
634 | { | 634 | { |
635 | ir_input_unregister(dm1105->ir.input_dev); | 635 | rc_unregister_device(dm1105->ir.dev); |
636 | } | 636 | } |
637 | 637 | ||
638 | static int __devinit dm1105_hw_init(struct dm1105_dev *dev) | 638 | static int __devinit dm1105_hw_init(struct dm1105_dev *dev) |