diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-15 03:01:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 12:52:53 -0400 |
commit | b7df3910c1298fee8ed7b9dfd2da74b85df5539c (patch) | |
tree | 1948ee697c23a384dd0be625ebeee13062d73882 /drivers | |
parent | 76b7cddfd576331761e945a508254abad11039e9 (diff) |
[PATCH] drivers/media: convert to dynamic input_dev allocation
Input: convert drivers/media to dynamic input_dev allocation
This is required for input_dev sysfs integration
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/common/ir-common.c | 1 | ||||
-rw-r--r-- | drivers/media/dvb/cinergyT2/cinergyT2.c | 108 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 50 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb.h | 3 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/av7110_ir.c | 37 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 24 | ||||
-rw-r--r-- | drivers/media/dvb/ttusb-dec/ttusb_dec.c | 51 | ||||
-rw-r--r-- | drivers/media/video/bttvp.h | 2 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-input.c | 58 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-gpio.c | 52 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 33 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 39 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 2 |
13 files changed, 268 insertions, 192 deletions
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c index a0e700d7a4a4..06f4d4686a6c 100644 --- a/drivers/media/common/ir-common.c +++ b/drivers/media/common/ir-common.c | |||
@@ -252,7 +252,6 @@ void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | |||
252 | if (ir_codes) | 252 | if (ir_codes) |
253 | memcpy(ir->ir_codes, ir_codes, sizeof(ir->ir_codes)); | 253 | memcpy(ir->ir_codes, ir_codes, sizeof(ir->ir_codes)); |
254 | 254 | ||
255 | init_input_dev(dev); | ||
256 | dev->keycode = ir->ir_codes; | 255 | dev->keycode = ir->ir_codes; |
257 | dev->keycodesize = sizeof(IR_KEYTAB_TYPE); | 256 | dev->keycodesize = sizeof(IR_KEYTAB_TYPE); |
258 | dev->keycodemax = IR_KEYTAB_SIZE; | 257 | dev->keycodemax = IR_KEYTAB_SIZE; |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 6db0929ef53d..a1607e7d6d6b 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -137,7 +137,8 @@ struct cinergyt2 { | |||
137 | struct urb *stream_urb [STREAM_URB_COUNT]; | 137 | struct urb *stream_urb [STREAM_URB_COUNT]; |
138 | 138 | ||
139 | #ifdef ENABLE_RC | 139 | #ifdef ENABLE_RC |
140 | struct input_dev rc_input_dev; | 140 | struct input_dev *rc_input_dev; |
141 | char phys[64]; | ||
141 | struct work_struct rc_query_work; | 142 | struct work_struct rc_query_work; |
142 | int rc_input_event; | 143 | int rc_input_event; |
143 | u32 rc_last_code; | 144 | u32 rc_last_code; |
@@ -683,6 +684,7 @@ static struct dvb_device cinergyt2_fe_template = { | |||
683 | }; | 684 | }; |
684 | 685 | ||
685 | #ifdef ENABLE_RC | 686 | #ifdef ENABLE_RC |
687 | |||
686 | static void cinergyt2_query_rc (void *data) | 688 | static void cinergyt2_query_rc (void *data) |
687 | { | 689 | { |
688 | struct cinergyt2 *cinergyt2 = data; | 690 | struct cinergyt2 *cinergyt2 = data; |
@@ -703,7 +705,7 @@ static void cinergyt2_query_rc (void *data) | |||
703 | /* stop key repeat */ | 705 | /* stop key repeat */ |
704 | if (cinergyt2->rc_input_event != KEY_MAX) { | 706 | if (cinergyt2->rc_input_event != KEY_MAX) { |
705 | dprintk(1, "rc_input_event=%d Up\n", cinergyt2->rc_input_event); | 707 | dprintk(1, "rc_input_event=%d Up\n", cinergyt2->rc_input_event); |
706 | input_report_key(&cinergyt2->rc_input_dev, | 708 | input_report_key(cinergyt2->rc_input_dev, |
707 | cinergyt2->rc_input_event, 0); | 709 | cinergyt2->rc_input_event, 0); |
708 | cinergyt2->rc_input_event = KEY_MAX; | 710 | cinergyt2->rc_input_event = KEY_MAX; |
709 | } | 711 | } |
@@ -722,7 +724,7 @@ static void cinergyt2_query_rc (void *data) | |||
722 | /* keyrepeat bit -> just repeat last rc_input_event */ | 724 | /* keyrepeat bit -> just repeat last rc_input_event */ |
723 | } else { | 725 | } else { |
724 | cinergyt2->rc_input_event = KEY_MAX; | 726 | cinergyt2->rc_input_event = KEY_MAX; |
725 | for (i = 0; i < sizeof(rc_keys) / sizeof(rc_keys[0]); i += 3) { | 727 | for (i = 0; i < ARRAY_SIZE(rc_keys); i += 3) { |
726 | if (rc_keys[i + 0] == rc_events[n].type && | 728 | if (rc_keys[i + 0] == rc_events[n].type && |
727 | rc_keys[i + 1] == le32_to_cpu(rc_events[n].value)) { | 729 | rc_keys[i + 1] == le32_to_cpu(rc_events[n].value)) { |
728 | cinergyt2->rc_input_event = rc_keys[i + 2]; | 730 | cinergyt2->rc_input_event = rc_keys[i + 2]; |
@@ -736,11 +738,11 @@ static void cinergyt2_query_rc (void *data) | |||
736 | cinergyt2->rc_last_code != ~0) { | 738 | cinergyt2->rc_last_code != ~0) { |
737 | /* emit a key-up so the double event is recognized */ | 739 | /* emit a key-up so the double event is recognized */ |
738 | dprintk(1, "rc_input_event=%d UP\n", cinergyt2->rc_input_event); | 740 | dprintk(1, "rc_input_event=%d UP\n", cinergyt2->rc_input_event); |
739 | input_report_key(&cinergyt2->rc_input_dev, | 741 | input_report_key(cinergyt2->rc_input_dev, |
740 | cinergyt2->rc_input_event, 0); | 742 | cinergyt2->rc_input_event, 0); |
741 | } | 743 | } |
742 | dprintk(1, "rc_input_event=%d\n", cinergyt2->rc_input_event); | 744 | dprintk(1, "rc_input_event=%d\n", cinergyt2->rc_input_event); |
743 | input_report_key(&cinergyt2->rc_input_dev, | 745 | input_report_key(cinergyt2->rc_input_dev, |
744 | cinergyt2->rc_input_event, 1); | 746 | cinergyt2->rc_input_event, 1); |
745 | cinergyt2->rc_last_code = rc_events[n].value; | 747 | cinergyt2->rc_last_code = rc_events[n].value; |
746 | } | 748 | } |
@@ -752,7 +754,59 @@ out: | |||
752 | 754 | ||
753 | up(&cinergyt2->sem); | 755 | up(&cinergyt2->sem); |
754 | } | 756 | } |
755 | #endif | 757 | |
758 | static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) | ||
759 | { | ||
760 | struct input_dev *input_dev; | ||
761 | int i; | ||
762 | |||
763 | cinergyt2->rc_input_dev = input_dev = input_allocate_device(); | ||
764 | if (!input_dev) | ||
765 | return -ENOMEM; | ||
766 | |||
767 | usb_make_path(cinergyt2->udev, cinergyt2->phys, sizeof(cinergyt2->phys)); | ||
768 | strlcat(cinergyt2->phys, "/input0", sizeof(cinergyt2->phys)); | ||
769 | cinergyt2->rc_input_event = KEY_MAX; | ||
770 | cinergyt2->rc_last_code = ~0; | ||
771 | INIT_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc, cinergyt2); | ||
772 | |||
773 | input_dev->name = DRIVER_NAME " remote control"; | ||
774 | input_dev->phys = cinergyt2->phys; | ||
775 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | ||
776 | for (i = 0; ARRAY_SIZE(rc_keys); i += 3) | ||
777 | set_bit(rc_keys[i + 2], input_dev->keybit); | ||
778 | input_dev->keycodesize = 0; | ||
779 | input_dev->keycodemax = 0; | ||
780 | |||
781 | input_register_device(cinergyt2->rc_input_dev); | ||
782 | schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2); | ||
783 | } | ||
784 | |||
785 | static void cinergyt2_unregister_rc(struct cinergyt2 *cinergyt2) | ||
786 | { | ||
787 | cancel_delayed_work(&cinergyt2->rc_query_work); | ||
788 | flush_scheduled_work(); | ||
789 | input_unregister_device(cinergyt2->rc_input_dev); | ||
790 | } | ||
791 | |||
792 | static inline void cinergyt2_suspend_rc(struct cinergyt2 *cinergyt2) | ||
793 | { | ||
794 | cancel_delayed_work(&cinergyt2->rc_query_work); | ||
795 | } | ||
796 | |||
797 | static inline void cinergyt2_resume_rc(struct cinergyt2 *cinergyt2) | ||
798 | { | ||
799 | schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2); | ||
800 | } | ||
801 | |||
802 | #else | ||
803 | |||
804 | static inline int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) { return 0; } | ||
805 | static inline void cinergyt2_unregister_rc(struct cinergyt2 *cinergyt2) { } | ||
806 | static inline void cinergyt2_suspend_rc(struct cinergyt2 *cinergyt2) { } | ||
807 | static inline void cinergyt2_resume_rc(struct cinergyt2 *cinergyt2) { } | ||
808 | |||
809 | #endif /* ENABLE_RC */ | ||
756 | 810 | ||
757 | static void cinergyt2_query (void *data) | 811 | static void cinergyt2_query (void *data) |
758 | { | 812 | { |
@@ -789,9 +843,6 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
789 | { | 843 | { |
790 | struct cinergyt2 *cinergyt2; | 844 | struct cinergyt2 *cinergyt2; |
791 | int err; | 845 | int err; |
792 | #ifdef ENABLE_RC | ||
793 | int i; | ||
794 | #endif | ||
795 | 846 | ||
796 | if (!(cinergyt2 = kmalloc (sizeof(struct cinergyt2), GFP_KERNEL))) { | 847 | if (!(cinergyt2 = kmalloc (sizeof(struct cinergyt2), GFP_KERNEL))) { |
797 | dprintk(1, "out of memory?!?\n"); | 848 | dprintk(1, "out of memory?!?\n"); |
@@ -846,30 +897,17 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
846 | &cinergyt2_fe_template, cinergyt2, | 897 | &cinergyt2_fe_template, cinergyt2, |
847 | DVB_DEVICE_FRONTEND); | 898 | DVB_DEVICE_FRONTEND); |
848 | 899 | ||
849 | #ifdef ENABLE_RC | 900 | err = cinergyt2_register_rc(cinergyt2); |
850 | cinergyt2->rc_input_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 901 | if (err) |
851 | cinergyt2->rc_input_dev.keycodesize = 0; | 902 | goto bailout; |
852 | cinergyt2->rc_input_dev.keycodemax = 0; | ||
853 | cinergyt2->rc_input_dev.name = DRIVER_NAME " remote control"; | ||
854 | |||
855 | for (i = 0; i < sizeof(rc_keys) / sizeof(rc_keys[0]); i += 3) | ||
856 | set_bit(rc_keys[i + 2], cinergyt2->rc_input_dev.keybit); | ||
857 | |||
858 | input_register_device(&cinergyt2->rc_input_dev); | ||
859 | |||
860 | cinergyt2->rc_input_event = KEY_MAX; | ||
861 | cinergyt2->rc_last_code = ~0; | ||
862 | 903 | ||
863 | INIT_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc, cinergyt2); | ||
864 | schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2); | ||
865 | #endif | ||
866 | return 0; | 904 | return 0; |
867 | 905 | ||
868 | bailout: | 906 | bailout: |
869 | dvb_dmxdev_release(&cinergyt2->dmxdev); | 907 | dvb_dmxdev_release(&cinergyt2->dmxdev); |
870 | dvb_dmx_release(&cinergyt2->demux); | 908 | dvb_dmx_release(&cinergyt2->demux); |
871 | dvb_unregister_adapter (&cinergyt2->adapter); | 909 | dvb_unregister_adapter(&cinergyt2->adapter); |
872 | cinergyt2_free_stream_urbs (cinergyt2); | 910 | cinergyt2_free_stream_urbs(cinergyt2); |
873 | kfree(cinergyt2); | 911 | kfree(cinergyt2); |
874 | return -ENOMEM; | 912 | return -ENOMEM; |
875 | } | 913 | } |
@@ -881,11 +919,7 @@ static void cinergyt2_disconnect (struct usb_interface *intf) | |||
881 | if (down_interruptible(&cinergyt2->sem)) | 919 | if (down_interruptible(&cinergyt2->sem)) |
882 | return; | 920 | return; |
883 | 921 | ||
884 | #ifdef ENABLE_RC | 922 | cinergyt2_unregister_rc(cinergyt2); |
885 | cancel_delayed_work(&cinergyt2->rc_query_work); | ||
886 | flush_scheduled_work(); | ||
887 | input_unregister_device(&cinergyt2->rc_input_dev); | ||
888 | #endif | ||
889 | 923 | ||
890 | cinergyt2->demux.dmx.close(&cinergyt2->demux.dmx); | 924 | cinergyt2->demux.dmx.close(&cinergyt2->demux.dmx); |
891 | dvb_net_release(&cinergyt2->dvbnet); | 925 | dvb_net_release(&cinergyt2->dvbnet); |
@@ -908,9 +942,8 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state) | |||
908 | 942 | ||
909 | if (state.event > PM_EVENT_ON) { | 943 | if (state.event > PM_EVENT_ON) { |
910 | struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); | 944 | struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); |
911 | #ifdef ENABLE_RC | 945 | |
912 | cancel_delayed_work(&cinergyt2->rc_query_work); | 946 | cinergyt2_suspend_rc(cinergyt2); |
913 | #endif | ||
914 | cancel_delayed_work(&cinergyt2->query_work); | 947 | cancel_delayed_work(&cinergyt2->query_work); |
915 | if (cinergyt2->streaming) | 948 | if (cinergyt2->streaming) |
916 | cinergyt2_stop_stream_xfer(cinergyt2); | 949 | cinergyt2_stop_stream_xfer(cinergyt2); |
@@ -938,9 +971,8 @@ static int cinergyt2_resume (struct usb_interface *intf) | |||
938 | schedule_delayed_work(&cinergyt2->query_work, HZ/2); | 971 | schedule_delayed_work(&cinergyt2->query_work, HZ/2); |
939 | } | 972 | } |
940 | 973 | ||
941 | #ifdef ENABLE_RC | 974 | cinergyt2_resume_rc(cinergyt2); |
942 | schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2); | 975 | |
943 | #endif | ||
944 | up(&cinergyt2->sem); | 976 | up(&cinergyt2->sem); |
945 | return 0; | 977 | return 0; |
946 | } | 978 | } |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index fc7800f1743e..e5c6d9835e06 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | |||
@@ -39,9 +39,9 @@ static void dvb_usb_read_remote_control(void *data) | |||
39 | d->last_event = event; | 39 | d->last_event = event; |
40 | case REMOTE_KEY_REPEAT: | 40 | case REMOTE_KEY_REPEAT: |
41 | deb_rc("key repeated\n"); | 41 | deb_rc("key repeated\n"); |
42 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 1); | 42 | input_event(d->rc_input_dev, EV_KEY, event, 1); |
43 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 0); | 43 | input_event(d->rc_input_dev, EV_KEY, d->last_event, 0); |
44 | input_sync(&d->rc_input_dev); | 44 | input_sync(d->rc_input_dev); |
45 | break; | 45 | break; |
46 | default: | 46 | default: |
47 | break; | 47 | break; |
@@ -53,8 +53,8 @@ static void dvb_usb_read_remote_control(void *data) | |||
53 | deb_rc("NO KEY PRESSED\n"); | 53 | deb_rc("NO KEY PRESSED\n"); |
54 | if (d->last_state != REMOTE_NO_KEY_PRESSED) { | 54 | if (d->last_state != REMOTE_NO_KEY_PRESSED) { |
55 | deb_rc("releasing event %d\n",d->last_event); | 55 | deb_rc("releasing event %d\n",d->last_event); |
56 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 0); | 56 | input_event(d->rc_input_dev, EV_KEY, d->last_event, 0); |
57 | input_sync(&d->rc_input_dev); | 57 | input_sync(d->rc_input_dev); |
58 | } | 58 | } |
59 | d->last_state = REMOTE_NO_KEY_PRESSED; | 59 | d->last_state = REMOTE_NO_KEY_PRESSED; |
60 | d->last_event = 0; | 60 | d->last_event = 0; |
@@ -63,8 +63,8 @@ static void dvb_usb_read_remote_control(void *data) | |||
63 | deb_rc("KEY PRESSED\n"); | 63 | deb_rc("KEY PRESSED\n"); |
64 | deb_rc("pressing event %d\n",event); | 64 | deb_rc("pressing event %d\n",event); |
65 | 65 | ||
66 | input_event(&d->rc_input_dev, EV_KEY, event, 1); | 66 | input_event(d->rc_input_dev, EV_KEY, event, 1); |
67 | input_sync(&d->rc_input_dev); | 67 | input_sync(d->rc_input_dev); |
68 | 68 | ||
69 | d->last_event = event; | 69 | d->last_event = event; |
70 | d->last_state = REMOTE_KEY_PRESSED; | 70 | d->last_state = REMOTE_KEY_PRESSED; |
@@ -73,8 +73,8 @@ static void dvb_usb_read_remote_control(void *data) | |||
73 | deb_rc("KEY_REPEAT\n"); | 73 | deb_rc("KEY_REPEAT\n"); |
74 | if (d->last_state != REMOTE_NO_KEY_PRESSED) { | 74 | if (d->last_state != REMOTE_NO_KEY_PRESSED) { |
75 | deb_rc("repeating event %d\n",d->last_event); | 75 | deb_rc("repeating event %d\n",d->last_event); |
76 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 2); | 76 | input_event(d->rc_input_dev, EV_KEY, d->last_event, 2); |
77 | input_sync(&d->rc_input_dev); | 77 | input_sync(d->rc_input_dev); |
78 | d->last_state = REMOTE_KEY_REPEAT; | 78 | d->last_state = REMOTE_KEY_REPEAT; |
79 | } | 79 | } |
80 | default: | 80 | default: |
@@ -89,24 +89,30 @@ schedule: | |||
89 | int dvb_usb_remote_init(struct dvb_usb_device *d) | 89 | int dvb_usb_remote_init(struct dvb_usb_device *d) |
90 | { | 90 | { |
91 | int i; | 91 | int i; |
92 | |||
92 | if (d->props.rc_key_map == NULL || | 93 | if (d->props.rc_key_map == NULL || |
93 | d->props.rc_query == NULL || | 94 | d->props.rc_query == NULL || |
94 | dvb_usb_disable_rc_polling) | 95 | dvb_usb_disable_rc_polling) |
95 | return 0; | 96 | return 0; |
96 | 97 | ||
97 | /* Initialise the remote-control structures.*/ | 98 | usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); |
98 | init_input_dev(&d->rc_input_dev); | 99 | strlcpy(d->rc_phys, "/ir0", sizeof(d->rc_phys)); |
100 | |||
101 | d->rc_input_dev = input_allocate_device(); | ||
102 | if (!d->rc_input_dev) | ||
103 | return -ENOMEM; | ||
99 | 104 | ||
100 | d->rc_input_dev.evbit[0] = BIT(EV_KEY); | 105 | d->rc_input_dev->evbit[0] = BIT(EV_KEY); |
101 | d->rc_input_dev.keycodesize = sizeof(unsigned char); | 106 | d->rc_input_dev->keycodesize = sizeof(unsigned char); |
102 | d->rc_input_dev.keycodemax = KEY_MAX; | 107 | d->rc_input_dev->keycodemax = KEY_MAX; |
103 | d->rc_input_dev.name = "IR-receiver inside an USB DVB receiver"; | 108 | d->rc_input_dev->name = "IR-receiver inside an USB DVB receiver"; |
109 | d->rc_input_dev->phys = d->rc_phys; | ||
104 | 110 | ||
105 | /* set the bits for the keys */ | 111 | /* set the bits for the keys */ |
106 | deb_rc("key map size: %d\n",d->props.rc_key_map_size); | 112 | deb_rc("key map size: %d\n", d->props.rc_key_map_size); |
107 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 113 | for (i = 0; i < d->props.rc_key_map_size; i++) { |
108 | deb_rc("setting bit for event %d item %d\n",d->props.rc_key_map[i].event, i); | 114 | deb_rc("setting bit for event %d item %d\n",d->props.rc_key_map[i].event, i); |
109 | set_bit(d->props.rc_key_map[i].event, d->rc_input_dev.keybit); | 115 | set_bit(d->props.rc_key_map[i].event, d->rc_input_dev->keybit); |
110 | } | 116 | } |
111 | 117 | ||
112 | /* Start the remote-control polling. */ | 118 | /* Start the remote-control polling. */ |
@@ -114,14 +120,14 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) | |||
114 | d->props.rc_interval = 100; /* default */ | 120 | d->props.rc_interval = 100; /* default */ |
115 | 121 | ||
116 | /* setting these two values to non-zero, we have to manage key repeats */ | 122 | /* setting these two values to non-zero, we have to manage key repeats */ |
117 | d->rc_input_dev.rep[REP_PERIOD] = d->props.rc_interval; | 123 | d->rc_input_dev->rep[REP_PERIOD] = d->props.rc_interval; |
118 | d->rc_input_dev.rep[REP_DELAY] = d->props.rc_interval + 150; | 124 | d->rc_input_dev->rep[REP_DELAY] = d->props.rc_interval + 150; |
119 | 125 | ||
120 | input_register_device(&d->rc_input_dev); | 126 | input_register_device(d->rc_input_dev); |
121 | 127 | ||
122 | INIT_WORK(&d->rc_query_work, dvb_usb_read_remote_control, d); | 128 | INIT_WORK(&d->rc_query_work, dvb_usb_read_remote_control, d); |
123 | 129 | ||
124 | info("schedule remote query interval to %d msecs.",d->props.rc_interval); | 130 | info("schedule remote query interval to %d msecs.", d->props.rc_interval); |
125 | schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); | 131 | schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); |
126 | 132 | ||
127 | d->state |= DVB_USB_STATE_REMOTE; | 133 | d->state |= DVB_USB_STATE_REMOTE; |
@@ -134,7 +140,7 @@ int dvb_usb_remote_exit(struct dvb_usb_device *d) | |||
134 | if (d->state & DVB_USB_STATE_REMOTE) { | 140 | if (d->state & DVB_USB_STATE_REMOTE) { |
135 | cancel_delayed_work(&d->rc_query_work); | 141 | cancel_delayed_work(&d->rc_query_work); |
136 | flush_scheduled_work(); | 142 | flush_scheduled_work(); |
137 | input_unregister_device(&d->rc_input_dev); | 143 | input_unregister_device(d->rc_input_dev); |
138 | } | 144 | } |
139 | d->state &= ~DVB_USB_STATE_REMOTE; | 145 | d->state &= ~DVB_USB_STATE_REMOTE; |
140 | return 0; | 146 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 0e4f1035b0dd..b4a1a98006c7 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
@@ -300,7 +300,8 @@ struct dvb_usb_device { | |||
300 | int (*fe_init) (struct dvb_frontend *); | 300 | int (*fe_init) (struct dvb_frontend *); |
301 | 301 | ||
302 | /* remote control */ | 302 | /* remote control */ |
303 | struct input_dev rc_input_dev; | 303 | struct input_dev *rc_input_dev; |
304 | char rc_phys[64]; | ||
304 | struct work_struct rc_query_work; | 305 | struct work_struct rc_query_work; |
305 | u32 last_event; | 306 | u32 last_event; |
306 | int last_state; | 307 | int last_state; |
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c index 357a3728ec68..f5e59fc924af 100644 --- a/drivers/media/dvb/ttpci/av7110_ir.c +++ b/drivers/media/dvb/ttpci/av7110_ir.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | static int av_cnt; | 16 | static int av_cnt; |
17 | static struct av7110 *av_list[4]; | 17 | static struct av7110 *av_list[4]; |
18 | static struct input_dev input_dev; | 18 | static struct input_dev *input_dev; |
19 | 19 | ||
20 | static u16 key_map [256] = { | 20 | static u16 key_map [256] = { |
21 | KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, | 21 | KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, |
@@ -43,10 +43,10 @@ static u16 key_map [256] = { | |||
43 | 43 | ||
44 | static void av7110_emit_keyup(unsigned long data) | 44 | static void av7110_emit_keyup(unsigned long data) |
45 | { | 45 | { |
46 | if (!data || !test_bit(data, input_dev.key)) | 46 | if (!data || !test_bit(data, input_dev->key)) |
47 | return; | 47 | return; |
48 | 48 | ||
49 | input_event(&input_dev, EV_KEY, data, !!0); | 49 | input_event(input_dev, EV_KEY, data, !!0); |
50 | } | 50 | } |
51 | 51 | ||
52 | 52 | ||
@@ -112,13 +112,13 @@ static void av7110_emit_key(unsigned long parm) | |||
112 | if (timer_pending(&keyup_timer)) { | 112 | if (timer_pending(&keyup_timer)) { |
113 | del_timer(&keyup_timer); | 113 | del_timer(&keyup_timer); |
114 | if (keyup_timer.data != keycode || new_toggle != old_toggle) { | 114 | if (keyup_timer.data != keycode || new_toggle != old_toggle) { |
115 | input_event(&input_dev, EV_KEY, keyup_timer.data, !!0); | 115 | input_event(input_dev, EV_KEY, keyup_timer.data, !!0); |
116 | input_event(&input_dev, EV_KEY, keycode, !0); | 116 | input_event(input_dev, EV_KEY, keycode, !0); |
117 | } else | 117 | } else |
118 | input_event(&input_dev, EV_KEY, keycode, 2); | 118 | input_event(input_dev, EV_KEY, keycode, 2); |
119 | 119 | ||
120 | } else | 120 | } else |
121 | input_event(&input_dev, EV_KEY, keycode, !0); | 121 | input_event(input_dev, EV_KEY, keycode, !0); |
122 | 122 | ||
123 | keyup_timer.expires = jiffies + UP_TIMEOUT; | 123 | keyup_timer.expires = jiffies + UP_TIMEOUT; |
124 | keyup_timer.data = keycode; | 124 | keyup_timer.data = keycode; |
@@ -132,13 +132,13 @@ static void input_register_keys(void) | |||
132 | { | 132 | { |
133 | int i; | 133 | int i; |
134 | 134 | ||
135 | memset(input_dev.keybit, 0, sizeof(input_dev.keybit)); | 135 | memset(input_dev->keybit, 0, sizeof(input_dev->keybit)); |
136 | 136 | ||
137 | for (i = 0; i < sizeof(key_map) / sizeof(key_map[0]); i++) { | 137 | for (i = 0; i < ARRAY_SIZE(key_map); i++) { |
138 | if (key_map[i] > KEY_MAX) | 138 | if (key_map[i] > KEY_MAX) |
139 | key_map[i] = 0; | 139 | key_map[i] = 0; |
140 | else if (key_map[i] > KEY_RESERVED) | 140 | else if (key_map[i] > KEY_RESERVED) |
141 | set_bit(key_map[i], input_dev.keybit); | 141 | set_bit(key_map[i], input_dev->keybit); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
@@ -216,12 +216,17 @@ int __init av7110_ir_init(struct av7110 *av7110) | |||
216 | init_timer(&keyup_timer); | 216 | init_timer(&keyup_timer); |
217 | keyup_timer.data = 0; | 217 | keyup_timer.data = 0; |
218 | 218 | ||
219 | input_dev.name = "DVB on-card IR receiver"; | 219 | input_dev = input_allocate_device(); |
220 | set_bit(EV_KEY, input_dev.evbit); | 220 | if (!input_dev) |
221 | set_bit(EV_REP, input_dev.evbit); | 221 | return -ENOMEM; |
222 | |||
223 | input_dev->name = "DVB on-card IR receiver"; | ||
224 | |||
225 | set_bit(EV_KEY, input_dev->evbit); | ||
226 | set_bit(EV_REP, input_dev->evbit); | ||
222 | input_register_keys(); | 227 | input_register_keys(); |
223 | input_register_device(&input_dev); | 228 | input_register_device(input_dev); |
224 | input_dev.timer.function = input_repeat_key; | 229 | input_dev->timer.function = input_repeat_key; |
225 | 230 | ||
226 | e = create_proc_entry("av7110_ir", S_IFREG | S_IRUGO | S_IWUSR, NULL); | 231 | e = create_proc_entry("av7110_ir", S_IFREG | S_IRUGO | S_IWUSR, NULL); |
227 | if (e) { | 232 | if (e) { |
@@ -256,7 +261,7 @@ void __exit av7110_ir_exit(struct av7110 *av7110) | |||
256 | if (av_cnt == 1) { | 261 | if (av_cnt == 1) { |
257 | del_timer_sync(&keyup_timer); | 262 | del_timer_sync(&keyup_timer); |
258 | remove_proc_entry("av7110_ir", NULL); | 263 | remove_proc_entry("av7110_ir", NULL); |
259 | input_unregister_device(&input_dev); | 264 | input_unregister_device(input_dev); |
260 | } | 265 | } |
261 | 266 | ||
262 | av_cnt--; | 267 | av_cnt--; |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 2980db3ef22f..51c30ba68140 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | struct budget_ci { | 65 | struct budget_ci { |
66 | struct budget budget; | 66 | struct budget budget; |
67 | struct input_dev input_dev; | 67 | struct input_dev *input_dev; |
68 | struct tasklet_struct msp430_irq_tasklet; | 68 | struct tasklet_struct msp430_irq_tasklet; |
69 | struct tasklet_struct ciintf_irq_tasklet; | 69 | struct tasklet_struct ciintf_irq_tasklet; |
70 | int slot_status; | 70 | int slot_status; |
@@ -145,7 +145,7 @@ static void msp430_ir_debounce(unsigned long data) | |||
145 | static void msp430_ir_interrupt(unsigned long data) | 145 | static void msp430_ir_interrupt(unsigned long data) |
146 | { | 146 | { |
147 | struct budget_ci *budget_ci = (struct budget_ci *) data; | 147 | struct budget_ci *budget_ci = (struct budget_ci *) data; |
148 | struct input_dev *dev = &budget_ci->input_dev; | 148 | struct input_dev *dev = budget_ci->input_dev; |
149 | unsigned int code = | 149 | unsigned int code = |
150 | ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8; | 150 | ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8; |
151 | 151 | ||
@@ -181,25 +181,27 @@ static void msp430_ir_interrupt(unsigned long data) | |||
181 | static int msp430_ir_init(struct budget_ci *budget_ci) | 181 | static int msp430_ir_init(struct budget_ci *budget_ci) |
182 | { | 182 | { |
183 | struct saa7146_dev *saa = budget_ci->budget.dev; | 183 | struct saa7146_dev *saa = budget_ci->budget.dev; |
184 | struct input_dev *input_dev; | ||
184 | int i; | 185 | int i; |
185 | 186 | ||
186 | memset(&budget_ci->input_dev, 0, sizeof(struct input_dev)); | 187 | budget_ci->input_dev = input_dev = input_allocate_device(); |
188 | if (!input_dev) | ||
189 | return -ENOMEM; | ||
187 | 190 | ||
188 | sprintf(budget_ci->ir_dev_name, "Budget-CI dvb ir receiver %s", saa->name); | 191 | sprintf(budget_ci->ir_dev_name, "Budget-CI dvb ir receiver %s", saa->name); |
189 | budget_ci->input_dev.name = budget_ci->ir_dev_name; | ||
190 | 192 | ||
191 | set_bit(EV_KEY, budget_ci->input_dev.evbit); | 193 | input_dev->name = budget_ci->ir_dev_name; |
192 | 194 | ||
193 | for (i = 0; i < sizeof(key_map) / sizeof(*key_map); i++) | 195 | set_bit(EV_KEY, input_dev->evbit); |
196 | for (i = 0; i < ARRAY_SIZE(key_map); i++) | ||
194 | if (key_map[i]) | 197 | if (key_map[i]) |
195 | set_bit(key_map[i], budget_ci->input_dev.keybit); | 198 | set_bit(key_map[i], input_dev->keybit); |
196 | 199 | ||
197 | input_register_device(&budget_ci->input_dev); | 200 | input_register_device(budget_ci->input_dev); |
198 | 201 | ||
199 | budget_ci->input_dev.timer.function = msp430_ir_debounce; | 202 | input_dev->timer.function = msp430_ir_debounce; |
200 | 203 | ||
201 | saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_06); | 204 | saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_06); |
202 | |||
203 | saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI); | 205 | saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI); |
204 | 206 | ||
205 | return 0; | 207 | return 0; |
@@ -208,7 +210,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
208 | static void msp430_ir_deinit(struct budget_ci *budget_ci) | 210 | static void msp430_ir_deinit(struct budget_ci *budget_ci) |
209 | { | 211 | { |
210 | struct saa7146_dev *saa = budget_ci->budget.dev; | 212 | struct saa7146_dev *saa = budget_ci->budget.dev; |
211 | struct input_dev *dev = &budget_ci->input_dev; | 213 | struct input_dev *dev = budget_ci->input_dev; |
212 | 214 | ||
213 | saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_06); | 215 | saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_06); |
214 | saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); | 216 | saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); |
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 3d08fc83a754..832d179f26fa 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c | |||
@@ -152,7 +152,8 @@ struct ttusb_dec { | |||
152 | struct list_head filter_info_list; | 152 | struct list_head filter_info_list; |
153 | spinlock_t filter_info_list_lock; | 153 | spinlock_t filter_info_list_lock; |
154 | 154 | ||
155 | struct input_dev rc_input_dev; | 155 | struct input_dev *rc_input_dev; |
156 | char rc_phys[64]; | ||
156 | 157 | ||
157 | int active; /* Loaded successfully */ | 158 | int active; /* Loaded successfully */ |
158 | }; | 159 | }; |
@@ -235,9 +236,9 @@ static void ttusb_dec_handle_irq( struct urb *urb, struct pt_regs *regs) | |||
235 | * this should/could be added later ... | 236 | * this should/could be added later ... |
236 | * for now lets report each signal as a key down and up*/ | 237 | * for now lets report each signal as a key down and up*/ |
237 | dprintk("%s:rc signal:%d\n", __FUNCTION__, buffer[4]); | 238 | dprintk("%s:rc signal:%d\n", __FUNCTION__, buffer[4]); |
238 | input_report_key(&dec->rc_input_dev,rc_keys[buffer[4]-1],1); | 239 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1); |
239 | input_report_key(&dec->rc_input_dev,rc_keys[buffer[4]-1],0); | 240 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0); |
240 | input_sync(&dec->rc_input_dev); | 241 | input_sync(dec->rc_input_dev); |
241 | } | 242 | } |
242 | 243 | ||
243 | exit: retval = usb_submit_urb(urb, GFP_ATOMIC); | 244 | exit: retval = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -1181,29 +1182,38 @@ static void ttusb_dec_init_tasklet(struct ttusb_dec *dec) | |||
1181 | (unsigned long)dec); | 1182 | (unsigned long)dec); |
1182 | } | 1183 | } |
1183 | 1184 | ||
1184 | static void ttusb_init_rc( struct ttusb_dec *dec) | 1185 | static int ttusb_init_rc(struct ttusb_dec *dec) |
1185 | { | 1186 | { |
1187 | struct input_dev *input_dev; | ||
1186 | u8 b[] = { 0x00, 0x01 }; | 1188 | u8 b[] = { 0x00, 0x01 }; |
1187 | int i; | 1189 | int i; |
1188 | 1190 | ||
1189 | init_input_dev(&dec->rc_input_dev); | 1191 | usb_make_path(dec->udev, dec->rc_phys, sizeof(dec->rc_phys)); |
1192 | strlcpy(dec->rc_phys, "/input0", sizeof(dec->rc_phys)); | ||
1190 | 1193 | ||
1191 | dec->rc_input_dev.name = "ttusb_dec remote control"; | 1194 | dec->rc_input_dev = input_dev = input_allocate_device(); |
1192 | dec->rc_input_dev.evbit[0] = BIT(EV_KEY); | 1195 | if (!input_dev) |
1193 | dec->rc_input_dev.keycodesize = sizeof(u16); | 1196 | return -ENOMEM; |
1194 | dec->rc_input_dev.keycodemax = 0x1a; | 1197 | |
1195 | dec->rc_input_dev.keycode = rc_keys; | 1198 | input_dev->name = "ttusb_dec remote control"; |
1199 | input_dev->phys = dec->rc_phys; | ||
1200 | input_dev->evbit[0] = BIT(EV_KEY); | ||
1201 | input_dev->keycodesize = sizeof(u16); | ||
1202 | input_dev->keycodemax = 0x1a; | ||
1203 | input_dev->keycode = rc_keys; | ||
1196 | 1204 | ||
1197 | for (i = 0; i < sizeof(rc_keys)/sizeof(rc_keys[0]); i++) | 1205 | for (i = 0; i < ARRAY_SIZE(rc_keys); i++) |
1198 | set_bit(rc_keys[i], dec->rc_input_dev.keybit); | 1206 | set_bit(rc_keys[i], input_dev->keybit); |
1199 | 1207 | ||
1200 | input_register_device(&dec->rc_input_dev); | 1208 | input_register_device(input_dev); |
1201 | 1209 | ||
1202 | if(usb_submit_urb(dec->irq_urb,GFP_KERNEL)) { | 1210 | if (usb_submit_urb(dec->irq_urb, GFP_KERNEL)) |
1203 | printk("%s: usb_submit_urb failed\n",__FUNCTION__); | 1211 | printk("%s: usb_submit_urb failed\n",__FUNCTION__); |
1204 | } | 1212 | |
1205 | /* enable irq pipe */ | 1213 | /* enable irq pipe */ |
1206 | ttusb_dec_send_command(dec,0xb0,sizeof(b),b,NULL,NULL); | 1214 | ttusb_dec_send_command(dec,0xb0,sizeof(b),b,NULL,NULL); |
1215 | |||
1216 | return 0; | ||
1207 | } | 1217 | } |
1208 | 1218 | ||
1209 | static void ttusb_dec_init_v_pes(struct ttusb_dec *dec) | 1219 | static void ttusb_dec_init_v_pes(struct ttusb_dec *dec) |
@@ -1513,7 +1523,7 @@ static void ttusb_dec_exit_rc(struct ttusb_dec *dec) | |||
1513 | * As the irq is submitted after the interface is changed, | 1523 | * As the irq is submitted after the interface is changed, |
1514 | * this is the best method i figured out. | 1524 | * this is the best method i figured out. |
1515 | * Any others?*/ | 1525 | * Any others?*/ |
1516 | if(dec->interface == TTUSB_DEC_INTERFACE_IN) | 1526 | if (dec->interface == TTUSB_DEC_INTERFACE_IN) |
1517 | usb_kill_urb(dec->irq_urb); | 1527 | usb_kill_urb(dec->irq_urb); |
1518 | 1528 | ||
1519 | usb_free_urb(dec->irq_urb); | 1529 | usb_free_urb(dec->irq_urb); |
@@ -1521,7 +1531,10 @@ static void ttusb_dec_exit_rc(struct ttusb_dec *dec) | |||
1521 | usb_buffer_free(dec->udev,IRQ_PACKET_SIZE, | 1531 | usb_buffer_free(dec->udev,IRQ_PACKET_SIZE, |
1522 | dec->irq_buffer, dec->irq_dma_handle); | 1532 | dec->irq_buffer, dec->irq_dma_handle); |
1523 | 1533 | ||
1524 | input_unregister_device(&dec->rc_input_dev); | 1534 | if (dec->rc_input_dev) { |
1535 | input_unregister_device(dec->rc_input_dev); | ||
1536 | dec->rc_input_dev = NULL; | ||
1537 | } | ||
1525 | } | 1538 | } |
1526 | 1539 | ||
1527 | 1540 | ||
@@ -1659,7 +1672,7 @@ static int ttusb_dec_probe(struct usb_interface *intf, | |||
1659 | 1672 | ||
1660 | ttusb_dec_set_interface(dec, TTUSB_DEC_INTERFACE_IN); | 1673 | ttusb_dec_set_interface(dec, TTUSB_DEC_INTERFACE_IN); |
1661 | 1674 | ||
1662 | if(enable_rc) | 1675 | if (enable_rc) |
1663 | ttusb_init_rc(dec); | 1676 | ttusb_init_rc(dec); |
1664 | 1677 | ||
1665 | return 0; | 1678 | return 0; |
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index 7a312f79340a..e0e7c7a84bc5 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h | |||
@@ -240,7 +240,7 @@ struct bttv_pll_info { | |||
240 | 240 | ||
241 | /* for gpio-connected remote control */ | 241 | /* for gpio-connected remote control */ |
242 | struct bttv_input { | 242 | struct bttv_input { |
243 | struct input_dev dev; | 243 | struct input_dev *dev; |
244 | struct ir_input_state ir; | 244 | struct ir_input_state ir; |
245 | char name[32]; | 245 | char name[32]; |
246 | char phys[32]; | 246 | char phys[32]; |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index d81b21d6e05d..c27fe4c36f69 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -260,7 +260,7 @@ static IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE] = { | |||
260 | 260 | ||
261 | struct cx88_IR { | 261 | struct cx88_IR { |
262 | struct cx88_core *core; | 262 | struct cx88_core *core; |
263 | struct input_dev input; | 263 | struct input_dev *input; |
264 | struct ir_input_state ir; | 264 | struct ir_input_state ir; |
265 | char name[32]; | 265 | char name[32]; |
266 | char phys[32]; | 266 | char phys[32]; |
@@ -315,23 +315,23 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) | |||
315 | if (ir->mask_keydown) { | 315 | if (ir->mask_keydown) { |
316 | /* bit set on keydown */ | 316 | /* bit set on keydown */ |
317 | if (gpio & ir->mask_keydown) { | 317 | if (gpio & ir->mask_keydown) { |
318 | ir_input_keydown(&ir->input, &ir->ir, data, data); | 318 | ir_input_keydown(ir->input, &ir->ir, data, data); |
319 | } else { | 319 | } else { |
320 | ir_input_nokey(&ir->input, &ir->ir); | 320 | ir_input_nokey(ir->input, &ir->ir); |
321 | } | 321 | } |
322 | 322 | ||
323 | } else if (ir->mask_keyup) { | 323 | } else if (ir->mask_keyup) { |
324 | /* bit cleared on keydown */ | 324 | /* bit cleared on keydown */ |
325 | if (0 == (gpio & ir->mask_keyup)) { | 325 | if (0 == (gpio & ir->mask_keyup)) { |
326 | ir_input_keydown(&ir->input, &ir->ir, data, data); | 326 | ir_input_keydown(ir->input, &ir->ir, data, data); |
327 | } else { | 327 | } else { |
328 | ir_input_nokey(&ir->input, &ir->ir); | 328 | ir_input_nokey(ir->input, &ir->ir); |
329 | } | 329 | } |
330 | 330 | ||
331 | } else { | 331 | } else { |
332 | /* can't distinguish keydown/up :-/ */ | 332 | /* can't distinguish keydown/up :-/ */ |
333 | ir_input_keydown(&ir->input, &ir->ir, data, data); | 333 | ir_input_keydown(ir->input, &ir->ir, data, data); |
334 | ir_input_nokey(&ir->input, &ir->ir); | 334 | ir_input_nokey(ir->input, &ir->ir); |
335 | } | 335 | } |
336 | } | 336 | } |
337 | 337 | ||
@@ -357,13 +357,19 @@ static void cx88_ir_work(void *data) | |||
357 | int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | 357 | int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) |
358 | { | 358 | { |
359 | struct cx88_IR *ir; | 359 | struct cx88_IR *ir; |
360 | struct input_dev *input_dev; | ||
360 | IR_KEYTAB_TYPE *ir_codes = NULL; | 361 | IR_KEYTAB_TYPE *ir_codes = NULL; |
361 | int ir_type = IR_TYPE_OTHER; | 362 | int ir_type = IR_TYPE_OTHER; |
362 | 363 | ||
363 | ir = kmalloc(sizeof(*ir), GFP_KERNEL); | 364 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
364 | if (NULL == ir) | 365 | input_dev = input_allocate_device(); |
366 | if (!ir || !input_dev) { | ||
367 | kfree(ir); | ||
368 | input_free_device(input_dev); | ||
365 | return -ENOMEM; | 369 | return -ENOMEM; |
366 | memset(ir, 0, sizeof(*ir)); | 370 | } |
371 | |||
372 | ir->input = input_dev; | ||
367 | 373 | ||
368 | /* detect & configure */ | 374 | /* detect & configure */ |
369 | switch (core->board) { | 375 | switch (core->board) { |
@@ -425,6 +431,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
425 | 431 | ||
426 | if (NULL == ir_codes) { | 432 | if (NULL == ir_codes) { |
427 | kfree(ir); | 433 | kfree(ir); |
434 | input_free_device(input_dev); | ||
428 | return -ENODEV; | 435 | return -ENODEV; |
429 | } | 436 | } |
430 | 437 | ||
@@ -433,19 +440,19 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
433 | cx88_boards[core->board].name); | 440 | cx88_boards[core->board].name); |
434 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); | 441 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); |
435 | 442 | ||
436 | ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); | 443 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
437 | ir->input.name = ir->name; | 444 | input_dev->name = ir->name; |
438 | ir->input.phys = ir->phys; | 445 | input_dev->phys = ir->phys; |
439 | ir->input.id.bustype = BUS_PCI; | 446 | input_dev->id.bustype = BUS_PCI; |
440 | ir->input.id.version = 1; | 447 | input_dev->id.version = 1; |
441 | if (pci->subsystem_vendor) { | 448 | if (pci->subsystem_vendor) { |
442 | ir->input.id.vendor = pci->subsystem_vendor; | 449 | input_dev->id.vendor = pci->subsystem_vendor; |
443 | ir->input.id.product = pci->subsystem_device; | 450 | input_dev->id.product = pci->subsystem_device; |
444 | } else { | 451 | } else { |
445 | ir->input.id.vendor = pci->vendor; | 452 | input_dev->id.vendor = pci->vendor; |
446 | ir->input.id.product = pci->device; | 453 | input_dev->id.product = pci->device; |
447 | } | 454 | } |
448 | ir->input.dev = &pci->dev; | 455 | input_dev->cdev.dev = &pci->dev; |
449 | 456 | ||
450 | /* record handles to ourself */ | 457 | /* record handles to ourself */ |
451 | ir->core = core; | 458 | ir->core = core; |
@@ -465,8 +472,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
465 | } | 472 | } |
466 | 473 | ||
467 | /* all done */ | 474 | /* all done */ |
468 | input_register_device(&ir->input); | 475 | input_register_device(ir->input); |
469 | printk("%s: registered IR remote control\n", core->name); | ||
470 | 476 | ||
471 | return 0; | 477 | return 0; |
472 | } | 478 | } |
@@ -484,7 +490,7 @@ int cx88_ir_fini(struct cx88_core *core) | |||
484 | flush_scheduled_work(); | 490 | flush_scheduled_work(); |
485 | } | 491 | } |
486 | 492 | ||
487 | input_unregister_device(&ir->input); | 493 | input_unregister_device(ir->input); |
488 | kfree(ir); | 494 | kfree(ir); |
489 | 495 | ||
490 | /* done */ | 496 | /* done */ |
@@ -515,7 +521,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
515 | if (!ir->scount) { | 521 | if (!ir->scount) { |
516 | /* nothing to sample */ | 522 | /* nothing to sample */ |
517 | if (ir->ir.keypressed && time_after(jiffies, ir->release)) | 523 | if (ir->ir.keypressed && time_after(jiffies, ir->release)) |
518 | ir_input_nokey(&ir->input, &ir->ir); | 524 | ir_input_nokey(ir->input, &ir->ir); |
519 | return; | 525 | return; |
520 | } | 526 | } |
521 | 527 | ||
@@ -557,7 +563,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
557 | 563 | ||
558 | ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f); | 564 | ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f); |
559 | 565 | ||
560 | ir_input_keydown(&ir->input, &ir->ir, (ircode >> 16) & 0x7f, (ircode >> 16) & 0xff); | 566 | ir_input_keydown(ir->input, &ir->ir, (ircode >> 16) & 0x7f, (ircode >> 16) & 0xff); |
561 | ir->release = jiffies + msecs_to_jiffies(120); | 567 | ir->release = jiffies + msecs_to_jiffies(120); |
562 | break; | 568 | break; |
563 | case CX88_BOARD_HAUPPAUGE: | 569 | case CX88_BOARD_HAUPPAUGE: |
@@ -566,7 +572,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
566 | ir_dprintk("biphase decoded: %x\n", ircode); | 572 | ir_dprintk("biphase decoded: %x\n", ircode); |
567 | if ((ircode & 0xfffff000) != 0x3000) | 573 | if ((ircode & 0xfffff000) != 0x3000) |
568 | break; | 574 | break; |
569 | ir_input_keydown(&ir->input, &ir->ir, ircode & 0x3f, ircode); | 575 | ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f, ircode); |
570 | ir->release = jiffies + msecs_to_jiffies(120); | 576 | ir->release = jiffies + msecs_to_jiffies(120); |
571 | break; | 577 | break; |
572 | } | 578 | } |
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index cf292da8fdd5..234151e48edc 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c | |||
@@ -158,7 +158,7 @@ static IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { | |||
158 | 158 | ||
159 | struct IR { | 159 | struct IR { |
160 | struct bttv_sub_device *sub; | 160 | struct bttv_sub_device *sub; |
161 | struct input_dev input; | 161 | struct input_dev *input; |
162 | struct ir_input_state ir; | 162 | struct ir_input_state ir; |
163 | char name[32]; | 163 | char name[32]; |
164 | char phys[32]; | 164 | char phys[32]; |
@@ -217,23 +217,23 @@ static void ir_handle_key(struct IR *ir) | |||
217 | if (ir->mask_keydown) { | 217 | if (ir->mask_keydown) { |
218 | /* bit set on keydown */ | 218 | /* bit set on keydown */ |
219 | if (gpio & ir->mask_keydown) { | 219 | if (gpio & ir->mask_keydown) { |
220 | ir_input_keydown(&ir->input,&ir->ir,data,data); | 220 | ir_input_keydown(ir->input, &ir->ir, data, data); |
221 | } else { | 221 | } else { |
222 | ir_input_nokey(&ir->input,&ir->ir); | 222 | ir_input_nokey(ir->input, &ir->ir); |
223 | } | 223 | } |
224 | 224 | ||
225 | } else if (ir->mask_keyup) { | 225 | } else if (ir->mask_keyup) { |
226 | /* bit cleared on keydown */ | 226 | /* bit cleared on keydown */ |
227 | if (0 == (gpio & ir->mask_keyup)) { | 227 | if (0 == (gpio & ir->mask_keyup)) { |
228 | ir_input_keydown(&ir->input,&ir->ir,data,data); | 228 | ir_input_keydown(ir->input, &ir->ir, data, data); |
229 | } else { | 229 | } else { |
230 | ir_input_nokey(&ir->input,&ir->ir); | 230 | ir_input_nokey(ir->input, &ir->ir); |
231 | } | 231 | } |
232 | 232 | ||
233 | } else { | 233 | } else { |
234 | /* can't disturgissh keydown/up :-/ */ | 234 | /* can't disturgissh keydown/up :-/ */ |
235 | ir_input_keydown(&ir->input,&ir->ir,data,data); | 235 | ir_input_keydown(ir->input, &ir->ir, data, data); |
236 | ir_input_nokey(&ir->input,&ir->ir); | 236 | ir_input_nokey(ir->input, &ir->ir); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
@@ -268,13 +268,17 @@ static int ir_probe(struct device *dev) | |||
268 | { | 268 | { |
269 | struct bttv_sub_device *sub = to_bttv_sub_dev(dev); | 269 | struct bttv_sub_device *sub = to_bttv_sub_dev(dev); |
270 | struct IR *ir; | 270 | struct IR *ir; |
271 | struct input_dev *input_dev; | ||
271 | IR_KEYTAB_TYPE *ir_codes = NULL; | 272 | IR_KEYTAB_TYPE *ir_codes = NULL; |
272 | int ir_type = IR_TYPE_OTHER; | 273 | int ir_type = IR_TYPE_OTHER; |
273 | 274 | ||
274 | ir = kmalloc(sizeof(*ir),GFP_KERNEL); | 275 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
275 | if (NULL == ir) | 276 | input_dev = input_allocate_device(); |
277 | if (!ir || !input_dev) { | ||
278 | kfree(ir); | ||
279 | input_free_device(input_dev); | ||
276 | return -ENOMEM; | 280 | return -ENOMEM; |
277 | memset(ir,0,sizeof(*ir)); | 281 | } |
278 | 282 | ||
279 | /* detect & configure */ | 283 | /* detect & configure */ |
280 | switch (sub->core->type) { | 284 | switch (sub->core->type) { |
@@ -328,6 +332,7 @@ static int ir_probe(struct device *dev) | |||
328 | } | 332 | } |
329 | if (NULL == ir_codes) { | 333 | if (NULL == ir_codes) { |
330 | kfree(ir); | 334 | kfree(ir); |
335 | input_free_device(input_dev); | ||
331 | return -ENODEV; | 336 | return -ENODEV; |
332 | } | 337 | } |
333 | 338 | ||
@@ -341,19 +346,19 @@ static int ir_probe(struct device *dev) | |||
341 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | 346 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", |
342 | pci_name(sub->core->pci)); | 347 | pci_name(sub->core->pci)); |
343 | 348 | ||
344 | ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); | 349 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
345 | ir->input.name = ir->name; | 350 | input_dev->name = ir->name; |
346 | ir->input.phys = ir->phys; | 351 | input_dev->phys = ir->phys; |
347 | ir->input.id.bustype = BUS_PCI; | 352 | input_dev->id.bustype = BUS_PCI; |
348 | ir->input.id.version = 1; | 353 | input_dev->id.version = 1; |
349 | if (sub->core->pci->subsystem_vendor) { | 354 | if (sub->core->pci->subsystem_vendor) { |
350 | ir->input.id.vendor = sub->core->pci->subsystem_vendor; | 355 | input_dev->id.vendor = sub->core->pci->subsystem_vendor; |
351 | ir->input.id.product = sub->core->pci->subsystem_device; | 356 | input_dev->id.product = sub->core->pci->subsystem_device; |
352 | } else { | 357 | } else { |
353 | ir->input.id.vendor = sub->core->pci->vendor; | 358 | input_dev->id.vendor = sub->core->pci->vendor; |
354 | ir->input.id.product = sub->core->pci->device; | 359 | input_dev->id.product = sub->core->pci->device; |
355 | } | 360 | } |
356 | ir->input.dev = &sub->core->pci->dev; | 361 | input_dev->cdev.dev = &sub->core->pci->dev; |
357 | 362 | ||
358 | if (ir->polling) { | 363 | if (ir->polling) { |
359 | INIT_WORK(&ir->work, ir_work, ir); | 364 | INIT_WORK(&ir->work, ir_work, ir); |
@@ -364,9 +369,8 @@ static int ir_probe(struct device *dev) | |||
364 | } | 369 | } |
365 | 370 | ||
366 | /* all done */ | 371 | /* all done */ |
367 | dev_set_drvdata(dev,ir); | 372 | dev_set_drvdata(dev, ir); |
368 | input_register_device(&ir->input); | 373 | input_register_device(ir->input); |
369 | printk(DEVNAME ": %s detected at %s\n",ir->input.name,ir->input.phys); | ||
370 | 374 | ||
371 | return 0; | 375 | return 0; |
372 | } | 376 | } |
@@ -380,7 +384,7 @@ static int ir_remove(struct device *dev) | |||
380 | flush_scheduled_work(); | 384 | flush_scheduled_work(); |
381 | } | 385 | } |
382 | 386 | ||
383 | input_unregister_device(&ir->input); | 387 | input_unregister_device(ir->input); |
384 | kfree(ir); | 388 | kfree(ir); |
385 | return 0; | 389 | return 0; |
386 | } | 390 | } |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 67105b9804a2..9703d3d351f9 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -121,10 +121,9 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { | |||
121 | 121 | ||
122 | }; | 122 | }; |
123 | 123 | ||
124 | struct IR; | ||
125 | struct IR { | 124 | struct IR { |
126 | struct i2c_client c; | 125 | struct i2c_client c; |
127 | struct input_dev input; | 126 | struct input_dev *input; |
128 | struct ir_input_state ir; | 127 | struct ir_input_state ir; |
129 | 128 | ||
130 | struct work_struct work; | 129 | struct work_struct work; |
@@ -271,9 +270,9 @@ static void ir_key_poll(struct IR *ir) | |||
271 | } | 270 | } |
272 | 271 | ||
273 | if (0 == rc) { | 272 | if (0 == rc) { |
274 | ir_input_nokey(&ir->input,&ir->ir); | 273 | ir_input_nokey(ir->input, &ir->ir); |
275 | } else { | 274 | } else { |
276 | ir_input_keydown(&ir->input,&ir->ir, ir_key, ir_raw); | 275 | ir_input_keydown(ir->input, &ir->ir, ir_key, ir_raw); |
277 | } | 276 | } |
278 | } | 277 | } |
279 | 278 | ||
@@ -318,11 +317,18 @@ static int ir_attach(struct i2c_adapter *adap, int addr, | |||
318 | char *name; | 317 | char *name; |
319 | int ir_type; | 318 | int ir_type; |
320 | struct IR *ir; | 319 | struct IR *ir; |
320 | struct input_dev *input_dev; | ||
321 | 321 | ||
322 | if (NULL == (ir = kmalloc(sizeof(struct IR),GFP_KERNEL))) | 322 | ir = kzalloc(sizeof(struct IR), GFP_KERNEL); |
323 | input_dev = input_allocate_device(); | ||
324 | if (!ir || !input_dev) { | ||
325 | kfree(ir); | ||
326 | input_free_device(input_dev); | ||
323 | return -ENOMEM; | 327 | return -ENOMEM; |
324 | memset(ir,0,sizeof(*ir)); | 328 | } |
329 | |||
325 | ir->c = client_template; | 330 | ir->c = client_template; |
331 | ir->input = input_dev; | ||
326 | 332 | ||
327 | i2c_set_clientdata(&ir->c, ir); | 333 | i2c_set_clientdata(&ir->c, ir); |
328 | ir->c.adapter = adap; | 334 | ir->c.adapter = adap; |
@@ -375,13 +381,12 @@ static int ir_attach(struct i2c_adapter *adap, int addr, | |||
375 | ir->c.dev.bus_id); | 381 | ir->c.dev.bus_id); |
376 | 382 | ||
377 | /* init + register input device */ | 383 | /* init + register input device */ |
378 | ir_input_init(&ir->input,&ir->ir,ir_type,ir_codes); | 384 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
379 | ir->input.id.bustype = BUS_I2C; | 385 | input_dev->id.bustype = BUS_I2C; |
380 | ir->input.name = ir->c.name; | 386 | input_dev->name = ir->c.name; |
381 | ir->input.phys = ir->phys; | 387 | input_dev->phys = ir->phys; |
382 | input_register_device(&ir->input); | 388 | |
383 | printk(DEVNAME ": %s detected at %s [%s]\n", | 389 | input_register_device(ir->input); |
384 | ir->input.name,ir->input.phys,adap->name); | ||
385 | 390 | ||
386 | /* start polling via eventd */ | 391 | /* start polling via eventd */ |
387 | INIT_WORK(&ir->work, ir_work, ir); | 392 | INIT_WORK(&ir->work, ir_work, ir); |
@@ -402,7 +407,7 @@ static int ir_detach(struct i2c_client *client) | |||
402 | flush_scheduled_work(); | 407 | flush_scheduled_work(); |
403 | 408 | ||
404 | /* unregister devices */ | 409 | /* unregister devices */ |
405 | input_unregister_device(&ir->input); | 410 | input_unregister_device(ir->input); |
406 | i2c_detach_client(&ir->c); | 411 | i2c_detach_client(&ir->c); |
407 | 412 | ||
408 | /* free memory */ | 413 | /* free memory */ |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 1f456c4d76f2..242cb235cf92 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -425,9 +425,9 @@ static int build_key(struct saa7134_dev *dev) | |||
425 | 425 | ||
426 | if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || | 426 | if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || |
427 | (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { | 427 | (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { |
428 | ir_input_keydown(&ir->dev,&ir->ir,data,data); | 428 | ir_input_keydown(ir->dev, &ir->ir, data, data); |
429 | } else { | 429 | } else { |
430 | ir_input_nokey(&ir->dev,&ir->ir); | 430 | ir_input_nokey(ir->dev, &ir->ir); |
431 | } | 431 | } |
432 | return 0; | 432 | return 0; |
433 | } | 433 | } |
@@ -456,6 +456,7 @@ static void saa7134_input_timer(unsigned long data) | |||
456 | int saa7134_input_init1(struct saa7134_dev *dev) | 456 | int saa7134_input_init1(struct saa7134_dev *dev) |
457 | { | 457 | { |
458 | struct saa7134_ir *ir; | 458 | struct saa7134_ir *ir; |
459 | struct input_dev *input_dev; | ||
459 | IR_KEYTAB_TYPE *ir_codes = NULL; | 460 | IR_KEYTAB_TYPE *ir_codes = NULL; |
460 | u32 mask_keycode = 0; | 461 | u32 mask_keycode = 0; |
461 | u32 mask_keydown = 0; | 462 | u32 mask_keydown = 0; |
@@ -535,10 +536,13 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
535 | return -ENODEV; | 536 | return -ENODEV; |
536 | } | 537 | } |
537 | 538 | ||
538 | ir = kmalloc(sizeof(*ir),GFP_KERNEL); | 539 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
539 | if (NULL == ir) | 540 | input_dev = input_allocate_device(); |
541 | if (!ir || !input_dev) { | ||
542 | kfree(ir); | ||
543 | input_free_device(input_dev); | ||
540 | return -ENOMEM; | 544 | return -ENOMEM; |
541 | memset(ir,0,sizeof(*ir)); | 545 | } |
542 | 546 | ||
543 | /* init hardware-specific stuff */ | 547 | /* init hardware-specific stuff */ |
544 | ir->mask_keycode = mask_keycode; | 548 | ir->mask_keycode = mask_keycode; |
@@ -552,19 +556,19 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
552 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | 556 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", |
553 | pci_name(dev->pci)); | 557 | pci_name(dev->pci)); |
554 | 558 | ||
555 | ir_input_init(&ir->dev, &ir->ir, ir_type, ir_codes); | 559 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
556 | ir->dev.name = ir->name; | 560 | input_dev->name = ir->name; |
557 | ir->dev.phys = ir->phys; | 561 | input_dev->phys = ir->phys; |
558 | ir->dev.id.bustype = BUS_PCI; | 562 | input_dev->id.bustype = BUS_PCI; |
559 | ir->dev.id.version = 1; | 563 | input_dev->id.version = 1; |
560 | if (dev->pci->subsystem_vendor) { | 564 | if (dev->pci->subsystem_vendor) { |
561 | ir->dev.id.vendor = dev->pci->subsystem_vendor; | 565 | input_dev->id.vendor = dev->pci->subsystem_vendor; |
562 | ir->dev.id.product = dev->pci->subsystem_device; | 566 | input_dev->id.product = dev->pci->subsystem_device; |
563 | } else { | 567 | } else { |
564 | ir->dev.id.vendor = dev->pci->vendor; | 568 | input_dev->id.vendor = dev->pci->vendor; |
565 | ir->dev.id.product = dev->pci->device; | 569 | input_dev->id.product = dev->pci->device; |
566 | } | 570 | } |
567 | ir->dev.dev = &dev->pci->dev; | 571 | input_dev->cdev.dev = &dev->pci->dev; |
568 | 572 | ||
569 | /* all done */ | 573 | /* all done */ |
570 | dev->remote = ir; | 574 | dev->remote = ir; |
@@ -576,8 +580,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
576 | add_timer(&ir->timer); | 580 | add_timer(&ir->timer); |
577 | } | 581 | } |
578 | 582 | ||
579 | input_register_device(&dev->remote->dev); | 583 | input_register_device(ir->dev); |
580 | printk("%s: registered input device for IR\n",dev->name); | ||
581 | return 0; | 584 | return 0; |
582 | } | 585 | } |
583 | 586 | ||
@@ -586,9 +589,9 @@ void saa7134_input_fini(struct saa7134_dev *dev) | |||
586 | if (NULL == dev->remote) | 589 | if (NULL == dev->remote) |
587 | return; | 590 | return; |
588 | 591 | ||
589 | input_unregister_device(&dev->remote->dev); | ||
590 | if (dev->remote->polling) | 592 | if (dev->remote->polling) |
591 | del_timer_sync(&dev->remote->timer); | 593 | del_timer_sync(&dev->remote->timer); |
594 | input_unregister_device(dev->remote->dev); | ||
592 | kfree(dev->remote); | 595 | kfree(dev->remote); |
593 | dev->remote = NULL; | 596 | dev->remote = NULL; |
594 | } | 597 | } |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 3ea09142ec9c..860b89530e2a 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -351,7 +351,7 @@ struct saa7134_oss { | |||
351 | 351 | ||
352 | /* IR input */ | 352 | /* IR input */ |
353 | struct saa7134_ir { | 353 | struct saa7134_ir { |
354 | struct input_dev dev; | 354 | struct input_dev *dev; |
355 | struct ir_input_state ir; | 355 | struct ir_input_state ir; |
356 | char name[32]; | 356 | char name[32]; |
357 | char phys[32]; | 357 | char phys[32]; |