From: johann d. <jd...@us...> - 2002-06-09 11:08:08
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/iforce In directory usw-pr-cvs1:/tmp/cvs-serv5407/drivers/input/joystick/iforce Modified Files: iforce-packets.c iforce-usb.c iforce.h Log Message: Code cosmetics, warning and debug messages updated. Fix for double kfree(iforce). Index: iforce-packets.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/iforce/iforce-packets.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- iforce-packets.c 18 Mar 2002 21:30:08 -0000 1.14 +++ iforce-packets.c 9 Jun 2002 11:08:04 -0000 1.15 @@ -213,7 +213,6 @@ else input_report_abs(dev, ABS_HAT1Y, 0); } } - break; @@ -250,56 +249,64 @@ switch (iforce->bus) { -#ifdef IFORCE_USB - case IFORCE_USB: - - iforce->cr.bRequest = packet[0]; - iforce->ctrl->dev = iforce->usbdev; - - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(&iforce->wait, &wait); + case IFORCE_USB: - if (usb_submit_urb(iforce->ctrl, GFP_KERNEL)) { - set_current_state(TASK_RUNNING); - remove_wait_queue(&iforce->wait, &wait); - return -1; - } +#ifdef IFORCE_USB + iforce->cr.bRequest = packet[0]; + iforce->ctrl->dev = iforce->usbdev; - while (timeout && iforce->ctrl->status == -EINPROGRESS) - timeout = schedule_timeout(timeout); + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&iforce->wait, &wait); + if (usb_submit_urb(iforce->ctrl, GFP_KERNEL)) { set_current_state(TASK_RUNNING); remove_wait_queue(&iforce->wait, &wait); + return -1; + } - if (!timeout) { - usb_unlink_urb(iforce->ctrl); - return -1; - } + while (timeout && iforce->ctrl->status == -EINPROGRESS) + timeout = schedule_timeout(timeout); - break; + set_current_state(TASK_RUNNING); + remove_wait_queue(&iforce->wait, &wait); + + if (!timeout) { + usb_unlink_urb(iforce->ctrl); + return -1; + } +#else + printk(KERN_ERR "iforce_get_id_packet: iforce->bus = USB!\n"); #endif -#ifdef IFORCE_232 - case IFORCE_232: + break; - iforce->expect_packet = FF_CMD_QUERY; - iforce_send_packet(iforce, FF_CMD_QUERY, packet); + case IFORCE_232: - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(&iforce->wait, &wait); +#ifdef IFORCE_232 + iforce->expect_packet = FF_CMD_QUERY; + iforce_send_packet(iforce, FF_CMD_QUERY, packet); - while (timeout && iforce->expect_packet) - timeout = schedule_timeout(timeout); + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&iforce->wait, &wait); - set_current_state(TASK_RUNNING); - remove_wait_queue(&iforce->wait, &wait); + while (timeout && iforce->expect_packet) + timeout = schedule_timeout(timeout); - if (!timeout) { - iforce->expect_packet = 0; - return -1; - } + set_current_state(TASK_RUNNING); + remove_wait_queue(&iforce->wait, &wait); - break; + if (!timeout) { + iforce->expect_packet = 0; + return -1; + } +#else + printk(KERN_ERR "iforce_get_id_packet: iforce->bus = SERIO!\n"); #endif + break; + + default: + printk(KERN_ERR "iforce_get_id_packet: iforce->bus = %d\n", + iforce->bus); + break; } return -(iforce->edata[0] != packet[0]); Index: iforce-usb.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/iforce/iforce-usb.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- iforce-usb.c 8 Mar 2002 19:34:30 -0000 1.15 +++ iforce-usb.c 9 Jun 2002 11:08:04 -0000 1.16 @@ -86,7 +86,10 @@ { struct iforce *iforce = urb->context; - if (urb->status) return; + if (urb->status) { + printk(KERN_DEBUG "iforce_usb_out: urb->status %d, exiting", urb->status); + return; + } iforce_usb_xmit(iforce); @@ -164,6 +167,7 @@ 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); @@ -180,8 +184,10 @@ iforce->usbdev = NULL; input_unregister_device(&iforce->dev); - if (!open) + if (!open) { iforce_delete_device(iforce); + kfree(iforce); + } } static struct usb_device_id iforce_usb_ids [] = { @@ -191,6 +197,7 @@ { USB_DEVICE(0x05ef, 0x020a) }, /* AVB Top Shot Pegasus */ { USB_DEVICE(0x05ef, 0x8884) }, /* AVB Mag Turbo Force */ { USB_DEVICE(0x05ef, 0x8888) }, /* AVB Top Shot FFB Racing Wheel */ + { USB_DEVICE(0x061c, 0xc0a4) }, /* ACT LABS Force RS */ { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */ { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */ { } /* Terminating entry */ Index: iforce.h =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/iforce/iforce.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- iforce.h 8 Mar 2002 19:34:30 -0000 1.11 +++ iforce.h 9 Jun 2002 11:08:04 -0000 1.12 @@ -47,10 +47,10 @@ #define IFORCE_MAX_LENGTH 16 -#if defined(CONFIG_JOYSTICK_IFORCE_232) || defined(CONFIG_JOYSTICK_IFORCE_232_MODULE) +#if defined(CONFIG_JOYSTICK_IFORCE_232) #define IFORCE_232 1 #endif -#if defined(CONFIG_JOYSTICK_IFORCE_USB) || defined(CONFIG_JOYSTICK_IFORCE_USB_MODULE) +#if defined(CONFIG_JOYSTICK_IFORCE_USB) #define IFORCE_USB 2 #endif |