diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/cinergyT2/cinergyT2.c | 13 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 37 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/av7110_ir.c | 25 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 42 | ||||
-rw-r--r-- | drivers/media/dvb/ttusb-dec/ttusb_dec.c | 11 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv-input.c | 101 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-input.c | 77 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 43 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 48 | ||||
-rw-r--r-- | drivers/media/video/usbvideo/quickcam_messenger.c | 9 |
10 files changed, 257 insertions, 149 deletions
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 9123147e376f..d64b96cb0c46 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -746,6 +746,7 @@ static void cinergyt2_query_rc (struct work_struct *work) | |||
746 | dprintk(1, "rc_input_event=%d Up\n", cinergyt2->rc_input_event); | 746 | dprintk(1, "rc_input_event=%d Up\n", cinergyt2->rc_input_event); |
747 | input_report_key(cinergyt2->rc_input_dev, | 747 | input_report_key(cinergyt2->rc_input_dev, |
748 | cinergyt2->rc_input_event, 0); | 748 | cinergyt2->rc_input_event, 0); |
749 | input_sync(cinergyt2->rc_input_dev); | ||
749 | cinergyt2->rc_input_event = KEY_MAX; | 750 | cinergyt2->rc_input_event = KEY_MAX; |
750 | } | 751 | } |
751 | cinergyt2->rc_last_code = ~0; | 752 | cinergyt2->rc_last_code = ~0; |
@@ -783,6 +784,7 @@ static void cinergyt2_query_rc (struct work_struct *work) | |||
783 | dprintk(1, "rc_input_event=%d\n", cinergyt2->rc_input_event); | 784 | dprintk(1, "rc_input_event=%d\n", cinergyt2->rc_input_event); |
784 | input_report_key(cinergyt2->rc_input_dev, | 785 | input_report_key(cinergyt2->rc_input_dev, |
785 | cinergyt2->rc_input_event, 1); | 786 | cinergyt2->rc_input_event, 1); |
787 | input_sync(cinergyt2->rc_input_dev); | ||
786 | cinergyt2->rc_last_code = rc_events[n].value; | 788 | cinergyt2->rc_last_code = rc_events[n].value; |
787 | } | 789 | } |
788 | } | 790 | } |
@@ -798,8 +800,9 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) | |||
798 | { | 800 | { |
799 | struct input_dev *input_dev; | 801 | struct input_dev *input_dev; |
800 | int i; | 802 | int i; |
803 | int err; | ||
801 | 804 | ||
802 | cinergyt2->rc_input_dev = input_dev = input_allocate_device(); | 805 | input_dev = input_allocate_device(); |
803 | if (!input_dev) | 806 | if (!input_dev) |
804 | return -ENOMEM; | 807 | return -ENOMEM; |
805 | 808 | ||
@@ -817,7 +820,13 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) | |||
817 | input_dev->keycodesize = 0; | 820 | input_dev->keycodesize = 0; |
818 | input_dev->keycodemax = 0; | 821 | input_dev->keycodemax = 0; |
819 | 822 | ||
820 | input_register_device(cinergyt2->rc_input_dev); | 823 | err = input_register_device(input_dev); |
824 | if (err) { | ||
825 | input_free_device(input_dev); | ||
826 | return err; | ||
827 | } | ||
828 | |||
829 | cinergyt2->rc_input_dev = input_dev; | ||
821 | schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2); | 830 | schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2); |
822 | 831 | ||
823 | return 0; | 832 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index 794e4471561c..19ff5978bc91 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | |||
@@ -90,7 +90,9 @@ schedule: | |||
90 | 90 | ||
91 | int dvb_usb_remote_init(struct dvb_usb_device *d) | 91 | int dvb_usb_remote_init(struct dvb_usb_device *d) |
92 | { | 92 | { |
93 | struct input_dev *input_dev; | ||
93 | int i; | 94 | int i; |
95 | int err; | ||
94 | 96 | ||
95 | if (d->props.rc_key_map == NULL || | 97 | if (d->props.rc_key_map == NULL || |
96 | d->props.rc_query == NULL || | 98 | d->props.rc_query == NULL || |
@@ -100,23 +102,24 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) | |||
100 | usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); | 102 | usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); |
101 | strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys)); | 103 | strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys)); |
102 | 104 | ||
103 | d->rc_input_dev = input_allocate_device(); | 105 | input_dev = input_allocate_device(); |
104 | if (!d->rc_input_dev) | 106 | if (!input_dev) |
105 | return -ENOMEM; | 107 | return -ENOMEM; |
106 | 108 | ||
107 | d->rc_input_dev->evbit[0] = BIT(EV_KEY); | 109 | input_dev->evbit[0] = BIT(EV_KEY); |
108 | d->rc_input_dev->keycodesize = sizeof(unsigned char); | 110 | input_dev->keycodesize = sizeof(unsigned char); |
109 | d->rc_input_dev->keycodemax = KEY_MAX; | 111 | input_dev->keycodemax = KEY_MAX; |
110 | d->rc_input_dev->name = "IR-receiver inside an USB DVB receiver"; | 112 | input_dev->name = "IR-receiver inside an USB DVB receiver"; |
111 | d->rc_input_dev->phys = d->rc_phys; | 113 | input_dev->phys = d->rc_phys; |
112 | usb_to_input_id(d->udev, &d->rc_input_dev->id); | 114 | usb_to_input_id(d->udev, &input_dev->id); |
113 | d->rc_input_dev->cdev.dev = &d->udev->dev; | 115 | input_dev->cdev.dev = &d->udev->dev; |
114 | 116 | ||
115 | /* set the bits for the keys */ | 117 | /* set the bits for the keys */ |
116 | deb_rc("key map size: %d\n", d->props.rc_key_map_size); | 118 | deb_rc("key map size: %d\n", d->props.rc_key_map_size); |
117 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 119 | for (i = 0; i < d->props.rc_key_map_size; i++) { |
118 | deb_rc("setting bit for event %d item %d\n",d->props.rc_key_map[i].event, i); | 120 | deb_rc("setting bit for event %d item %d\n", |
119 | set_bit(d->props.rc_key_map[i].event, d->rc_input_dev->keybit); | 121 | d->props.rc_key_map[i].event, i); |
122 | set_bit(d->props.rc_key_map[i].event, input_dev->keybit); | ||
120 | } | 123 | } |
121 | 124 | ||
122 | /* Start the remote-control polling. */ | 125 | /* Start the remote-control polling. */ |
@@ -124,10 +127,16 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) | |||
124 | d->props.rc_interval = 100; /* default */ | 127 | d->props.rc_interval = 100; /* default */ |
125 | 128 | ||
126 | /* setting these two values to non-zero, we have to manage key repeats */ | 129 | /* setting these two values to non-zero, we have to manage key repeats */ |
127 | d->rc_input_dev->rep[REP_PERIOD] = d->props.rc_interval; | 130 | input_dev->rep[REP_PERIOD] = d->props.rc_interval; |
128 | d->rc_input_dev->rep[REP_DELAY] = d->props.rc_interval + 150; | 131 | input_dev->rep[REP_DELAY] = d->props.rc_interval + 150; |
129 | 132 | ||
130 | input_register_device(d->rc_input_dev); | 133 | err = input_register_device(input_dev); |
134 | if (err) { | ||
135 | input_free_device(input_dev); | ||
136 | return err; | ||
137 | } | ||
138 | |||
139 | d->rc_input_dev = input_dev; | ||
131 | 140 | ||
132 | INIT_DELAYED_WORK(&d->rc_query_work, dvb_usb_read_remote_control); | 141 | INIT_DELAYED_WORK(&d->rc_query_work, dvb_usb_read_remote_control); |
133 | 142 | ||
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c index d54bbcdde2cc..e4544ea2b89b 100644 --- a/drivers/media/dvb/ttpci/av7110_ir.c +++ b/drivers/media/dvb/ttpci/av7110_ir.c | |||
@@ -48,7 +48,8 @@ static void av7110_emit_keyup(unsigned long data) | |||
48 | if (!data || !test_bit(data, input_dev->key)) | 48 | if (!data || !test_bit(data, input_dev->key)) |
49 | return; | 49 | return; |
50 | 50 | ||
51 | input_event(input_dev, EV_KEY, data, !!0); | 51 | input_report_key(input_dev, data, 0); |
52 | input_sync(input_dev); | ||
52 | } | 53 | } |
53 | 54 | ||
54 | 55 | ||
@@ -115,14 +116,17 @@ static void av7110_emit_key(unsigned long parm) | |||
115 | del_timer(&keyup_timer); | 116 | del_timer(&keyup_timer); |
116 | if (keyup_timer.data != keycode || new_toggle != old_toggle) { | 117 | if (keyup_timer.data != keycode || new_toggle != old_toggle) { |
117 | delay_timer_finished = 0; | 118 | delay_timer_finished = 0; |
118 | input_event(input_dev, EV_KEY, keyup_timer.data, !!0); | 119 | input_event(input_dev, EV_KEY, keyup_timer.data, 0); |
119 | input_event(input_dev, EV_KEY, keycode, !0); | 120 | input_event(input_dev, EV_KEY, keycode, 1); |
120 | } else | 121 | input_sync(input_dev); |
121 | if (delay_timer_finished) | 122 | } else if (delay_timer_finished) { |
122 | input_event(input_dev, EV_KEY, keycode, 2); | 123 | input_event(input_dev, EV_KEY, keycode, 2); |
124 | input_sync(input_dev); | ||
125 | } | ||
123 | } else { | 126 | } else { |
124 | delay_timer_finished = 0; | 127 | delay_timer_finished = 0; |
125 | input_event(input_dev, EV_KEY, keycode, !0); | 128 | input_event(input_dev, EV_KEY, keycode, 1); |
129 | input_sync(input_dev); | ||
126 | } | 130 | } |
127 | 131 | ||
128 | keyup_timer.expires = jiffies + UP_TIMEOUT; | 132 | keyup_timer.expires = jiffies + UP_TIMEOUT; |
@@ -211,6 +215,7 @@ static void ir_handler(struct av7110 *av7110, u32 ircom) | |||
211 | int __devinit av7110_ir_init(struct av7110 *av7110) | 215 | int __devinit av7110_ir_init(struct av7110 *av7110) |
212 | { | 216 | { |
213 | static struct proc_dir_entry *e; | 217 | static struct proc_dir_entry *e; |
218 | int err; | ||
214 | 219 | ||
215 | if (av_cnt >= sizeof av_list/sizeof av_list[0]) | 220 | if (av_cnt >= sizeof av_list/sizeof av_list[0]) |
216 | return -ENOSPC; | 221 | return -ENOSPC; |
@@ -231,7 +236,11 @@ int __devinit av7110_ir_init(struct av7110 *av7110) | |||
231 | set_bit(EV_KEY, input_dev->evbit); | 236 | set_bit(EV_KEY, input_dev->evbit); |
232 | set_bit(EV_REP, input_dev->evbit); | 237 | set_bit(EV_REP, input_dev->evbit); |
233 | input_register_keys(); | 238 | input_register_keys(); |
234 | input_register_device(input_dev); | 239 | err = input_register_device(input_dev); |
240 | if (err) { | ||
241 | input_free_device(input_dev); | ||
242 | return err; | ||
243 | } | ||
235 | input_dev->timer.function = input_repeat_key; | 244 | input_dev->timer.function = input_repeat_key; |
236 | 245 | ||
237 | e = create_proc_entry("av7110_ir", S_IFREG | S_IRUGO | S_IWUSR, NULL); | 246 | e = create_proc_entry("av7110_ir", S_IFREG | S_IRUGO | S_IWUSR, NULL); |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index cd5ec489af1c..25d0dfc1f585 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -143,14 +143,14 @@ static void msp430_ir_debounce(unsigned long data) | |||
143 | struct input_dev *dev = (struct input_dev *) data; | 143 | struct input_dev *dev = (struct input_dev *) data; |
144 | 144 | ||
145 | if (dev->rep[0] == 0 || dev->rep[0] == ~0) { | 145 | if (dev->rep[0] == 0 || dev->rep[0] == ~0) { |
146 | input_event(dev, EV_KEY, key_map[dev->repeat_key], !!0); | 146 | input_event(dev, EV_KEY, key_map[dev->repeat_key], 0); |
147 | return; | 147 | } else { |
148 | dev->rep[0] = 0; | ||
149 | dev->timer.expires = jiffies + HZ * 350 / 1000; | ||
150 | add_timer(&dev->timer); | ||
151 | input_event(dev, EV_KEY, key_map[dev->repeat_key], 2); /* REPEAT */ | ||
148 | } | 152 | } |
149 | 153 | input_sync(dev); | |
150 | dev->rep[0] = 0; | ||
151 | dev->timer.expires = jiffies + HZ * 350 / 1000; | ||
152 | add_timer(&dev->timer); | ||
153 | input_event(dev, EV_KEY, key_map[dev->repeat_key], 2); /* REPEAT */ | ||
154 | } | 154 | } |
155 | 155 | ||
156 | static void msp430_ir_interrupt(unsigned long data) | 156 | static void msp430_ir_interrupt(unsigned long data) |
@@ -169,7 +169,7 @@ static void msp430_ir_interrupt(unsigned long data) | |||
169 | return; | 169 | return; |
170 | } | 170 | } |
171 | del_timer(&dev->timer); | 171 | del_timer(&dev->timer); |
172 | input_event(dev, EV_KEY, key_map[dev->repeat_key], !!0); | 172 | input_event(dev, EV_KEY, key_map[dev->repeat_key], 0); |
173 | } | 173 | } |
174 | 174 | ||
175 | if (!key_map[code]) { | 175 | if (!key_map[code]) { |
@@ -177,15 +177,14 @@ static void msp430_ir_interrupt(unsigned long data) | |||
177 | return; | 177 | return; |
178 | } | 178 | } |
179 | 179 | ||
180 | input_event(dev, EV_KEY, key_map[code], 1); | ||
181 | input_sync(dev); | ||
182 | |||
180 | /* initialize debounce and repeat */ | 183 | /* initialize debounce and repeat */ |
181 | dev->repeat_key = code; | 184 | dev->repeat_key = code; |
182 | /* Zenith remote _always_ sends 2 sequences */ | 185 | /* Zenith remote _always_ sends 2 sequences */ |
183 | dev->rep[0] = ~0; | 186 | dev->rep[0] = ~0; |
184 | /* 350 milliseconds */ | 187 | mod_timer(&dev->timer, jiffies + msecs_to_jiffies(350)); |
185 | dev->timer.expires = jiffies + HZ * 350 / 1000; | ||
186 | /* MAKE */ | ||
187 | input_event(dev, EV_KEY, key_map[code], !0); | ||
188 | add_timer(&dev->timer); | ||
189 | } | 188 | } |
190 | } | 189 | } |
191 | 190 | ||
@@ -194,8 +193,9 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
194 | struct saa7146_dev *saa = budget_ci->budget.dev; | 193 | struct saa7146_dev *saa = budget_ci->budget.dev; |
195 | struct input_dev *input_dev; | 194 | struct input_dev *input_dev; |
196 | int i; | 195 | int i; |
196 | int err; | ||
197 | 197 | ||
198 | budget_ci->input_dev = input_dev = input_allocate_device(); | 198 | input_dev = input_allocate_device(); |
199 | if (!input_dev) | 199 | if (!input_dev) |
200 | return -ENOMEM; | 200 | return -ENOMEM; |
201 | 201 | ||
@@ -208,10 +208,16 @@ static int msp430_ir_init(struct budget_ci *budget_ci) | |||
208 | if (key_map[i]) | 208 | if (key_map[i]) |
209 | set_bit(key_map[i], input_dev->keybit); | 209 | set_bit(key_map[i], input_dev->keybit); |
210 | 210 | ||
211 | input_register_device(budget_ci->input_dev); | 211 | err = input_register_device(input_dev); |
212 | if (err) { | ||
213 | input_free_device(input_dev); | ||
214 | return err; | ||
215 | } | ||
212 | 216 | ||
213 | input_dev->timer.function = msp430_ir_debounce; | 217 | input_dev->timer.function = msp430_ir_debounce; |
214 | 218 | ||
219 | budget_ci->input_dev = input_dev; | ||
220 | |||
215 | saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_06); | 221 | saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_06); |
216 | saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI); | 222 | saa7146_setgpio(saa, 3, SAA7146_GPIO_IRQHI); |
217 | 223 | ||
@@ -226,8 +232,10 @@ static void msp430_ir_deinit(struct budget_ci *budget_ci) | |||
226 | saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_06); | 232 | saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_06); |
227 | saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); | 233 | saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); |
228 | 234 | ||
229 | if (del_timer(&dev->timer)) | 235 | if (del_timer(&dev->timer)) { |
230 | input_event(dev, EV_KEY, key_map[dev->repeat_key], !!0); | 236 | input_event(dev, EV_KEY, key_map[dev->repeat_key], 0); |
237 | input_sync(dev); | ||
238 | } | ||
231 | 239 | ||
232 | input_unregister_device(dev); | 240 | input_unregister_device(dev); |
233 | } | 241 | } |
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 10b121ada833..bd6e7baae2ec 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c | |||
@@ -238,6 +238,7 @@ static void ttusb_dec_handle_irq( struct urb *urb) | |||
238 | * for now lets report each signal as a key down and up*/ | 238 | * for now lets report each signal as a key down and up*/ |
239 | dprintk("%s:rc signal:%d\n", __FUNCTION__, buffer[4]); | 239 | dprintk("%s:rc signal:%d\n", __FUNCTION__, buffer[4]); |
240 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1); | 240 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1); |
241 | input_sync(dec->rc_input_dev); | ||
241 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0); | 242 | input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0); |
242 | input_sync(dec->rc_input_dev); | 243 | input_sync(dec->rc_input_dev); |
243 | } | 244 | } |
@@ -1187,11 +1188,12 @@ static int ttusb_init_rc( struct ttusb_dec *dec) | |||
1187 | struct input_dev *input_dev; | 1188 | struct input_dev *input_dev; |
1188 | u8 b[] = { 0x00, 0x01 }; | 1189 | u8 b[] = { 0x00, 0x01 }; |
1189 | int i; | 1190 | int i; |
1191 | int err; | ||
1190 | 1192 | ||
1191 | usb_make_path(dec->udev, dec->rc_phys, sizeof(dec->rc_phys)); | 1193 | usb_make_path(dec->udev, dec->rc_phys, sizeof(dec->rc_phys)); |
1192 | strlcpy(dec->rc_phys, "/input0", sizeof(dec->rc_phys)); | 1194 | strlcpy(dec->rc_phys, "/input0", sizeof(dec->rc_phys)); |
1193 | 1195 | ||
1194 | dec->rc_input_dev = input_dev = input_allocate_device(); | 1196 | input_dev = input_allocate_device(); |
1195 | if (!input_dev) | 1197 | if (!input_dev) |
1196 | return -ENOMEM; | 1198 | return -ENOMEM; |
1197 | 1199 | ||
@@ -1205,8 +1207,13 @@ static int ttusb_init_rc( struct ttusb_dec *dec) | |||
1205 | for (i = 0; i < ARRAY_SIZE(rc_keys); i++) | 1207 | for (i = 0; i < ARRAY_SIZE(rc_keys); i++) |
1206 | set_bit(rc_keys[i], input_dev->keybit); | 1208 | set_bit(rc_keys[i], input_dev->keybit); |
1207 | 1209 | ||
1208 | input_register_device(input_dev); | 1210 | err = input_register_device(input_dev); |
1211 | if (err) { | ||
1212 | input_free_device(input_dev); | ||
1213 | return err; | ||
1214 | } | ||
1209 | 1215 | ||
1216 | dec->rc_input_dev = input_dev; | ||
1210 | if (usb_submit_urb(dec->irq_urb, GFP_KERNEL)) | 1217 | if (usb_submit_urb(dec->irq_urb, GFP_KERNEL)) |
1211 | printk("%s: usb_submit_urb failed\n",__FUNCTION__); | 1218 | printk("%s: usb_submit_urb failed\n",__FUNCTION__); |
1212 | /* enable irq pipe */ | 1219 | /* enable irq pipe */ |
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index 933d6db09acb..cbc012f71f52 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c | |||
@@ -259,24 +259,59 @@ static void bttv_rc5_timer_keyup(unsigned long data) | |||
259 | 259 | ||
260 | /* ---------------------------------------------------------------------- */ | 260 | /* ---------------------------------------------------------------------- */ |
261 | 261 | ||
262 | static void bttv_ir_start(struct bttv *btv, struct bttv_ir *ir) | ||
263 | { | ||
264 | if (ir->polling) { | ||
265 | init_timer(&ir->timer); | ||
266 | ir->timer.function = bttv_input_timer; | ||
267 | ir->timer.data = (unsigned long)btv; | ||
268 | ir->timer.expires = jiffies + HZ; | ||
269 | add_timer(&ir->timer); | ||
270 | } else if (ir->rc5_gpio) { | ||
271 | /* set timer_end for code completion */ | ||
272 | init_timer(&ir->timer_end); | ||
273 | ir->timer_end.function = bttv_rc5_timer_end; | ||
274 | ir->timer_end.data = (unsigned long)ir; | ||
275 | |||
276 | init_timer(&ir->timer_keyup); | ||
277 | ir->timer_keyup.function = bttv_rc5_timer_keyup; | ||
278 | ir->timer_keyup.data = (unsigned long)ir; | ||
279 | } | ||
280 | } | ||
281 | |||
282 | static void bttv_ir_stop(struct bttv *btv) | ||
283 | { | ||
284 | if (btv->remote->polling) { | ||
285 | del_timer_sync(&btv->remote->timer); | ||
286 | flush_scheduled_work(); | ||
287 | } | ||
288 | |||
289 | if (btv->remote->rc5_gpio) { | ||
290 | u32 gpio; | ||
291 | |||
292 | del_timer_sync(&btv->remote->timer_end); | ||
293 | flush_scheduled_work(); | ||
294 | |||
295 | gpio = bttv_gpio_read(&btv->c); | ||
296 | bttv_gpio_write(&btv->c, gpio & ~(1 << 4)); | ||
297 | } | ||
298 | } | ||
299 | |||
262 | int bttv_input_init(struct bttv *btv) | 300 | int bttv_input_init(struct bttv *btv) |
263 | { | 301 | { |
264 | struct bttv_ir *ir; | 302 | struct bttv_ir *ir; |
265 | IR_KEYTAB_TYPE *ir_codes = NULL; | 303 | IR_KEYTAB_TYPE *ir_codes = NULL; |
266 | struct input_dev *input_dev; | 304 | struct input_dev *input_dev; |
267 | int ir_type = IR_TYPE_OTHER; | 305 | int ir_type = IR_TYPE_OTHER; |
306 | int err = -ENOMEM; | ||
268 | 307 | ||
269 | if (!btv->has_remote) | 308 | if (!btv->has_remote) |
270 | return -ENODEV; | 309 | return -ENODEV; |
271 | 310 | ||
272 | ir = kzalloc(sizeof(*ir),GFP_KERNEL); | 311 | ir = kzalloc(sizeof(*ir),GFP_KERNEL); |
273 | input_dev = input_allocate_device(); | 312 | input_dev = input_allocate_device(); |
274 | if (!ir || !input_dev) { | 313 | if (!ir || !input_dev) |
275 | kfree(ir); | 314 | goto err_out_free; |
276 | input_free_device(input_dev); | ||
277 | return -ENOMEM; | ||
278 | } | ||
279 | memset(ir,0,sizeof(*ir)); | ||
280 | 315 | ||
281 | /* detect & configure */ | 316 | /* detect & configure */ |
282 | switch (btv->c.type) { | 317 | switch (btv->c.type) { |
@@ -348,10 +383,9 @@ int bttv_input_init(struct bttv *btv) | |||
348 | break; | 383 | break; |
349 | } | 384 | } |
350 | if (NULL == ir_codes) { | 385 | if (NULL == ir_codes) { |
351 | dprintk(KERN_INFO "Ooops: IR config error [card=%d]\n",btv->c.type); | 386 | dprintk(KERN_INFO "Ooops: IR config error [card=%d]\n", btv->c.type); |
352 | kfree(ir); | 387 | err = -ENODEV; |
353 | input_free_device(input_dev); | 388 | goto err_out_free; |
354 | return -ENODEV; | ||
355 | } | 389 | } |
356 | 390 | ||
357 | if (ir->rc5_gpio) { | 391 | if (ir->rc5_gpio) { |
@@ -389,32 +423,26 @@ int bttv_input_init(struct bttv *btv) | |||
389 | input_dev->cdev.dev = &btv->c.pci->dev; | 423 | input_dev->cdev.dev = &btv->c.pci->dev; |
390 | 424 | ||
391 | btv->remote = ir; | 425 | btv->remote = ir; |
392 | if (ir->polling) { | 426 | bttv_ir_start(btv, ir); |
393 | init_timer(&ir->timer); | ||
394 | ir->timer.function = bttv_input_timer; | ||
395 | ir->timer.data = (unsigned long)btv; | ||
396 | ir->timer.expires = jiffies + HZ; | ||
397 | add_timer(&ir->timer); | ||
398 | } else if (ir->rc5_gpio) { | ||
399 | /* set timer_end for code completion */ | ||
400 | init_timer(&ir->timer_end); | ||
401 | ir->timer_end.function = bttv_rc5_timer_end; | ||
402 | ir->timer_end.data = (unsigned long)ir; | ||
403 | |||
404 | init_timer(&ir->timer_keyup); | ||
405 | ir->timer_keyup.function = bttv_rc5_timer_keyup; | ||
406 | ir->timer_keyup.data = (unsigned long)ir; | ||
407 | } | ||
408 | 427 | ||
409 | /* all done */ | 428 | /* all done */ |
410 | input_register_device(btv->remote->dev); | 429 | err = input_register_device(btv->remote->dev); |
411 | printk(DEVNAME ": %s detected at %s\n",ir->name,ir->phys); | 430 | if (err) |
431 | goto err_out_stop; | ||
412 | 432 | ||
413 | /* the remote isn't as bouncy as a keyboard */ | 433 | /* the remote isn't as bouncy as a keyboard */ |
414 | ir->dev->rep[REP_DELAY] = repeat_delay; | 434 | ir->dev->rep[REP_DELAY] = repeat_delay; |
415 | ir->dev->rep[REP_PERIOD] = repeat_period; | 435 | ir->dev->rep[REP_PERIOD] = repeat_period; |
416 | 436 | ||
417 | return 0; | 437 | return 0; |
438 | |||
439 | err_out_stop: | ||
440 | bttv_ir_stop(btv); | ||
441 | btv->remote = NULL; | ||
442 | err_out_free: | ||
443 | input_free_device(input_dev); | ||
444 | kfree(ir); | ||
445 | return err; | ||
418 | } | 446 | } |
419 | 447 | ||
420 | void bttv_input_fini(struct bttv *btv) | 448 | void bttv_input_fini(struct bttv *btv) |
@@ -422,22 +450,7 @@ void bttv_input_fini(struct bttv *btv) | |||
422 | if (btv->remote == NULL) | 450 | if (btv->remote == NULL) |
423 | return; | 451 | return; |
424 | 452 | ||
425 | if (btv->remote->polling) { | 453 | bttv_ir_stop(btv); |
426 | del_timer_sync(&btv->remote->timer); | ||
427 | flush_scheduled_work(); | ||
428 | } | ||
429 | |||
430 | |||
431 | if (btv->remote->rc5_gpio) { | ||
432 | u32 gpio; | ||
433 | |||
434 | del_timer_sync(&btv->remote->timer_end); | ||
435 | flush_scheduled_work(); | ||
436 | |||
437 | gpio = bttv_gpio_read(&btv->c); | ||
438 | bttv_gpio_write(&btv->c, gpio & ~(1 << 4)); | ||
439 | } | ||
440 | |||
441 | input_unregister_device(btv->remote->dev); | 454 | input_unregister_device(btv->remote->dev); |
442 | kfree(btv->remote); | 455 | kfree(btv->remote); |
443 | btv->remote = NULL; | 456 | btv->remote = NULL; |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index e60a0a52e4b2..c6d412b1f218 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -155,6 +155,35 @@ static void cx88_ir_work(struct work_struct *work) | |||
155 | mod_timer(&ir->timer, timeout); | 155 | mod_timer(&ir->timer, timeout); |
156 | } | 156 | } |
157 | 157 | ||
158 | static void cx88_ir_start(struct cx88_core *core, struct cx88_IR *ir) | ||
159 | { | ||
160 | if (ir->polling) { | ||
161 | INIT_WORK(&ir->work, cx88_ir_work, ir); | ||
162 | init_timer(&ir->timer); | ||
163 | ir->timer.function = ir_timer; | ||
164 | ir->timer.data = (unsigned long)ir; | ||
165 | schedule_work(&ir->work); | ||
166 | } | ||
167 | if (ir->sampling) { | ||
168 | core->pci_irqmask |= (1 << 18); /* IR_SMP_INT */ | ||
169 | cx_write(MO_DDS_IO, 0xa80a80); /* 4 kHz sample rate */ | ||
170 | cx_write(MO_DDSCFG_IO, 0x5); /* enable */ | ||
171 | } | ||
172 | } | ||
173 | |||
174 | static void cx88_ir_stop(struct cx88_core *core, struct cx88_IR *ir) | ||
175 | { | ||
176 | if (ir->sampling) { | ||
177 | cx_write(MO_DDSCFG_IO, 0x0); | ||
178 | core->pci_irqmask &= ~(1 << 18); | ||
179 | } | ||
180 | |||
181 | if (ir->polling) { | ||
182 | del_timer_sync(&ir->timer); | ||
183 | flush_scheduled_work(); | ||
184 | } | ||
185 | } | ||
186 | |||
158 | /* ---------------------------------------------------------------------- */ | 187 | /* ---------------------------------------------------------------------- */ |
159 | 188 | ||
160 | int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | 189 | int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) |
@@ -163,14 +192,12 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
163 | struct input_dev *input_dev; | 192 | struct input_dev *input_dev; |
164 | IR_KEYTAB_TYPE *ir_codes = NULL; | 193 | IR_KEYTAB_TYPE *ir_codes = NULL; |
165 | int ir_type = IR_TYPE_OTHER; | 194 | int ir_type = IR_TYPE_OTHER; |
195 | int err = -ENOMEM; | ||
166 | 196 | ||
167 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); | 197 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
168 | input_dev = input_allocate_device(); | 198 | input_dev = input_allocate_device(); |
169 | if (!ir || !input_dev) { | 199 | if (!ir || !input_dev) |
170 | kfree(ir); | 200 | goto err_out_free; |
171 | input_free_device(input_dev); | ||
172 | return -ENOMEM; | ||
173 | } | ||
174 | 201 | ||
175 | ir->input = input_dev; | 202 | ir->input = input_dev; |
176 | 203 | ||
@@ -280,9 +307,8 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
280 | } | 307 | } |
281 | 308 | ||
282 | if (NULL == ir_codes) { | 309 | if (NULL == ir_codes) { |
283 | kfree(ir); | 310 | err = -ENODEV; |
284 | input_free_device(input_dev); | 311 | goto err_out_free; |
285 | return -ENODEV; | ||
286 | } | 312 | } |
287 | 313 | ||
288 | /* init input device */ | 314 | /* init input device */ |
@@ -307,23 +333,22 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
307 | ir->core = core; | 333 | ir->core = core; |
308 | core->ir = ir; | 334 | core->ir = ir; |
309 | 335 | ||
310 | if (ir->polling) { | 336 | cx88_ir_start(core, ir); |
311 | INIT_WORK(&ir->work, cx88_ir_work); | ||
312 | init_timer(&ir->timer); | ||
313 | ir->timer.function = ir_timer; | ||
314 | ir->timer.data = (unsigned long)ir; | ||
315 | schedule_work(&ir->work); | ||
316 | } | ||
317 | if (ir->sampling) { | ||
318 | core->pci_irqmask |= (1 << 18); /* IR_SMP_INT */ | ||
319 | cx_write(MO_DDS_IO, 0xa80a80); /* 4 kHz sample rate */ | ||
320 | cx_write(MO_DDSCFG_IO, 0x5); /* enable */ | ||
321 | } | ||
322 | 337 | ||
323 | /* all done */ | 338 | /* all done */ |
324 | input_register_device(ir->input); | 339 | err = input_register_device(ir->input); |
340 | if (err) | ||
341 | goto err_out_stop; | ||
325 | 342 | ||
326 | return 0; | 343 | return 0; |
344 | |||
345 | err_out_stop: | ||
346 | cx88_ir_stop(core, ir); | ||
347 | core->ir = NULL; | ||
348 | err_out_free: | ||
349 | input_free_device(input_dev); | ||
350 | kfree(ir); | ||
351 | return err; | ||
327 | } | 352 | } |
328 | 353 | ||
329 | int cx88_ir_fini(struct cx88_core *core) | 354 | int cx88_ir_fini(struct cx88_core *core) |
@@ -334,15 +359,7 @@ int cx88_ir_fini(struct cx88_core *core) | |||
334 | if (NULL == ir) | 359 | if (NULL == ir) |
335 | return 0; | 360 | return 0; |
336 | 361 | ||
337 | if (ir->sampling) { | 362 | cx88_ir_stop(core, ir); |
338 | cx_write(MO_DDSCFG_IO, 0x0); | ||
339 | core->pci_irqmask &= ~(1 << 18); | ||
340 | } | ||
341 | if (ir->polling) { | ||
342 | del_timer(&ir->timer); | ||
343 | flush_scheduled_work(); | ||
344 | } | ||
345 | |||
346 | input_unregister_device(ir->input); | 363 | input_unregister_device(ir->input); |
347 | kfree(ir); | 364 | kfree(ir); |
348 | 365 | ||
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index ab87e7bfe84f..dd6341f2e390 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -305,15 +305,14 @@ static int ir_attach(struct i2c_adapter *adap, int addr, | |||
305 | int ir_type; | 305 | int ir_type; |
306 | struct IR_i2c *ir; | 306 | struct IR_i2c *ir; |
307 | struct input_dev *input_dev; | 307 | struct input_dev *input_dev; |
308 | int err; | ||
308 | 309 | ||
309 | ir = kzalloc(sizeof(struct IR_i2c),GFP_KERNEL); | 310 | ir = kzalloc(sizeof(struct IR_i2c),GFP_KERNEL); |
310 | input_dev = input_allocate_device(); | 311 | input_dev = input_allocate_device(); |
311 | if (!ir || !input_dev) { | 312 | if (!ir || !input_dev) { |
312 | input_free_device(input_dev); | 313 | err = -ENOMEM; |
313 | kfree(ir); | 314 | goto err_out_free; |
314 | return -ENOMEM; | ||
315 | } | 315 | } |
316 | memset(ir,0,sizeof(*ir)); | ||
317 | 316 | ||
318 | ir->c = client_template; | 317 | ir->c = client_template; |
319 | ir->input = input_dev; | 318 | ir->input = input_dev; |
@@ -361,26 +360,27 @@ static int ir_attach(struct i2c_adapter *adap, int addr, | |||
361 | break; | 360 | break; |
362 | default: | 361 | default: |
363 | /* shouldn't happen */ | 362 | /* shouldn't happen */ |
364 | printk(DEVNAME ": Huh? unknown i2c address (0x%02x)?\n",addr); | 363 | printk(DEVNAME ": Huh? unknown i2c address (0x%02x)?\n", addr); |
365 | kfree(ir); | 364 | err = -ENODEV; |
366 | return -1; | 365 | goto err_out_free; |
367 | } | 366 | } |
368 | 367 | ||
369 | /* Sets name */ | 368 | /* Sets name */ |
370 | snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (%s)", name); | 369 | snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (%s)", name); |
371 | ir->ir_codes=ir_codes; | 370 | ir->ir_codes = ir_codes; |
372 | 371 | ||
373 | /* register i2c device | 372 | /* register i2c device |
374 | * At device register, IR codes may be changed to be | 373 | * At device register, IR codes may be changed to be |
375 | * board dependent. | 374 | * board dependent. |
376 | */ | 375 | */ |
377 | i2c_attach_client(&ir->c); | 376 | err = i2c_attach_client(&ir->c); |
377 | if (err) | ||
378 | goto err_out_free; | ||
378 | 379 | ||
379 | /* If IR not supported or disabled, unregisters driver */ | 380 | /* If IR not supported or disabled, unregisters driver */ |
380 | if (ir->get_key == NULL) { | 381 | if (ir->get_key == NULL) { |
381 | i2c_detach_client(&ir->c); | 382 | err = -ENODEV; |
382 | kfree(ir); | 383 | goto err_out_detach; |
383 | return -1; | ||
384 | } | 384 | } |
385 | 385 | ||
386 | /* Phys addr can only be set after attaching (for ir->c.dev.bus_id) */ | 386 | /* Phys addr can only be set after attaching (for ir->c.dev.bus_id) */ |
@@ -389,15 +389,17 @@ static int ir_attach(struct i2c_adapter *adap, int addr, | |||
389 | ir->c.dev.bus_id); | 389 | ir->c.dev.bus_id); |
390 | 390 | ||
391 | /* init + register input device */ | 391 | /* init + register input device */ |
392 | ir_input_init(input_dev,&ir->ir,ir_type,ir->ir_codes); | 392 | ir_input_init(input_dev, &ir->ir, ir_type, ir->ir_codes); |
393 | input_dev->id.bustype = BUS_I2C; | 393 | input_dev->id.bustype = BUS_I2C; |
394 | input_dev->name = ir->c.name; | 394 | input_dev->name = ir->c.name; |
395 | input_dev->phys = ir->phys; | 395 | input_dev->phys = ir->phys; |
396 | 396 | ||
397 | /* register event device */ | 397 | err = input_register_device(ir->input); |
398 | input_register_device(ir->input); | 398 | if (err) |
399 | goto err_out_detach; | ||
400 | |||
399 | printk(DEVNAME ": %s detected at %s [%s]\n", | 401 | printk(DEVNAME ": %s detected at %s [%s]\n", |
400 | ir->input->name,ir->input->phys,adap->name); | 402 | ir->input->name, ir->input->phys, adap->name); |
401 | 403 | ||
402 | /* start polling via eventd */ | 404 | /* start polling via eventd */ |
403 | INIT_WORK(&ir->work, ir_work); | 405 | INIT_WORK(&ir->work, ir_work); |
@@ -407,6 +409,13 @@ static int ir_attach(struct i2c_adapter *adap, int addr, | |||
407 | schedule_work(&ir->work); | 409 | schedule_work(&ir->work); |
408 | 410 | ||
409 | return 0; | 411 | return 0; |
412 | |||
413 | err_out_detach: | ||
414 | i2c_detach_client(&ir->c); | ||
415 | err_out_free: | ||
416 | input_free_device(input_dev); | ||
417 | kfree(ir); | ||
418 | return err; | ||
410 | } | 419 | } |
411 | 420 | ||
412 | static int ir_detach(struct i2c_client *client) | 421 | static int ir_detach(struct i2c_client *client) |
@@ -414,7 +423,7 @@ static int ir_detach(struct i2c_client *client) | |||
414 | struct IR_i2c *ir = i2c_get_clientdata(client); | 423 | struct IR_i2c *ir = i2c_get_clientdata(client); |
415 | 424 | ||
416 | /* kill outstanding polls */ | 425 | /* kill outstanding polls */ |
417 | del_timer(&ir->timer); | 426 | del_timer_sync(&ir->timer); |
418 | flush_scheduled_work(); | 427 | flush_scheduled_work(); |
419 | 428 | ||
420 | /* unregister devices */ | 429 | /* unregister devices */ |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 83887d1876a9..5d2bf15239f7 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -131,6 +131,23 @@ static void saa7134_input_timer(unsigned long data) | |||
131 | mod_timer(&ir->timer, timeout); | 131 | mod_timer(&ir->timer, timeout); |
132 | } | 132 | } |
133 | 133 | ||
134 | static void saa7134_ir_start(struct saa7134_dev *dev, struct saa7134_ir *ir) | ||
135 | { | ||
136 | if (ir->polling) { | ||
137 | init_timer(&ir->timer); | ||
138 | ir->timer.function = saa7134_input_timer; | ||
139 | ir->timer.data = (unsigned long)dev; | ||
140 | ir->timer.expires = jiffies + HZ; | ||
141 | add_timer(&ir->timer); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | static void saa7134_ir_stop(struct saa7134_dev *dev) | ||
146 | { | ||
147 | if (dev->remote->polling) | ||
148 | del_timer_sync(&dev->remote->timer); | ||
149 | } | ||
150 | |||
134 | int saa7134_input_init1(struct saa7134_dev *dev) | 151 | int saa7134_input_init1(struct saa7134_dev *dev) |
135 | { | 152 | { |
136 | struct saa7134_ir *ir; | 153 | struct saa7134_ir *ir; |
@@ -141,6 +158,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
141 | u32 mask_keyup = 0; | 158 | u32 mask_keyup = 0; |
142 | int polling = 0; | 159 | int polling = 0; |
143 | int ir_type = IR_TYPE_OTHER; | 160 | int ir_type = IR_TYPE_OTHER; |
161 | int err; | ||
144 | 162 | ||
145 | if (dev->has_remote != SAA7134_REMOTE_GPIO) | 163 | if (dev->has_remote != SAA7134_REMOTE_GPIO) |
146 | return -ENODEV; | 164 | return -ENODEV; |
@@ -267,9 +285,8 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
267 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); | 285 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
268 | input_dev = input_allocate_device(); | 286 | input_dev = input_allocate_device(); |
269 | if (!ir || !input_dev) { | 287 | if (!ir || !input_dev) { |
270 | kfree(ir); | 288 | err = -ENOMEM; |
271 | input_free_device(input_dev); | 289 | goto err_out_free; |
272 | return -ENOMEM; | ||
273 | } | 290 | } |
274 | 291 | ||
275 | ir->dev = input_dev; | 292 | ir->dev = input_dev; |
@@ -300,18 +317,22 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
300 | } | 317 | } |
301 | input_dev->cdev.dev = &dev->pci->dev; | 318 | input_dev->cdev.dev = &dev->pci->dev; |
302 | 319 | ||
303 | /* all done */ | ||
304 | dev->remote = ir; | 320 | dev->remote = ir; |
305 | if (ir->polling) { | 321 | saa7134_ir_start(dev, ir); |
306 | init_timer(&ir->timer); | 322 | |
307 | ir->timer.function = saa7134_input_timer; | 323 | err = input_register_device(ir->dev); |
308 | ir->timer.data = (unsigned long)dev; | 324 | if (err) |
309 | ir->timer.expires = jiffies + HZ; | 325 | goto err_out_stop; |
310 | add_timer(&ir->timer); | ||
311 | } | ||
312 | 326 | ||
313 | input_register_device(ir->dev); | ||
314 | return 0; | 327 | return 0; |
328 | |||
329 | err_out_stop: | ||
330 | saa7134_ir_stop(dev); | ||
331 | dev->remote = NULL; | ||
332 | err_out_free: | ||
333 | input_free_device(input_dev); | ||
334 | kfree(ir); | ||
335 | return err; | ||
315 | } | 336 | } |
316 | 337 | ||
317 | void saa7134_input_fini(struct saa7134_dev *dev) | 338 | void saa7134_input_fini(struct saa7134_dev *dev) |
@@ -319,8 +340,7 @@ void saa7134_input_fini(struct saa7134_dev *dev) | |||
319 | if (NULL == dev->remote) | 340 | if (NULL == dev->remote) |
320 | return; | 341 | return; |
321 | 342 | ||
322 | if (dev->remote->polling) | 343 | saa7134_ir_stop(dev); |
323 | del_timer_sync(&dev->remote->timer); | ||
324 | input_unregister_device(dev->remote->dev); | 344 | input_unregister_device(dev->remote->dev); |
325 | kfree(dev->remote); | 345 | kfree(dev->remote); |
326 | dev->remote = NULL; | 346 | dev->remote = NULL; |
diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c index bbf2beeeb449..ec0ff2247f06 100644 --- a/drivers/media/video/usbvideo/quickcam_messenger.c +++ b/drivers/media/video/usbvideo/quickcam_messenger.c | |||
@@ -86,6 +86,7 @@ MODULE_DEVICE_TABLE(usb, qcm_table); | |||
86 | static void qcm_register_input(struct qcm *cam, struct usb_device *dev) | 86 | static void qcm_register_input(struct qcm *cam, struct usb_device *dev) |
87 | { | 87 | { |
88 | struct input_dev *input_dev; | 88 | struct input_dev *input_dev; |
89 | int error; | ||
89 | 90 | ||
90 | usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname)); | 91 | usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname)); |
91 | strncat(cam->input_physname, "/input0", sizeof(cam->input_physname)); | 92 | strncat(cam->input_physname, "/input0", sizeof(cam->input_physname)); |
@@ -106,7 +107,13 @@ static void qcm_register_input(struct qcm *cam, struct usb_device *dev) | |||
106 | 107 | ||
107 | input_dev->private = cam; | 108 | input_dev->private = cam; |
108 | 109 | ||
109 | input_register_device(cam->input); | 110 | error = input_register_device(cam->input); |
111 | if (error) { | ||
112 | warn("Failed to register camera's input device, err: %d\n", | ||
113 | error); | ||
114 | input_free_device(cam->input); | ||
115 | cam->input = NULL; | ||
116 | } | ||
110 | } | 117 | } |
111 | 118 | ||
112 | static void qcm_unregister_input(struct qcm *cam) | 119 | static void qcm_unregister_input(struct qcm *cam) |