* [PATCH] iforce: Use usb_kill_urb instead of usb_unlink_urb. [not found] <38b3b7c0703171439n10025a7bx55a588911eb765d6@mail.gmail.com> @ 2007-03-17 21:43 ` johann deneux 2007-03-17 21:50 ` johann deneux 2007-03-19 16:18 ` Dmitry Torokhov 0 siblings, 2 replies; 6+ messages in thread From: johann deneux @ 2007-03-17 21:43 UTC (permalink / raw) To: linux-input [-- Attachment #1: Type: text/plain, Size: 11257 bytes --] commit 0ba8785483c2ee7f56e8f242e000f6cd17a7da40 Author: Johann Deneux <johann.deneux@gmail.com> Date: Sat Mar 17 22:23:44 2007 +0100 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> diff --git a/drivers/input/joystick/iforce/iforce-ff.cb/drivers/input/joystick/iforce/iforce- ff.c index 8fb0c19..f2a4381 100644 --- a/drivers/input/joystick/iforce/iforce- ff.c +++ b/drivers/input/joystick/iforce/iforce-ff.c @@ -2,7 +2,7 @@ * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik < vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux < johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -205,7 +205,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) int i; if (new->type != FF_SPRING && new->type != FF_FRICTION) { - printk(KERN_WARNING "iforce.c: bad effect type in need_condition_modifier\n"); + warn("bad effect type in need_condition_modifier"); return 0; } @@ -227,7 +227,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect) { if (effect->type != FF_CONSTANT) { - printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); + warn("bad effect type in need_envelope_modifier"); return 0; } @@ -258,7 +258,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec break; default: - printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); + warn("bad effect type in need_envelope_modifier"); } return 0; @@ -271,7 +271,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec static int need_period_modifier(struct ff_effect *old, struct ff_effect *new) { if (new->type != FF_PERIODIC) { - printk(KERN_WARNING "iforce.c: bad effect type in need_period_modifier\n"); + warn("bad effect type in need_period_modifier"); return 0; } return (old->u.periodic.period != new->u.periodic.period diff --git a/drivers/input/joystick/iforce/iforce-main.cb/drivers/input/joystick/iforce/iforce- main.c index 3393a37..bd5a6de 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -2,7 +2,7 @@ * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com > + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -29,7 +29,7 @@ #include "iforce.h" -MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux < deneux@ifrance.com>"); +MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux < johann.deneux@gmail.com>"); MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver"); MODULE_LICENSE("GPL"); @@ -220,7 +220,7 @@ static void iforce_release(struct input_dev *dev) /* Check: no effects should be present in memory */ for (i = 0; i < dev->ff->max_effects; i++) { if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { - printk(KERN_WARNING "iforce_release: Device still owns effects\n"); + warn("iforce_release: Device still owns effects"); break; } } @@ -232,7 +232,7 @@ static void iforce_release(struct input_dev *dev) switch (iforce->bus) { #ifdef CONFIG_JOYSTICK_IFORCE_USB case IFORCE_USB: - usb_unlink_urb(iforce->irq); + usb_kill_urb(iforce->irq); /* The device was unplugged before the file * was released */ @@ -324,7 +324,7 @@ int iforce_init_device(struct iforce *iforce) break; if (i == 20) { /* 5 seconds */ - printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n"); + err("Timeout waiting for response from device."); error = -ENODEV; goto fail; } @@ -336,26 +336,26 @@ int iforce_init_device(struct iforce *iforce) if (!iforce_get_id_packet(iforce, "M")) input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n"); + warn("Device does not respond to id packet M"); if (!iforce_get_id_packet(iforce, "P")) input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n"); + warn("Device does not respond to id packet P"); if (!iforce_get_id_packet(iforce, "B")) iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet B\n"); + warn("Device does not respond to id packet B"); if (!iforce_get_id_packet(iforce, "N")) ff_effects = iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet N\n"); + warn("Device does not respond to id packet N"); /* Check if the device can store more effects than the driver can really handle */ if (ff_effects > IFORCE_EFFECTS_MAX) { - printk(KERN_WARNING "iforce: Limiting number of effects to %d (device reports %d)\n", + warn("Limiting number of effects to %d (device reports %d)", IFORCE_EFFECTS_MAX, ff_effects); ff_effects = IFORCE_EFFECTS_MAX; } @@ -457,8 +457,6 @@ int iforce_init_device(struct iforce *iforce) if (error) goto fail; - printk(KERN_DEBUG "iforce->dev->open = %p\n", iforce->dev->open); - return 0; fail: input_free_device(input_dev); diff --git a/drivers/input/joystick/iforce/iforce- packets.cb/drivers/input/joystick/iforce/iforce- packets.c index 808f059..21c4e13 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -2,7 +2,7 @@ * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux < deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -39,10 +39,10 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data) { int i; - printk(KERN_DEBUG "iforce.c: %s ( cmd = %04x, data = ", msg, cmd); + printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd); for (i = 0; i < LO(cmd); i++) printk("%02x ", data[i]); - printk(")\n"); + printk("\n"); } /* @@ -65,8 +65,9 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data) head = iforce->xmit.head; tail = iforce->xmit.tail; + if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) { - printk(KERN_WARNING "iforce.c: not enough space in xmit buffer to send new packet\n"); + warn("not enough space in xmit buffer to send new packet"); spin_unlock_irqrestore(&iforce->xmit_lock, flags); return -1; } @@ -126,8 +127,6 @@ int iforce_control_playback(struct iforce* iforce, u16 id, unsigned int value) { unsigned char data[3]; -printk(KERN_DEBUG "iforce-packets.c: control_playback %d %d\n", id, value); - data[0] = LO(id); data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0; data[2] = LO(value); @@ -151,7 +150,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr) return 0; } } - printk(KERN_WARNING "iforce-packets.c: unused effect %04x updated !!!\n", addr); + warn("unused effect %04x updated !!!", addr); return -1; } @@ -162,7 +161,7 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data) static int being_used = 0; if (being_used) - printk(KERN_WARNING "iforce-packets.c: re-entrant call to iforce_process %d\n", being_used); + warn("re-entrant call to iforce_process %d", being_used); being_used++; #ifdef CONFIG_JOYSTICK_IFORCE_232 @@ -266,7 +265,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) return -1; } #else - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = USB!\n"); + err("iforce_get_id_packet: iforce->bus = USB!"); #endif break; @@ -284,13 +283,12 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) return -1; } #else - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = SERIO!\n"); + err("iforce_get_id_packet: iforce->bus = SERIO!"); #endif break; default: - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = %d\n", - iforce->bus); + err("iforce_get_id_packet: iforce->bus = %d", iforce->bus); break; } diff --git a/drivers/input/joystick/iforce/iforce-serio.cb/drivers/input/joystick/iforce/iforce- serio.c index ec4be53..7b4bc19 100644 --- a/drivers/input/joystick/iforce/iforce-serio.c +++ b/drivers/input/joystick/iforce/iforce-serio.c @@ -2,7 +2,7 @@ * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $ * * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ diff --git a/drivers/input/joystick/iforce/iforce- usb.cb/drivers/input/joystick/iforce/iforce- usb.c index 80cdebc..750099d 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -2,7 +2,7 @@ * $Id: iforce-usb.c ,v 1.16 2002/06/09 11:08:04 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux < deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -65,7 +65,7 @@ void iforce_usb_xmit(struct iforce *iforce) XMIT_INC(iforce->xmit.tail, n); if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { - printk(KERN_WARNING "iforce-usb.c: iforce_usb_xmit: usb_submit_urb failed %d\n", n); + warn("usb_submit_urb failed %d\n", n); } /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. @@ -110,7 +110,7 @@ static void iforce_usb_out(struct urb *urb) struct iforce *iforce = urb->context; if (urb->status) { - printk(KERN_DEBUG "iforce_usb_out: urb->status %d, exiting", urb->status); + dbg("urb->status %d, exiting", urb->status); return; } @@ -190,10 +190,9 @@ fail: /* Called by iforce_delete() */ void iforce_usb_delete(struct iforce* iforce) { - usb_unlink_urb(iforce->irq); -/* Is it ok to unlink those ? */ - usb_unlink_urb(iforce->out); - usb_unlink_urb(iforce->ctrl); + usb_kill_urb(iforce->irq); + usb_kill_urb(iforce->out); + usb_kill_urb(iforce->ctrl); usb_free_urb(iforce->irq); usb_free_urb(iforce->out); diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index ffaeaef..dadcf4f 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h @@ -2,7 +2,7 @@ * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux < deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ [-- Attachment #2: Type: text/html, Size: 16960 bytes --] ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] iforce: Use usb_kill_urb instead of usb_unlink_urb. 2007-03-17 21:43 ` [PATCH] iforce: Use usb_kill_urb instead of usb_unlink_urb johann deneux @ 2007-03-17 21:50 ` johann deneux 2007-03-18 1:37 ` Dmitry Torokhov 2007-03-19 16:18 ` Dmitry Torokhov 1 sibling, 1 reply; 6+ messages in thread From: johann deneux @ 2007-03-17 21:50 UTC (permalink / raw) To: linux-input, linux-usb-devel [-- Attachment #1: Type: text/plain, Size: 12190 bytes --] A note about that patch: Apparently Anders Fugmann submitted a patch to use usb_kill_urb to linux-usb-devel for version 2.6.10. I don't know if this patch got lost, or if it was rejected. On 3/17/07, johann deneux <johann.deneux@gmail.com> wrote: > > commit 0ba8785483c2ee7f56e8f242e000f6cd17a7da40 > Author: Johann Deneux <johann.deneux@gmail.com> > Date: Sat Mar 17 22:23:44 2007 +0100 > > 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> > > diff --git a/drivers/input/joystick/iforce/iforce-ff.cb/drivers/input/joystick/iforce/iforce- > ff.c > index 8fb0c19..f2a4381 100644 > --- a/drivers/input/joystick/iforce/iforce- ff.c > +++ b/drivers/input/joystick/iforce/iforce-ff.c > @@ -2,7 +2,7 @@ > * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $ > * > * Copyright (c) 2000-2002 Vojtech Pavlik < vojtech@ucw.cz> > - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> > + * Copyright (c) 2001-2002, 2007 Johann Deneux < johann.deneux@gmail.com > > > * > * USB/RS232 I-Force joysticks and wheels. > */ > @@ -205,7 +205,7 @@ static int need_condition_modifier(struct ff_effect > *old, struct ff_effect *new) > int i; > > if (new->type != FF_SPRING && new->type != FF_FRICTION) { > - printk(KERN_WARNING "iforce.c: bad effect type in > need_condition_modifier\n"); > + warn("bad effect type in need_condition_modifier"); > return 0; > } > > @@ -227,7 +227,7 @@ static int need_condition_modifier(struct ff_effect > *old, struct ff_effect *new) > static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect > *effect) > { > if (effect->type != FF_CONSTANT) { > - printk(KERN_WARNING "iforce.c: bad effect type in > need_envelope_modifier\n"); > + warn("bad effect type in need_envelope_modifier"); > return 0; > } > > @@ -258,7 +258,7 @@ static int need_envelope_modifier(struct ff_effect > *old, struct ff_effect *effec > break; > > default: > - printk(KERN_WARNING "iforce.c: bad effect type in > need_envelope_modifier\n"); > + warn("bad effect type in need_envelope_modifier"); > } > > return 0; > @@ -271,7 +271,7 @@ static int need_envelope_modifier(struct ff_effect > *old, struct ff_effect *effec > static int need_period_modifier(struct ff_effect *old, struct ff_effect > *new) > { > if (new->type != FF_PERIODIC) { > - printk(KERN_WARNING "iforce.c: bad effect type in > need_period_modifier\n"); > + warn("bad effect type in need_period_modifier"); > return 0; > } > return (old->u.periodic.period != new->u.periodic.period > diff --git a/drivers/input/joystick/iforce/iforce-main.cb/drivers/input/joystick/iforce/iforce- > main.c > index 3393a37..bd5a6de 100644 > --- a/drivers/input/joystick/iforce/iforce-main.c > +++ b/drivers/input/joystick/iforce/iforce-main.c > @@ -2,7 +2,7 @@ > * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $ > * > * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> > - * Copyright (c) 2001-2002 Johann Deneux < deneux@ifrance.com > > + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> > * > * USB/RS232 I-Force joysticks and wheels. > */ > @@ -29,7 +29,7 @@ > > #include "iforce.h" > > -MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux < > deneux@ifrance.com>"); > +MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <johann.deneux@gmail.com > >"); > MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver"); > MODULE_LICENSE("GPL"); > > @@ -220,7 +220,7 @@ static void iforce_release(struct input_dev *dev) > /* Check: no effects should be present in memory */ > for (i = 0; i < dev->ff->max_effects; i++) { > if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { > - printk(KERN_WARNING "iforce_release: Device still owns effects\n"); > + warn("iforce_release: Device still owns effects"); > break; > } > } > @@ -232,7 +232,7 @@ static void iforce_release(struct input_dev *dev) > switch (iforce->bus) { > #ifdef CONFIG_JOYSTICK_IFORCE_USB > case IFORCE_USB: > - usb_unlink_urb(iforce->irq); > + usb_kill_urb(iforce->irq); > > /* The device was unplugged before the file > * was released */ > @@ -324,7 +324,7 @@ int iforce_init_device(struct iforce *iforce) > break; > > if (i == 20) { /* 5 seconds */ > - printk(KERN_ERR "iforce-main.c: Timeout waiting for response from > device.\n"); > + err("Timeout waiting for response from device."); > error = -ENODEV; > goto fail; > } > @@ -336,26 +336,26 @@ int iforce_init_device(struct iforce *iforce) > if (!iforce_get_id_packet(iforce, "M")) > input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; > else > - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet > M\n"); > + warn("Device does not respond to id packet M"); > > if (!iforce_get_id_packet(iforce, "P")) > input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; > else > - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet > P\n"); > + warn("Device does not respond to id packet P"); > > if (!iforce_get_id_packet(iforce, "B")) > iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1]; > else > - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet > B\n"); > + warn("Device does not respond to id packet B"); > > if (!iforce_get_id_packet(iforce, "N")) > ff_effects = iforce->edata[1]; > else > - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet > N\n"); > + warn("Device does not respond to id packet N"); > > /* Check if the device can store more effects than the driver can really > handle */ > if (ff_effects > IFORCE_EFFECTS_MAX) { > - printk(KERN_WARNING "iforce: Limiting number of effects to %d (device > reports %d)\n", > + warn("Limiting number of effects to %d (device reports %d)", > IFORCE_EFFECTS_MAX, ff_effects); > ff_effects = IFORCE_EFFECTS_MAX; > } > @@ -457,8 +457,6 @@ int iforce_init_device(struct iforce *iforce) > if (error) > goto fail; > > - printk(KERN_DEBUG "iforce->dev->open = %p\n", iforce->dev->open); > - > return 0; > > fail: input_free_device(input_dev); > diff --git a/drivers/input/joystick/iforce/iforce- packets.cb/drivers/input/joystick/iforce/iforce- > packets.c > index 808f059..21c4e13 100644 > --- a/drivers/input/joystick/iforce/iforce-packets.c > +++ b/drivers/input/joystick/iforce/iforce-packets.c > @@ -2,7 +2,7 @@ > * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $ > * > * Copyright (c) 2000-2002 Vojtech Pavlik < vojtech@ucw.cz> > - * Copyright (c) 2001-2002 Johann Deneux < deneux@ifrance.com> > + * Copyright (c) 2001-2002, 2007 Johann Deneux < johann.deneux@gmail.com > > > * > * USB/RS232 I-Force joysticks and wheels. > */ > @@ -39,10 +39,10 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned > char *data) > { > int i; > > - printk(KERN_DEBUG "iforce.c: %s ( cmd = %04x, data = ", msg, cmd); > + printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd); > for (i = 0; i < LO(cmd); i++) > printk("%02x ", data[i]); > - printk(")\n"); > + printk("\n"); > } > > /* > @@ -65,8 +65,9 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, > unsigned char* data) > head = iforce->xmit.head; > tail = iforce->xmit.tail; > > + > if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) { > - printk(KERN_WARNING "iforce.c: not enough space in xmit buffer to send > new packet\n"); > + warn("not enough space in xmit buffer to send new packet"); > spin_unlock_irqrestore(&iforce->xmit_lock, flags); > return -1; > } > @@ -126,8 +127,6 @@ int iforce_control_playback(struct iforce* iforce, u16 > id, unsigned int value) > { > unsigned char data[3]; > > -printk(KERN_DEBUG "iforce-packets.c: control_playback %d %d\n", id, > value); > - > data[0] = LO(id); > data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0; > data[2] = LO(value); > @@ -151,7 +150,7 @@ static int mark_core_as_ready(struct iforce *iforce, > unsigned short addr) > return 0; > } > } > - printk(KERN_WARNING "iforce-packets.c: unused effect %04x updated > !!!\n", addr); > + warn("unused effect %04x updated !!!", addr); > return -1; > } > > @@ -162,7 +161,7 @@ void iforce_process_packet(struct iforce *iforce, u16 > cmd, unsigned char *data) > static int being_used = 0; > > if (being_used) > - printk(KERN_WARNING "iforce-packets.c: re-entrant call to iforce_process > %d\n", being_used); > + warn("re-entrant call to iforce_process %d", being_used); > being_used++; > > #ifdef CONFIG_JOYSTICK_IFORCE_232 > @@ -266,7 +265,7 @@ int iforce_get_id_packet(struct iforce *iforce, char > *packet) > return -1; > } > #else > - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = USB!\n"); > + err("iforce_get_id_packet: iforce->bus = USB!"); > #endif > break; > > @@ -284,13 +283,12 @@ int iforce_get_id_packet(struct iforce *iforce, char > *packet) > return -1; > } > #else > - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = SERIO!\n"); > + err("iforce_get_id_packet: iforce->bus = SERIO!"); > #endif > break; > > default: > - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = %d\n", > - iforce->bus); > + err("iforce_get_id_packet: iforce->bus = %d", iforce->bus); > break; > } > > diff --git a/drivers/input/joystick/iforce/iforce-serio.cb/drivers/input/joystick/iforce/iforce- > serio.c > index ec4be53..7b4bc19 100644 > --- a/drivers/input/joystick/iforce/iforce-serio.c > +++ b/drivers/input/joystick/iforce/iforce-serio.c > @@ -2,7 +2,7 @@ > * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $ > * > * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> > - * Copyright (c) 2001 Johann Deneux < deneux@ifrance.com> > + * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com> > * > * USB/RS232 I-Force joysticks and wheels. > */ > diff --git a/drivers/input/joystick/iforce/iforce- usb.cb/drivers/input/joystick/iforce/iforce- > usb.c > index 80cdebc..750099d 100644 > --- a/drivers/input/joystick/iforce/iforce-usb.c > +++ b/drivers/input/joystick/iforce/iforce-usb.c > @@ -2,7 +2,7 @@ > * $Id: iforce-usb.c ,v 1.16 2002/06/09 11:08:04 jdeneux Exp $ > * > * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz > > - * Copyright (c) 2001-2002 Johann Deneux < deneux@ifrance.com> > + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> > * > * USB/RS232 I-Force joysticks and wheels. > */ > @@ -65,7 +65,7 @@ void iforce_usb_xmit(struct iforce *iforce) > XMIT_INC(iforce->xmit.tail, n); > > if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { > - printk(KERN_WARNING "iforce-usb.c: iforce_usb_xmit: usb_submit_urb > failed %d\n", n); > + warn("usb_submit_urb failed %d\n", n); > } > > /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. > @@ -110,7 +110,7 @@ static void iforce_usb_out(struct urb *urb) > struct iforce *iforce = urb->context; > > if (urb->status) { > - printk(KERN_DEBUG "iforce_usb_out: urb->status %d, exiting", > urb->status); > + dbg("urb->status %d, exiting", urb->status); > return; > } > > @@ -190,10 +190,9 @@ fail: > /* Called by iforce_delete() */ > void iforce_usb_delete(struct iforce* iforce) > { > - usb_unlink_urb(iforce->irq); > -/* Is it ok to unlink those ? */ > - usb_unlink_urb(iforce->out); > - usb_unlink_urb(iforce->ctrl); > + usb_kill_urb(iforce->irq); > + usb_kill_urb(iforce->out); > + usb_kill_urb(iforce->ctrl); > > usb_free_urb(iforce->irq); > usb_free_urb(iforce->out); > diff --git a/drivers/input/joystick/iforce/iforce.h > b/drivers/input/joystick/iforce/iforce.h > index ffaeaef..dadcf4f 100644 > --- a/drivers/input/joystick/iforce/iforce.h > +++ b/drivers/input/joystick/iforce/iforce.h > @@ -2,7 +2,7 @@ > * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $ > * > * Copyright (c) 2000-2002 Vojtech Pavlik < vojtech@ucw.cz> > - * Copyright (c) 2001-2002 Johann Deneux < deneux@ifrance.com> > + * Copyright (c) 2001-2002, 2007 Johann Deneux < johann.deneux@gmail.com > > > * > * USB/RS232 I-Force joysticks and wheels. > */ > [-- Attachment #2: Type: text/html, Size: 17570 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iforce: Use usb_kill_urb instead of usb_unlink_urb. 2007-03-17 21:50 ` johann deneux @ 2007-03-18 1:37 ` Dmitry Torokhov 2007-03-18 8:01 ` johann deneux 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Torokhov @ 2007-03-18 1:37 UTC (permalink / raw) To: johann deneux; +Cc: linux-input, linux-usb-devel Hi Johann, On Saturday 17 March 2007 17:50, johann deneux wrote: > A note about that patch: Apparently Anders Fugmann submitted a patch to use > usb_kill_urb to linux-usb-devel for version 2.6.10. > I don't know if this patch got lost, or if it was rejected. Since every other USB dirver uses usb_kill_urb it loosk like the patch was just missed... > > On 3/17/07, johann deneux <johann.deneux@gmail.com> wrote: > > > > commit 0ba8785483c2ee7f56e8f242e000f6cd17a7da40 > > Author: Johann Deneux <johann.deneux@gmail.com> > > Date: Sat Mar 17 22:23:44 2007 +0100 > > > > 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()... > > Since there seems a lot of implementations of r warn(), err(), etc what kind of output would iforce produce? -- Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iforce: Use usb_kill_urb instead of usb_unlink_urb. 2007-03-18 1:37 ` Dmitry Torokhov @ 2007-03-18 8:01 ` johann deneux 0 siblings, 0 replies; 6+ messages in thread From: johann deneux @ 2007-03-18 8:01 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input, linux-usb-devel Hi Dmitry, On 3/18/07, Dmitry Torokhov <dtor@insightbb.com> wrote: > Hi Johann, > > On Saturday 17 March 2007 17:50, johann deneux wrote: > > A note about that patch: Apparently Anders Fugmann submitted a patch to use > > usb_kill_urb to linux-usb-devel for version 2.6.10. > > I don't know if this patch got lost, or if it was rejected. > > Since every other USB dirver uses usb_kill_urb it loosk like the patch was > just missed... > > > > > On 3/17/07, johann deneux <johann.deneux@gmail.com> wrote: > > > > > > commit 0ba8785483c2ee7f56e8f242e000f6cd17a7da40 > > > Author: Johann Deneux <johann.deneux@gmail.com> > > > Date: Sat Mar 17 22:23:44 2007 +0100 > > > > > > 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()... > > > > > Since there seems a lot of implementations of r warn(), err(), etc what kind > of output would iforce produce? > It uses the implementation from include/linux/usb.h. The output from the module should be approximately the same as before, except for debug messages which were previously inconditionally produced, and are now produced only when macro DEBUG is defined and non-zero. Macros warn(), dbg()... in usb.h use printk KERN_WARNING, KERN_DEBUG... -- Johann ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iforce: Use usb_kill_urb instead of usb_unlink_urb. 2007-03-17 21:43 ` [PATCH] iforce: Use usb_kill_urb instead of usb_unlink_urb johann deneux 2007-03-17 21:50 ` johann deneux @ 2007-03-19 16:18 ` Dmitry Torokhov 2007-03-19 20:49 ` johann deneux 1 sibling, 1 reply; 6+ messages in thread From: Dmitry Torokhov @ 2007-03-19 16:18 UTC (permalink / raw) To: linux-input; +Cc: johann deneux Hi Johann, On Saturday 17 March 2007 17:43, johann deneux wrote: > commit 0ba8785483c2ee7f56e8f242e000f6cd17a7da40 > Author: Johann Deneux <johann.deneux@gmail.com> > Date: Sat Mar 17 22:23:44 2007 +0100 I tried applying your patch but it appears that your mailer mangled it. Could you please resend it? Thanks! -- Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iforce: Use usb_kill_urb instead of usb_unlink_urb. 2007-03-19 16:18 ` Dmitry Torokhov @ 2007-03-19 20:49 ` johann deneux 0 siblings, 0 replies; 6+ messages in thread From: johann deneux @ 2007-03-19 20:49 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input [-- Attachment #1: Type: text/plain, Size: 11607 bytes --] New attempt... Also attached it if the inlined patched gets corrupted. commit 0ba8785483c2ee7f56e8f242e000f6cd17a7da40 Author: Johann Deneux <johann.deneux@gmail.com> Date: Sat Mar 17 22:23:44 2007 +0100 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> diff --git a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c index 8fb0c19..f2a4381 100644 --- a/drivers/input/joystick/iforce/iforce-ff.c +++ b/drivers/input/joystick/iforce/iforce-ff.c @@ -2,7 +2,7 @@ * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -205,7 +205,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) int i; if (new->type != FF_SPRING && new->type != FF_FRICTION) { - printk(KERN_WARNING "iforce.c: bad effect type in need_condition_modifier\n"); + warn("bad effect type in need_condition_modifier"); return 0; } @@ -227,7 +227,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect) { if (effect->type != FF_CONSTANT) { - printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); + warn("bad effect type in need_envelope_modifier"); return 0; } @@ -258,7 +258,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec break; default: - printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); + warn("bad effect type in need_envelope_modifier"); } return 0; @@ -271,7 +271,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec static int need_period_modifier(struct ff_effect *old, struct ff_effect *new) { if (new->type != FF_PERIODIC) { - printk(KERN_WARNING "iforce.c: bad effect type in need_period_modifier\n"); + warn("bad effect type in need_period_modifier"); return 0; } 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 3393a37..bd5a6de 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -2,7 +2,7 @@ * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -29,7 +29,7 @@ #include "iforce.h" -MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <deneux@ifrance.com>"); +MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <johann.deneux@gmail.com>"); MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver"); MODULE_LICENSE("GPL"); @@ -220,7 +220,7 @@ static void iforce_release(struct input_dev *dev) /* Check: no effects should be present in memory */ for (i = 0; i < dev->ff->max_effects; i++) { if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { - printk(KERN_WARNING "iforce_release: Device still owns effects\n"); + warn("iforce_release: Device still owns effects"); break; } } @@ -232,7 +232,7 @@ static void iforce_release(struct input_dev *dev) switch (iforce->bus) { #ifdef CONFIG_JOYSTICK_IFORCE_USB case IFORCE_USB: - usb_unlink_urb(iforce->irq); + usb_kill_urb(iforce->irq); /* The device was unplugged before the file * was released */ @@ -324,7 +324,7 @@ int iforce_init_device(struct iforce *iforce) break; if (i == 20) { /* 5 seconds */ - printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n"); + err("Timeout waiting for response from device."); error = -ENODEV; goto fail; } @@ -336,26 +336,26 @@ int iforce_init_device(struct iforce *iforce) if (!iforce_get_id_packet(iforce, "M")) input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n"); + warn("Device does not respond to id packet M"); if (!iforce_get_id_packet(iforce, "P")) input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n"); + warn("Device does not respond to id packet P"); if (!iforce_get_id_packet(iforce, "B")) iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet B\n"); + warn("Device does not respond to id packet B"); if (!iforce_get_id_packet(iforce, "N")) ff_effects = iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet N\n"); + warn("Device does not respond to id packet N"); /* Check if the device can store more effects than the driver can really handle */ if (ff_effects > IFORCE_EFFECTS_MAX) { - printk(KERN_WARNING "iforce: Limiting number of effects to %d (device reports %d)\n", + warn("Limiting number of effects to %d (device reports %d)", IFORCE_EFFECTS_MAX, ff_effects); ff_effects = IFORCE_EFFECTS_MAX; } @@ -457,8 +457,6 @@ int iforce_init_device(struct iforce *iforce) if (error) goto fail; - printk(KERN_DEBUG "iforce->dev->open = %p\n", iforce->dev->open); - return 0; 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 808f059..21c4e13 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -2,7 +2,7 @@ * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -39,10 +39,10 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data) { int i; - printk(KERN_DEBUG "iforce.c: %s ( cmd = %04x, data = ", msg, cmd); + printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd); for (i = 0; i < LO(cmd); i++) printk("%02x ", data[i]); - printk(")\n"); + printk("\n"); } /* @@ -65,8 +65,9 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data) head = iforce->xmit.head; tail = iforce->xmit.tail; + if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) { - printk(KERN_WARNING "iforce.c: not enough space in xmit buffer to send new packet\n"); + warn("not enough space in xmit buffer to send new packet"); spin_unlock_irqrestore(&iforce->xmit_lock, flags); return -1; } @@ -126,8 +127,6 @@ int iforce_control_playback(struct iforce* iforce, u16 id, unsigned int value) { unsigned char data[3]; -printk(KERN_DEBUG "iforce-packets.c: control_playback %d %d\n", id, value); - data[0] = LO(id); data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0; data[2] = LO(value); @@ -151,7 +150,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr) return 0; } } - printk(KERN_WARNING "iforce-packets.c: unused effect %04x updated !!!\n", addr); + warn("unused effect %04x updated !!!", addr); return -1; } @@ -162,7 +161,7 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data) static int being_used = 0; if (being_used) - printk(KERN_WARNING "iforce-packets.c: re-entrant call to iforce_process %d\n", being_used); + warn("re-entrant call to iforce_process %d", being_used); being_used++; #ifdef CONFIG_JOYSTICK_IFORCE_232 @@ -266,7 +265,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) return -1; } #else - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = USB!\n"); + err("iforce_get_id_packet: iforce->bus = USB!"); #endif break; @@ -284,13 +283,12 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) return -1; } #else - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = SERIO!\n"); + err("iforce_get_id_packet: iforce->bus = SERIO!"); #endif break; default: - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = %d\n", - iforce->bus); + err("iforce_get_id_packet: iforce->bus = %d", iforce->bus); break; } diff --git a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c index ec4be53..7b4bc19 100644 --- a/drivers/input/joystick/iforce/iforce-serio.c +++ b/drivers/input/joystick/iforce/iforce-serio.c @@ -2,7 +2,7 @@ * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $ * * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 80cdebc..750099d 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -2,7 +2,7 @@ * $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -65,7 +65,7 @@ void iforce_usb_xmit(struct iforce *iforce) XMIT_INC(iforce->xmit.tail, n); if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { - printk(KERN_WARNING "iforce-usb.c: iforce_usb_xmit: usb_submit_urb failed %d\n", n); + warn("usb_submit_urb failed %d\n", n); } /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. @@ -110,7 +110,7 @@ static void iforce_usb_out(struct urb *urb) struct iforce *iforce = urb->context; if (urb->status) { - printk(KERN_DEBUG "iforce_usb_out: urb->status %d, exiting", urb->status); + dbg("urb->status %d, exiting", urb->status); return; } @@ -190,10 +190,9 @@ fail: /* Called by iforce_delete() */ void iforce_usb_delete(struct iforce* iforce) { - usb_unlink_urb(iforce->irq); -/* Is it ok to unlink those ? */ - usb_unlink_urb(iforce->out); - usb_unlink_urb(iforce->ctrl); + usb_kill_urb(iforce->irq); + usb_kill_urb(iforce->out); + usb_kill_urb(iforce->ctrl); usb_free_urb(iforce->irq); usb_free_urb(iforce->out); diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index ffaeaef..dadcf4f 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h @@ -2,7 +2,7 @@ * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ [-- Attachment #2: patch-2007-03-17 --] [-- Type: application/octet-stream, Size: 11574 bytes --] commit 0ba8785483c2ee7f56e8f242e000f6cd17a7da40 Author: Johann Deneux <johann.deneux@gmail.com> Date: Sat Mar 17 22:23:44 2007 +0100 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> diff --git a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c index 8fb0c19..f2a4381 100644 --- a/drivers/input/joystick/iforce/iforce-ff.c +++ b/drivers/input/joystick/iforce/iforce-ff.c @@ -2,7 +2,7 @@ * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -205,7 +205,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) int i; if (new->type != FF_SPRING && new->type != FF_FRICTION) { - printk(KERN_WARNING "iforce.c: bad effect type in need_condition_modifier\n"); + warn("bad effect type in need_condition_modifier"); return 0; } @@ -227,7 +227,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect) { if (effect->type != FF_CONSTANT) { - printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); + warn("bad effect type in need_envelope_modifier"); return 0; } @@ -258,7 +258,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec break; default: - printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); + warn("bad effect type in need_envelope_modifier"); } return 0; @@ -271,7 +271,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec static int need_period_modifier(struct ff_effect *old, struct ff_effect *new) { if (new->type != FF_PERIODIC) { - printk(KERN_WARNING "iforce.c: bad effect type in need_period_modifier\n"); + warn("bad effect type in need_period_modifier"); return 0; } 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 3393a37..bd5a6de 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -2,7 +2,7 @@ * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -29,7 +29,7 @@ #include "iforce.h" -MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <deneux@ifrance.com>"); +MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <johann.deneux@gmail.com>"); MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver"); MODULE_LICENSE("GPL"); @@ -220,7 +220,7 @@ static void iforce_release(struct input_dev *dev) /* Check: no effects should be present in memory */ for (i = 0; i < dev->ff->max_effects; i++) { if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { - printk(KERN_WARNING "iforce_release: Device still owns effects\n"); + warn("iforce_release: Device still owns effects"); break; } } @@ -232,7 +232,7 @@ static void iforce_release(struct input_dev *dev) switch (iforce->bus) { #ifdef CONFIG_JOYSTICK_IFORCE_USB case IFORCE_USB: - usb_unlink_urb(iforce->irq); + usb_kill_urb(iforce->irq); /* The device was unplugged before the file * was released */ @@ -324,7 +324,7 @@ int iforce_init_device(struct iforce *iforce) break; if (i == 20) { /* 5 seconds */ - printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n"); + err("Timeout waiting for response from device."); error = -ENODEV; goto fail; } @@ -336,26 +336,26 @@ int iforce_init_device(struct iforce *iforce) if (!iforce_get_id_packet(iforce, "M")) input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n"); + warn("Device does not respond to id packet M"); if (!iforce_get_id_packet(iforce, "P")) input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n"); + warn("Device does not respond to id packet P"); if (!iforce_get_id_packet(iforce, "B")) iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet B\n"); + warn("Device does not respond to id packet B"); if (!iforce_get_id_packet(iforce, "N")) ff_effects = iforce->edata[1]; else - printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet N\n"); + warn("Device does not respond to id packet N"); /* Check if the device can store more effects than the driver can really handle */ if (ff_effects > IFORCE_EFFECTS_MAX) { - printk(KERN_WARNING "iforce: Limiting number of effects to %d (device reports %d)\n", + warn("Limiting number of effects to %d (device reports %d)", IFORCE_EFFECTS_MAX, ff_effects); ff_effects = IFORCE_EFFECTS_MAX; } @@ -457,8 +457,6 @@ int iforce_init_device(struct iforce *iforce) if (error) goto fail; - printk(KERN_DEBUG "iforce->dev->open = %p\n", iforce->dev->open); - return 0; 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 808f059..21c4e13 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -2,7 +2,7 @@ * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -39,10 +39,10 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data) { int i; - printk(KERN_DEBUG "iforce.c: %s ( cmd = %04x, data = ", msg, cmd); + printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd); for (i = 0; i < LO(cmd); i++) printk("%02x ", data[i]); - printk(")\n"); + printk("\n"); } /* @@ -65,8 +65,9 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data) head = iforce->xmit.head; tail = iforce->xmit.tail; + if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) { - printk(KERN_WARNING "iforce.c: not enough space in xmit buffer to send new packet\n"); + warn("not enough space in xmit buffer to send new packet"); spin_unlock_irqrestore(&iforce->xmit_lock, flags); return -1; } @@ -126,8 +127,6 @@ int iforce_control_playback(struct iforce* iforce, u16 id, unsigned int value) { unsigned char data[3]; -printk(KERN_DEBUG "iforce-packets.c: control_playback %d %d\n", id, value); - data[0] = LO(id); data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0; data[2] = LO(value); @@ -151,7 +150,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr) return 0; } } - printk(KERN_WARNING "iforce-packets.c: unused effect %04x updated !!!\n", addr); + warn("unused effect %04x updated !!!", addr); return -1; } @@ -162,7 +161,7 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data) static int being_used = 0; if (being_used) - printk(KERN_WARNING "iforce-packets.c: re-entrant call to iforce_process %d\n", being_used); + warn("re-entrant call to iforce_process %d", being_used); being_used++; #ifdef CONFIG_JOYSTICK_IFORCE_232 @@ -266,7 +265,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) return -1; } #else - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = USB!\n"); + err("iforce_get_id_packet: iforce->bus = USB!"); #endif break; @@ -284,13 +283,12 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) return -1; } #else - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = SERIO!\n"); + err("iforce_get_id_packet: iforce->bus = SERIO!"); #endif break; default: - printk(KERN_ERR "iforce_get_id_packet: iforce->bus = %d\n", - iforce->bus); + err("iforce_get_id_packet: iforce->bus = %d", iforce->bus); break; } diff --git a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c index ec4be53..7b4bc19 100644 --- a/drivers/input/joystick/iforce/iforce-serio.c +++ b/drivers/input/joystick/iforce/iforce-serio.c @@ -2,7 +2,7 @@ * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $ * * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 80cdebc..750099d 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -2,7 +2,7 @@ * $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ @@ -65,7 +65,7 @@ void iforce_usb_xmit(struct iforce *iforce) XMIT_INC(iforce->xmit.tail, n); if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { - printk(KERN_WARNING "iforce-usb.c: iforce_usb_xmit: usb_submit_urb failed %d\n", n); + warn("usb_submit_urb failed %d\n", n); } /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. @@ -110,7 +110,7 @@ static void iforce_usb_out(struct urb *urb) struct iforce *iforce = urb->context; if (urb->status) { - printk(KERN_DEBUG "iforce_usb_out: urb->status %d, exiting", urb->status); + dbg("urb->status %d, exiting", urb->status); return; } @@ -190,10 +190,9 @@ fail: /* Called by iforce_delete() */ void iforce_usb_delete(struct iforce* iforce) { - usb_unlink_urb(iforce->irq); -/* Is it ok to unlink those ? */ - usb_unlink_urb(iforce->out); - usb_unlink_urb(iforce->ctrl); + usb_kill_urb(iforce->irq); + usb_kill_urb(iforce->out); + usb_kill_urb(iforce->ctrl); usb_free_urb(iforce->irq); usb_free_urb(iforce->out); diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index ffaeaef..dadcf4f 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h @@ -2,7 +2,7 @@ * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $ * * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> - * Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> + * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com> * * USB/RS232 I-Force joysticks and wheels. */ ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-03-19 20:49 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <38b3b7c0703171439n10025a7bx55a588911eb765d6@mail.gmail.com> 2007-03-17 21:43 ` [PATCH] iforce: Use usb_kill_urb instead of usb_unlink_urb johann deneux 2007-03-17 21:50 ` johann deneux 2007-03-18 1:37 ` Dmitry Torokhov 2007-03-18 8:01 ` johann deneux 2007-03-19 16:18 ` Dmitry Torokhov 2007-03-19 20:49 ` johann deneux
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).