aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/common/ir-common.c2
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c108
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ca_en50221.c1
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c2
-rw-r--r--drivers/media/dvb/dvb-usb/dtt200u.c4
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c50
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h3
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045.c2
-rw-r--r--drivers/media/dvb/frontends/bcm3510.c3
-rw-r--r--drivers/media/dvb/frontends/dib3000mb.c2
-rw-r--r--drivers/media/dvb/frontends/dib3000mc.c2
-rw-r--r--drivers/media/dvb/frontends/dvb_dummy_fe.c2
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.c2
-rw-r--r--drivers/media/dvb/frontends/mt312.c2
-rw-r--r--drivers/media/dvb/frontends/mt352.c2
-rw-r--r--drivers/media/dvb/frontends/nxt2002.c2
-rw-r--r--drivers/media/dvb/frontends/or51132.c2
-rw-r--r--drivers/media/dvb/frontends/or51211.c2
-rw-r--r--drivers/media/dvb/frontends/s5h1420.c2
-rw-r--r--drivers/media/dvb/frontends/sp8870.c2
-rw-r--r--drivers/media/dvb/frontends/sp887x.c2
-rw-r--r--drivers/media/dvb/frontends/stv0297.c2
-rw-r--r--drivers/media/dvb/frontends/stv0299.c1
-rw-r--r--drivers/media/dvb/frontends/tda1004x.c4
-rw-r--r--drivers/media/dvb/frontends/tda8083.c1
-rw-r--r--drivers/media/dvb/ttpci/av7110_ir.c37
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c24
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusb_dec.c51
-rw-r--r--drivers/media/radio/miropcm20-rds.c1
-rw-r--r--drivers/media/video/bttvp.h2
-rw-r--r--drivers/media/video/cx88/cx88-input.c58
-rw-r--r--drivers/media/video/indycam.c10
-rw-r--r--drivers/media/video/ir-kbd-gpio.c52
-rw-r--r--drivers/media/video/ir-kbd-i2c.c33
-rw-r--r--drivers/media/video/msp3400.c8
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c39
-rw-r--r--drivers/media/video/saa7134/saa7134.h2
-rw-r--r--drivers/media/video/saa7191.c14
-rw-r--r--drivers/media/video/tda9887.c4
-rw-r--r--drivers/media/video/tuner-core.c4
-rw-r--r--drivers/media/video/vino.c7
41 files changed, 332 insertions, 221 deletions
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c
index a0e700d7a4a4..31fccb4f05d6 100644
--- a/drivers/media/common/ir-common.c
+++ b/drivers/media/common/ir-common.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/moduleparam.h> 24#include <linux/moduleparam.h>
25#include <linux/string.h>
25#include <media/ir-common.h> 26#include <media/ir-common.h>
26 27
27/* -------------------------------------------------------------------------- */ 28/* -------------------------------------------------------------------------- */
@@ -252,7 +253,6 @@ void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
252 if (ir_codes) 253 if (ir_codes)
253 memcpy(ir->ir_codes, ir_codes, sizeof(ir->ir_codes)); 254 memcpy(ir->ir_codes, ir_codes, sizeof(ir->ir_codes));
254 255
255 init_input_dev(dev);
256 dev->keycode = ir->ir_codes; 256 dev->keycode = ir->ir_codes;
257 dev->keycodesize = sizeof(IR_KEYTAB_TYPE); 257 dev->keycodesize = sizeof(IR_KEYTAB_TYPE);
258 dev->keycodemax = IR_KEYTAB_SIZE; 258 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
686static void cinergyt2_query_rc (void *data) 688static 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
758static 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
785static 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
792static inline void cinergyt2_suspend_rc(struct cinergyt2 *cinergyt2)
793{
794 cancel_delayed_work(&cinergyt2->rc_query_work);
795}
796
797static inline void cinergyt2_resume_rc(struct cinergyt2 *cinergyt2)
798{
799 schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2);
800}
801
802#else
803
804static inline int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) { return 0; }
805static inline void cinergyt2_unregister_rc(struct cinergyt2 *cinergyt2) { }
806static inline void cinergyt2_suspend_rc(struct cinergyt2 *cinergyt2) { }
807static inline void cinergyt2_resume_rc(struct cinergyt2 *cinergyt2) { }
808
809#endif /* ENABLE_RC */
756 810
757static void cinergyt2_query (void *data) 811static 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
868bailout: 906bailout:
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-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
index 88757e2634e5..2aa767f9bd7d 100644
--- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -36,6 +36,7 @@
36#include <linux/vmalloc.h> 36#include <linux/vmalloc.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/rwsem.h> 38#include <linux/rwsem.h>
39#include <linux/sched.h>
39 40
40#include "dvb_ca_en50221.h" 41#include "dvb_ca_en50221.h"
41#include "dvb_ringbuffer.h" 42#include "dvb_ringbuffer.h"
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 4b7adca3e286..477b4fa56430 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -235,7 +235,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
235 S_IFCHR | S_IRUSR | S_IWUSR, 235 S_IFCHR | S_IRUSR | S_IWUSR,
236 "dvb/adapter%d/%s%d", adap->num, dnames[type], id); 236 "dvb/adapter%d/%s%d", adap->num, dnames[type], id);
237 237
238 class_device_create(dvb_class, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), 238 class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
239 NULL, "dvb%d.%s%d", adap->num, dnames[type], id); 239 NULL, "dvb%d.%s%d", adap->num, dnames[type], id);
240 240
241 dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", 241 dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c
index 5aa12ebab34f..b595476332cd 100644
--- a/drivers/media/dvb/dvb-usb/dtt200u.c
+++ b/drivers/media/dvb/dvb-usb/dtt200u.c
@@ -151,7 +151,7 @@ static struct dvb_usb_properties dtt200u_properties = {
151 .cold_ids = { &dtt200u_usb_table[0], NULL }, 151 .cold_ids = { &dtt200u_usb_table[0], NULL },
152 .warm_ids = { &dtt200u_usb_table[1], NULL }, 152 .warm_ids = { &dtt200u_usb_table[1], NULL },
153 }, 153 },
154 { 0 }, 154 { NULL },
155 } 155 }
156}; 156};
157 157
@@ -192,7 +192,7 @@ static struct dvb_usb_properties wt220u_properties = {
192 .cold_ids = { &dtt200u_usb_table[2], NULL }, 192 .cold_ids = { &dtt200u_usb_table[2], NULL },
193 .warm_ids = { &dtt200u_usb_table[3], NULL }, 193 .warm_ids = { &dtt200u_usb_table[3], NULL },
194 }, 194 },
195 { 0 }, 195 { NULL },
196 } 196 }
197}; 197};
198 198
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:
89int dvb_usb_remote_init(struct dvb_usb_device *d) 89int 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/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c
index 0f57abeb6d6b..75765e3a569c 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/drivers/media/dvb/dvb-usb/vp7045.c
@@ -247,7 +247,7 @@ static struct dvb_usb_properties vp7045_properties = {
247 .cold_ids = { &vp7045_usb_table[2], NULL }, 247 .cold_ids = { &vp7045_usb_table[2], NULL },
248 .warm_ids = { &vp7045_usb_table[3], NULL }, 248 .warm_ids = { &vp7045_usb_table[3], NULL },
249 }, 249 },
250 { 0 }, 250 { NULL },
251 } 251 }
252}; 252};
253 253
diff --git a/drivers/media/dvb/frontends/bcm3510.c b/drivers/media/dvb/frontends/bcm3510.c
index f5fdc5c3e605..f6d4ee78bdd4 100644
--- a/drivers/media/dvb/frontends/bcm3510.c
+++ b/drivers/media/dvb/frontends/bcm3510.c
@@ -36,6 +36,9 @@
36#include <linux/moduleparam.h> 36#include <linux/moduleparam.h>
37#include <linux/device.h> 37#include <linux/device.h>
38#include <linux/firmware.h> 38#include <linux/firmware.h>
39#include <linux/jiffies.h>
40#include <linux/string.h>
41#include <linux/slab.h>
39 42
40#include "dvb_frontend.h" 43#include "dvb_frontend.h"
41#include "bcm3510.h" 44#include "bcm3510.h"
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c
index 21433e1831e7..6b0553608610 100644
--- a/drivers/media/dvb/frontends/dib3000mb.c
+++ b/drivers/media/dvb/frontends/dib3000mb.c
@@ -27,6 +27,8 @@
27#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/string.h>
31#include <linux/slab.h>
30 32
31#include "dib3000-common.h" 33#include "dib3000-common.h"
32#include "dib3000mb_priv.h" 34#include "dib3000mb_priv.h"
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c
index 441de665fec3..c024fad17337 100644
--- a/drivers/media/dvb/frontends/dib3000mc.c
+++ b/drivers/media/dvb/frontends/dib3000mc.c
@@ -26,6 +26,8 @@
26#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/string.h>
30#include <linux/slab.h>
29 31
30#include "dib3000-common.h" 32#include "dib3000-common.h"
31#include "dib3000mc_priv.h" 33#include "dib3000mc_priv.h"
diff --git a/drivers/media/dvb/frontends/dvb_dummy_fe.c b/drivers/media/dvb/frontends/dvb_dummy_fe.c
index cff93b9d8ab2..794be520d590 100644
--- a/drivers/media/dvb/frontends/dvb_dummy_fe.c
+++ b/drivers/media/dvb/frontends/dvb_dummy_fe.c
@@ -22,6 +22,8 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/moduleparam.h> 23#include <linux/moduleparam.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/string.h>
26#include <linux/slab.h>
25 27
26#include "dvb_frontend.h" 28#include "dvb_frontend.h"
27#include "dvb_dummy_fe.h" 29#include "dvb_dummy_fe.h"
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c
index 7142b9c51dd2..8dde72bd1046 100644
--- a/drivers/media/dvb/frontends/lgdt330x.c
+++ b/drivers/media/dvb/frontends/lgdt330x.c
@@ -37,6 +37,8 @@
37#include <linux/moduleparam.h> 37#include <linux/moduleparam.h>
38#include <linux/init.h> 38#include <linux/init.h>
39#include <linux/delay.h> 39#include <linux/delay.h>
40#include <linux/string.h>
41#include <linux/slab.h>
40#include <asm/byteorder.h> 42#include <asm/byteorder.h>
41 43
42#include "dvb_frontend.h" 44#include "dvb_frontend.h"
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c
index e455aecd76b2..e38454901dd1 100644
--- a/drivers/media/dvb/frontends/mt312.c
+++ b/drivers/media/dvb/frontends/mt312.c
@@ -29,6 +29,8 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/moduleparam.h> 31#include <linux/moduleparam.h>
32#include <linux/string.h>
33#include <linux/slab.h>
32 34
33#include "dvb_frontend.h" 35#include "dvb_frontend.h"
34#include "mt312_priv.h" 36#include "mt312_priv.h"
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c
index cc1bc0edd65e..f0c610f2c2df 100644
--- a/drivers/media/dvb/frontends/mt352.c
+++ b/drivers/media/dvb/frontends/mt352.c
@@ -35,6 +35,8 @@
35#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/string.h>
39#include <linux/slab.h>
38 40
39#include "dvb_frontend.h" 41#include "dvb_frontend.h"
40#include "mt352_priv.h" 42#include "mt352_priv.h"
diff --git a/drivers/media/dvb/frontends/nxt2002.c b/drivers/media/dvb/frontends/nxt2002.c
index 35a1d60f1927..30786b1911bd 100644
--- a/drivers/media/dvb/frontends/nxt2002.c
+++ b/drivers/media/dvb/frontends/nxt2002.c
@@ -32,6 +32,8 @@
32#include <linux/moduleparam.h> 32#include <linux/moduleparam.h>
33#include <linux/device.h> 33#include <linux/device.h>
34#include <linux/firmware.h> 34#include <linux/firmware.h>
35#include <linux/string.h>
36#include <linux/slab.h>
35 37
36#include "dvb_frontend.h" 38#include "dvb_frontend.h"
37#include "nxt2002.h" 39#include "nxt2002.h"
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c
index b6d0eecc59eb..817b044c7fd1 100644
--- a/drivers/media/dvb/frontends/or51132.c
+++ b/drivers/media/dvb/frontends/or51132.c
@@ -36,6 +36,8 @@
36#include <linux/moduleparam.h> 36#include <linux/moduleparam.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/delay.h> 38#include <linux/delay.h>
39#include <linux/string.h>
40#include <linux/slab.h>
39#include <asm/byteorder.h> 41#include <asm/byteorder.h>
40 42
41#include "dvb_frontend.h" 43#include "dvb_frontend.h"
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c
index ad56a9958404..8a9db23dd1b7 100644
--- a/drivers/media/dvb/frontends/or51211.c
+++ b/drivers/media/dvb/frontends/or51211.c
@@ -34,6 +34,8 @@
34#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/firmware.h> 36#include <linux/firmware.h>
37#include <linux/string.h>
38#include <linux/slab.h>
37#include <asm/byteorder.h> 39#include <asm/byteorder.h>
38 40
39#include "dvb_frontend.h" 41#include "dvb_frontend.h"
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c
index c7fe27fd530c..f265418e3261 100644
--- a/drivers/media/dvb/frontends/s5h1420.c
+++ b/drivers/media/dvb/frontends/s5h1420.c
@@ -26,6 +26,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26#include <linux/string.h> 26#include <linux/string.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/jiffies.h>
30#include <asm/div64.h>
29 31
30#include "dvb_frontend.h" 32#include "dvb_frontend.h"
31#include "s5h1420.h" 33#include "s5h1420.h"
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c
index 764a95a2e212..1c6b2e9264bc 100644
--- a/drivers/media/dvb/frontends/sp8870.c
+++ b/drivers/media/dvb/frontends/sp8870.c
@@ -32,6 +32,8 @@
32#include <linux/device.h> 32#include <linux/device.h>
33#include <linux/firmware.h> 33#include <linux/firmware.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/string.h>
36#include <linux/slab.h>
35 37
36#include "dvb_frontend.h" 38#include "dvb_frontend.h"
37#include "sp8870.h" 39#include "sp8870.h"
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c
index d868a6927a16..73384e75625e 100644
--- a/drivers/media/dvb/frontends/sp887x.c
+++ b/drivers/media/dvb/frontends/sp887x.c
@@ -14,6 +14,8 @@
14#include <linux/moduleparam.h> 14#include <linux/moduleparam.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/firmware.h> 16#include <linux/firmware.h>
17#include <linux/string.h>
18#include <linux/slab.h>
17 19
18#include "dvb_frontend.h" 20#include "dvb_frontend.h"
19#include "sp887x.h" 21#include "sp887x.h"
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c
index 8d09afd7545d..6122ba754bc5 100644
--- a/drivers/media/dvb/frontends/stv0297.c
+++ b/drivers/media/dvb/frontends/stv0297.c
@@ -24,6 +24,8 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/jiffies.h>
28#include <linux/slab.h>
27 29
28#include "dvb_frontend.h" 30#include "dvb_frontend.h"
29#include "stv0297.h" 31#include "stv0297.h"
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c
index 2d62931f20b5..889d9257215d 100644
--- a/drivers/media/dvb/frontends/stv0299.c
+++ b/drivers/media/dvb/frontends/stv0299.c
@@ -48,6 +48,7 @@
48#include <linux/moduleparam.h> 48#include <linux/moduleparam.h>
49#include <linux/string.h> 49#include <linux/string.h>
50#include <linux/slab.h> 50#include <linux/slab.h>
51#include <linux/jiffies.h>
51#include <asm/div64.h> 52#include <asm/div64.h>
52 53
53#include "dvb_frontend.h" 54#include "dvb_frontend.h"
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c
index 74cea9f8d721..3529c618f828 100644
--- a/drivers/media/dvb/frontends/tda1004x.c
+++ b/drivers/media/dvb/frontends/tda1004x.c
@@ -32,6 +32,10 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/moduleparam.h> 33#include <linux/moduleparam.h>
34#include <linux/device.h> 34#include <linux/device.h>
35#include <linux/jiffies.h>
36#include <linux/string.h>
37#include <linux/slab.h>
38
35#include "dvb_frontend.h" 39#include "dvb_frontend.h"
36#include "tda1004x.h" 40#include "tda1004x.h"
37 41
diff --git a/drivers/media/dvb/frontends/tda8083.c b/drivers/media/dvb/frontends/tda8083.c
index 168e013d23bd..c05cf1861051 100644
--- a/drivers/media/dvb/frontends/tda8083.c
+++ b/drivers/media/dvb/frontends/tda8083.c
@@ -30,6 +30,7 @@
30#include <linux/moduleparam.h> 30#include <linux/moduleparam.h>
31#include <linux/string.h> 31#include <linux/string.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/jiffies.h>
33#include "dvb_frontend.h" 34#include "dvb_frontend.h"
34#include "tda8083.h" 35#include "tda8083.h"
35 36
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
16static int av_cnt; 16static int av_cnt;
17static struct av7110 *av_list[4]; 17static struct av7110 *av_list[4];
18static struct input_dev input_dev; 18static struct input_dev *input_dev;
19 19
20static u16 key_map [256] = { 20static 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
44static void av7110_emit_keyup(unsigned long data) 44static 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
65struct budget_ci { 65struct 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)
145static void msp430_ir_interrupt(unsigned long data) 145static 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)
181static int msp430_ir_init(struct budget_ci *budget_ci) 181static 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)
208static void msp430_ir_deinit(struct budget_ci *budget_ci) 210static 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
243exit: retval = usb_submit_urb(urb, GFP_ATOMIC); 244exit: 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
1184static void ttusb_init_rc( struct ttusb_dec *dec) 1185static 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
1209static void ttusb_dec_init_v_pes(struct ttusb_dec *dec) 1219static 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/radio/miropcm20-rds.c b/drivers/media/radio/miropcm20-rds.c
index df79d5e0aaed..e09214082e01 100644
--- a/drivers/media/radio/miropcm20-rds.c
+++ b/drivers/media/radio/miropcm20-rds.c
@@ -14,6 +14,7 @@
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
17#include <linux/sched.h> /* current, TASK_*, schedule_timeout() */
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <asm/uaccess.h> 19#include <asm/uaccess.h>
19#include "miropcm20-rds-core.h" 20#include "miropcm20-rds-core.h"
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 */
242struct bttv_input { 242struct 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
261struct cx88_IR { 261struct 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)
357int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) 357int 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/indycam.c b/drivers/media/video/indycam.c
index b2b0384cd4b9..26dd06ec89a2 100644
--- a/drivers/media/video/indycam.c
+++ b/drivers/media/video/indycam.c
@@ -9,16 +9,16 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/delay.h> 12#include <linux/delay.h>
15#include <linux/errno.h> 13#include <linux/errno.h>
16#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/init.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/major.h> 17#include <linux/major.h>
19#include <linux/slab.h> 18#include <linux/module.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
21#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/slab.h>
22 22
23#include <linux/videodev.h> 23#include <linux/videodev.h>
24/* IndyCam decodes stream of photons into digital image representation ;-) */ 24/* IndyCam decodes stream of photons into digital image representation ;-) */
@@ -44,8 +44,6 @@ MODULE_LICENSE("GPL");
44#define indycam_regdump(client) 44#define indycam_regdump(client)
45#endif 45#endif
46 46
47#define VINO_ADAPTER (I2C_ALGO_SGI | I2C_HW_SGI_VINO)
48
49struct indycam { 47struct indycam {
50 struct i2c_client *client; 48 struct i2c_client *client;
51 int version; 49 int version;
@@ -300,7 +298,7 @@ out_free_client:
300static int indycam_probe(struct i2c_adapter *adap) 298static int indycam_probe(struct i2c_adapter *adap)
301{ 299{
302 /* Indy specific crap */ 300 /* Indy specific crap */
303 if (adap->id == VINO_ADAPTER) 301 if (adap->id == I2C_HW_SGI_VINO)
304 return indycam_attach(adap, INDYCAM_ADDR, 0); 302 return indycam_attach(adap, INDYCAM_ADDR, 0);
305 /* Feel free to add probe here :-) */ 303 /* Feel free to add probe here :-) */
306 return -ENODEV; 304 return -ENODEV;
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
159struct IR { 159struct 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
124struct IR;
125struct IR { 124struct 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/msp3400.c b/drivers/media/video/msp3400.c
index f0d43fc2632f..262890cb20a7 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -1420,8 +1420,8 @@ static int msp_detach(struct i2c_client *client);
1420static int msp_probe(struct i2c_adapter *adap); 1420static int msp_probe(struct i2c_adapter *adap);
1421static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); 1421static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg);
1422 1422
1423static int msp_suspend(struct device * dev, pm_message_t state, u32 level); 1423static int msp_suspend(struct device * dev, pm_message_t state);
1424static int msp_resume(struct device * dev, u32 level); 1424static int msp_resume(struct device * dev);
1425 1425
1426static void msp_wake_thread(struct i2c_client *client); 1426static void msp_wake_thread(struct i2c_client *client);
1427 1427
@@ -1821,7 +1821,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
1821 return 0; 1821 return 0;
1822} 1822}
1823 1823
1824static int msp_suspend(struct device * dev, pm_message_t state, u32 level) 1824static int msp_suspend(struct device * dev, pm_message_t state)
1825{ 1825{
1826 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 1826 struct i2c_client *c = container_of(dev, struct i2c_client, dev);
1827 1827
@@ -1830,7 +1830,7 @@ static int msp_suspend(struct device * dev, pm_message_t state, u32 level)
1830 return 0; 1830 return 0;
1831} 1831}
1832 1832
1833static int msp_resume(struct device * dev, u32 level) 1833static int msp_resume(struct device * dev)
1834{ 1834{
1835 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 1835 struct i2c_client *c = container_of(dev, struct i2c_client, dev);
1836 1836
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)
456int saa7134_input_init1(struct saa7134_dev *dev) 456int 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 */
353struct saa7134_ir { 353struct 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];
diff --git a/drivers/media/video/saa7191.c b/drivers/media/video/saa7191.c
index 454f5c1199b4..3ddbb62312be 100644
--- a/drivers/media/video/saa7191.c
+++ b/drivers/media/video/saa7191.c
@@ -9,16 +9,16 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/delay.h> 12#include <linux/delay.h>
15#include <linux/errno.h> 13#include <linux/errno.h>
16#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/init.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/major.h> 17#include <linux/major.h>
19#include <linux/slab.h> 18#include <linux/module.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
21#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/slab.h>
22 22
23#include <linux/videodev.h> 23#include <linux/videodev.h>
24#include <linux/video_decoder.h> 24#include <linux/video_decoder.h>
@@ -33,8 +33,6 @@ MODULE_VERSION(SAA7191_MODULE_VERSION);
33MODULE_AUTHOR("Mikael Nousiainen <tmnousia@cc.hut.fi>"); 33MODULE_AUTHOR("Mikael Nousiainen <tmnousia@cc.hut.fi>");
34MODULE_LICENSE("GPL"); 34MODULE_LICENSE("GPL");
35 35
36#define VINO_ADAPTER (I2C_ALGO_SGI | I2C_HW_SGI_VINO)
37
38struct saa7191 { 36struct saa7191 {
39 struct i2c_client *client; 37 struct i2c_client *client;
40 38
@@ -337,7 +335,7 @@ out_free_client:
337static int saa7191_probe(struct i2c_adapter *adap) 335static int saa7191_probe(struct i2c_adapter *adap)
338{ 336{
339 /* Always connected to VINO */ 337 /* Always connected to VINO */
340 if (adap->id == VINO_ADAPTER) 338 if (adap->id == I2C_HW_SGI_VINO)
341 return saa7191_attach(adap, SAA7191_ADDR, 0); 339 return saa7191_attach(adap, SAA7191_ADDR, 0);
342 /* Feel free to add probe here :-) */ 340 /* Feel free to add probe here :-) */
343 return -ENODEV; 341 return -ENODEV;
@@ -364,7 +362,7 @@ static int saa7191_command(struct i2c_client *client, unsigned int cmd,
364 362
365 cap->flags = VIDEO_DECODER_PAL | VIDEO_DECODER_NTSC | 363 cap->flags = VIDEO_DECODER_PAL | VIDEO_DECODER_NTSC |
366 VIDEO_DECODER_SECAM | VIDEO_DECODER_AUTO; 364 VIDEO_DECODER_SECAM | VIDEO_DECODER_AUTO;
367 cap->inputs = (client->adapter->id == VINO_ADAPTER) ? 2 : 1; 365 cap->inputs = (client->adapter->id == I2C_HW_SGI_VINO) ? 2 : 1;
368 cap->outputs = 1; 366 cap->outputs = 1;
369 break; 367 break;
370 } 368 }
@@ -422,7 +420,7 @@ static int saa7191_command(struct i2c_client *client, unsigned int cmd,
422 int *iarg = arg; 420 int *iarg = arg;
423 421
424 switch (client->adapter->id) { 422 switch (client->adapter->id) {
425 case VINO_ADAPTER: 423 case I2C_HW_SGI_VINO:
426 return saa7191_set_input(client, *iarg); 424 return saa7191_set_input(client, *iarg);
427 default: 425 default:
428 if (*iarg != 0) 426 if (*iarg != 0)
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 0456dda2624d..94053f149ddf 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -784,13 +784,13 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
784 return 0; 784 return 0;
785} 785}
786 786
787static int tda9887_suspend(struct device * dev, pm_message_t state, u32 level) 787static int tda9887_suspend(struct device * dev, pm_message_t state)
788{ 788{
789 dprintk("tda9887: suspend\n"); 789 dprintk("tda9887: suspend\n");
790 return 0; 790 return 0;
791} 791}
792 792
793static int tda9887_resume(struct device * dev, u32 level) 793static int tda9887_resume(struct device * dev)
794{ 794{
795 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 795 struct i2c_client *c = container_of(dev, struct i2c_client, dev);
796 struct tda9887 *t = i2c_get_clientdata(c); 796 struct tda9887 *t = i2c_get_clientdata(c);
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 05572020af4d..ad85bef1c3d5 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -697,7 +697,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
697 return 0; 697 return 0;
698} 698}
699 699
700static int tuner_suspend(struct device *dev, pm_message_t state, u32 level) 700static int tuner_suspend(struct device *dev, pm_message_t state)
701{ 701{
702 struct i2c_client *c = container_of (dev, struct i2c_client, dev); 702 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
703 struct tuner *t = i2c_get_clientdata (c); 703 struct tuner *t = i2c_get_clientdata (c);
@@ -707,7 +707,7 @@ static int tuner_suspend(struct device *dev, pm_message_t state, u32 level)
707 return 0; 707 return 0;
708} 708}
709 709
710static int tuner_resume(struct device *dev, u32 level) 710static int tuner_resume(struct device *dev)
711{ 711{
712 struct i2c_client *c = container_of (dev, struct i2c_client, dev); 712 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
713 struct tuner *t = i2c_get_clientdata (c); 713 struct tuner *t = i2c_get_clientdata (c);
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c
index d8a0f763ca10..ed4394e854ab 100644
--- a/drivers/media/video/vino.c
+++ b/drivers/media/video/vino.c
@@ -26,14 +26,15 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/dma-mapping.h>
29#include <linux/errno.h> 30#include <linux/errno.h>
30#include <linux/fs.h> 31#include <linux/fs.h>
32#include <linux/interrupt.h>
31#include <linux/kernel.h> 33#include <linux/kernel.h>
32#include <linux/mm.h> 34#include <linux/mm.h>
33#include <linux/interrupt.h>
34#include <linux/dma-mapping.h>
35#include <linux/time.h>
36#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36#include <linux/time.h>
37#include <linux/version.h>
37 38
38#ifdef CONFIG_KMOD 39#ifdef CONFIG_KMOD
39#include <linux/kmod.h> 40#include <linux/kmod.h>