aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick
diff options
context:
space:
mode:
authorJohann Deneux <johann.deneux@gmail.com>2007-04-12 01:30:24 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-04-12 01:30:24 -0400
commit598972d4fb39c8a0826b396e45dc2a8c1dbe4f11 (patch)
treefe86b804a8a6c086626a04c541c54f097daec729 /drivers/input/joystick
parentd542ed82fdc72cf63549deec19e86ee4addf2499 (diff)
Input: iforce - use usb_kill_urb instead of usb_unlink_urb
Using usb_unlink_urb can cause iforce_open to fail when called soon after iforce_release. Also updated my email address and replaced calls to printk() by dbg(), warn(), info(), err()... Signed-off-by: Johann Deneux <johann.deneux@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joystick')
-rw-r--r--drivers/input/joystick/iforce/iforce-ff.c10
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c22
-rw-r--r--drivers/input/joystick/iforce/iforce-packets.c22
-rw-r--r--drivers/input/joystick/iforce/iforce-serio.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c13
-rw-r--r--drivers/input/joystick/iforce/iforce.h2
6 files changed, 33 insertions, 38 deletions
diff --git a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c
index 8fb0c19cc60e..f2a4381d0ab8 100644
--- a/drivers/input/joystick/iforce/iforce-ff.c
+++ b/drivers/input/joystick/iforce/iforce-ff.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $ 2 * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
@@ -205,7 +205,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new)
205 int i; 205 int i;
206 206
207 if (new->type != FF_SPRING && new->type != FF_FRICTION) { 207 if (new->type != FF_SPRING && new->type != FF_FRICTION) {
208 printk(KERN_WARNING "iforce.c: bad effect type in need_condition_modifier\n"); 208 warn("bad effect type in need_condition_modifier");
209 return 0; 209 return 0;
210 } 210 }
211 211
@@ -227,7 +227,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new)
227static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect) 227static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect)
228{ 228{
229 if (effect->type != FF_CONSTANT) { 229 if (effect->type != FF_CONSTANT) {
230 printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); 230 warn("bad effect type in need_envelope_modifier");
231 return 0; 231 return 0;
232 } 232 }
233 233
@@ -258,7 +258,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
258 break; 258 break;
259 259
260 default: 260 default:
261 printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); 261 warn("bad effect type in need_envelope_modifier");
262 } 262 }
263 263
264 return 0; 264 return 0;
@@ -271,7 +271,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
271static int need_period_modifier(struct ff_effect *old, struct ff_effect *new) 271static int need_period_modifier(struct ff_effect *old, struct ff_effect *new)
272{ 272{
273 if (new->type != FF_PERIODIC) { 273 if (new->type != FF_PERIODIC) {
274 printk(KERN_WARNING "iforce.c: bad effect type in need_period_modifier\n"); 274 warn("bad effect type in need_period_modifier");
275 return 0; 275 return 0;
276 } 276 }
277 return (old->u.periodic.period != new->u.periodic.period 277 return (old->u.periodic.period != new->u.periodic.period
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index 3393a37fec39..bd5a6de69a6b 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $ 2 * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
@@ -29,7 +29,7 @@
29 29
30#include "iforce.h" 30#include "iforce.h"
31 31
32MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <deneux@ifrance.com>"); 32MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <johann.deneux@gmail.com>");
33MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver"); 33MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver");
34MODULE_LICENSE("GPL"); 34MODULE_LICENSE("GPL");
35 35
@@ -220,7 +220,7 @@ static void iforce_release(struct input_dev *dev)
220 /* Check: no effects should be present in memory */ 220 /* Check: no effects should be present in memory */
221 for (i = 0; i < dev->ff->max_effects; i++) { 221 for (i = 0; i < dev->ff->max_effects; i++) {
222 if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { 222 if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) {
223 printk(KERN_WARNING "iforce_release: Device still owns effects\n"); 223 warn("iforce_release: Device still owns effects");
224 break; 224 break;
225 } 225 }
226 } 226 }
@@ -232,7 +232,7 @@ static void iforce_release(struct input_dev *dev)
232 switch (iforce->bus) { 232 switch (iforce->bus) {
233#ifdef CONFIG_JOYSTICK_IFORCE_USB 233#ifdef CONFIG_JOYSTICK_IFORCE_USB
234 case IFORCE_USB: 234 case IFORCE_USB:
235 usb_unlink_urb(iforce->irq); 235 usb_kill_urb(iforce->irq);
236 236
237 /* The device was unplugged before the file 237 /* The device was unplugged before the file
238 * was released */ 238 * was released */
@@ -324,7 +324,7 @@ int iforce_init_device(struct iforce *iforce)
324 break; 324 break;
325 325
326 if (i == 20) { /* 5 seconds */ 326 if (i == 20) { /* 5 seconds */
327 printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n"); 327 err("Timeout waiting for response from device.");
328 error = -ENODEV; 328 error = -ENODEV;
329 goto fail; 329 goto fail;
330 } 330 }
@@ -336,26 +336,26 @@ int iforce_init_device(struct iforce *iforce)
336 if (!iforce_get_id_packet(iforce, "M")) 336 if (!iforce_get_id_packet(iforce, "M"))
337 input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; 337 input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1];
338 else 338 else
339 printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n"); 339 warn("Device does not respond to id packet M");
340 340
341 if (!iforce_get_id_packet(iforce, "P")) 341 if (!iforce_get_id_packet(iforce, "P"))
342 input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; 342 input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1];
343 else 343 else
344 printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n"); 344 warn("Device does not respond to id packet P");
345 345
346 if (!iforce_get_id_packet(iforce, "B")) 346 if (!iforce_get_id_packet(iforce, "B"))
347 iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1]; 347 iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1];
348 else 348 else
349 printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet B\n"); 349 warn("Device does not respond to id packet B");
350 350
351 if (!iforce_get_id_packet(iforce, "N")) 351 if (!iforce_get_id_packet(iforce, "N"))
352 ff_effects = iforce->edata[1]; 352 ff_effects = iforce->edata[1];
353 else 353 else
354 printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet N\n"); 354 warn("Device does not respond to id packet N");
355 355
356 /* Check if the device can store more effects than the driver can really handle */ 356 /* Check if the device can store more effects than the driver can really handle */
357 if (ff_effects > IFORCE_EFFECTS_MAX) { 357 if (ff_effects > IFORCE_EFFECTS_MAX) {
358 printk(KERN_WARNING "iforce: Limiting number of effects to %d (device reports %d)\n", 358 warn("Limiting number of effects to %d (device reports %d)",
359 IFORCE_EFFECTS_MAX, ff_effects); 359 IFORCE_EFFECTS_MAX, ff_effects);
360 ff_effects = IFORCE_EFFECTS_MAX; 360 ff_effects = IFORCE_EFFECTS_MAX;
361 } 361 }
@@ -457,8 +457,6 @@ int iforce_init_device(struct iforce *iforce)
457 if (error) 457 if (error)
458 goto fail; 458 goto fail;
459 459
460 printk(KERN_DEBUG "iforce->dev->open = %p\n", iforce->dev->open);
461
462 return 0; 460 return 0;
463 461
464 fail: input_free_device(input_dev); 462 fail: input_free_device(input_dev);
diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c
index 808f05932a6f..21c4e13d3a50 100644
--- a/drivers/input/joystick/iforce/iforce-packets.c
+++ b/drivers/input/joystick/iforce/iforce-packets.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $ 2 * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
@@ -39,10 +39,10 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data)
39{ 39{
40 int i; 40 int i;
41 41
42 printk(KERN_DEBUG "iforce.c: %s ( cmd = %04x, data = ", msg, cmd); 42 printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd);
43 for (i = 0; i < LO(cmd); i++) 43 for (i = 0; i < LO(cmd); i++)
44 printk("%02x ", data[i]); 44 printk("%02x ", data[i]);
45 printk(")\n"); 45 printk("\n");
46} 46}
47 47
48/* 48/*
@@ -65,8 +65,9 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data)
65 head = iforce->xmit.head; 65 head = iforce->xmit.head;
66 tail = iforce->xmit.tail; 66 tail = iforce->xmit.tail;
67 67
68
68 if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) { 69 if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) {
69 printk(KERN_WARNING "iforce.c: not enough space in xmit buffer to send new packet\n"); 70 warn("not enough space in xmit buffer to send new packet");
70 spin_unlock_irqrestore(&iforce->xmit_lock, flags); 71 spin_unlock_irqrestore(&iforce->xmit_lock, flags);
71 return -1; 72 return -1;
72 } 73 }
@@ -126,8 +127,6 @@ int iforce_control_playback(struct iforce* iforce, u16 id, unsigned int value)
126{ 127{
127 unsigned char data[3]; 128 unsigned char data[3];
128 129
129printk(KERN_DEBUG "iforce-packets.c: control_playback %d %d\n", id, value);
130
131 data[0] = LO(id); 130 data[0] = LO(id);
132 data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0; 131 data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0;
133 data[2] = LO(value); 132 data[2] = LO(value);
@@ -151,7 +150,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr)
151 return 0; 150 return 0;
152 } 151 }
153 } 152 }
154 printk(KERN_WARNING "iforce-packets.c: unused effect %04x updated !!!\n", addr); 153 warn("unused effect %04x updated !!!", addr);
155 return -1; 154 return -1;
156} 155}
157 156
@@ -162,7 +161,7 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data)
162 static int being_used = 0; 161 static int being_used = 0;
163 162
164 if (being_used) 163 if (being_used)
165 printk(KERN_WARNING "iforce-packets.c: re-entrant call to iforce_process %d\n", being_used); 164 warn("re-entrant call to iforce_process %d", being_used);
166 being_used++; 165 being_used++;
167 166
168#ifdef CONFIG_JOYSTICK_IFORCE_232 167#ifdef CONFIG_JOYSTICK_IFORCE_232
@@ -266,7 +265,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
266 return -1; 265 return -1;
267 } 266 }
268#else 267#else
269 printk(KERN_ERR "iforce_get_id_packet: iforce->bus = USB!\n"); 268 err("iforce_get_id_packet: iforce->bus = USB!");
270#endif 269#endif
271 break; 270 break;
272 271
@@ -284,13 +283,12 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
284 return -1; 283 return -1;
285 } 284 }
286#else 285#else
287 printk(KERN_ERR "iforce_get_id_packet: iforce->bus = SERIO!\n"); 286 err("iforce_get_id_packet: iforce->bus = SERIO!");
288#endif 287#endif
289 break; 288 break;
290 289
291 default: 290 default:
292 printk(KERN_ERR "iforce_get_id_packet: iforce->bus = %d\n", 291 err("iforce_get_id_packet: iforce->bus = %d", iforce->bus);
293 iforce->bus);
294 break; 292 break;
295 } 293 }
296 294
diff --git a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c
index ec4be535f483..7b4bc19cef27 100644
--- a/drivers/input/joystick/iforce/iforce-serio.c
+++ b/drivers/input/joystick/iforce/iforce-serio.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $ 2 * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index 80cdebcbcb99..750099d8e3c6 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -2,7 +2,7 @@
2 * $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $ 2 * $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */
@@ -65,7 +65,7 @@ void iforce_usb_xmit(struct iforce *iforce)
65 XMIT_INC(iforce->xmit.tail, n); 65 XMIT_INC(iforce->xmit.tail, n);
66 66
67 if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { 67 if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) {
68 printk(KERN_WARNING "iforce-usb.c: iforce_usb_xmit: usb_submit_urb failed %d\n", n); 68 warn("usb_submit_urb failed %d\n", n);
69 } 69 }
70 70
71 /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. 71 /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended.
@@ -110,7 +110,7 @@ static void iforce_usb_out(struct urb *urb)
110 struct iforce *iforce = urb->context; 110 struct iforce *iforce = urb->context;
111 111
112 if (urb->status) { 112 if (urb->status) {
113 printk(KERN_DEBUG "iforce_usb_out: urb->status %d, exiting", urb->status); 113 dbg("urb->status %d, exiting", urb->status);
114 return; 114 return;
115 } 115 }
116 116
@@ -190,10 +190,9 @@ fail:
190/* Called by iforce_delete() */ 190/* Called by iforce_delete() */
191void iforce_usb_delete(struct iforce* iforce) 191void iforce_usb_delete(struct iforce* iforce)
192{ 192{
193 usb_unlink_urb(iforce->irq); 193 usb_kill_urb(iforce->irq);
194/* Is it ok to unlink those ? */ 194 usb_kill_urb(iforce->out);
195 usb_unlink_urb(iforce->out); 195 usb_kill_urb(iforce->ctrl);
196 usb_unlink_urb(iforce->ctrl);
197 196
198 usb_free_urb(iforce->irq); 197 usb_free_urb(iforce->irq);
199 usb_free_urb(iforce->out); 198 usb_free_urb(iforce->out);
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h
index ffaeaefa1a42..dadcf4fb92ae 100644
--- a/drivers/input/joystick/iforce/iforce.h
+++ b/drivers/input/joystick/iforce/iforce.h
@@ -2,7 +2,7 @@
2 * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $ 2 * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $
3 * 3 *
4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> 4 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
5 * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> 5 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * 6 *
7 * USB/RS232 I-Force joysticks and wheels. 7 * USB/RS232 I-Force joysticks and wheels.
8 */ 8 */