]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Input: iforce - wait for command completion when closing the device
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 30 Dec 2009 20:18:24 +0000 (12:18 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 30 Dec 2009 20:19:38 +0000 (12:19 -0800)
We need to wait for the command to disable FF effects to complete before
continuing with closing the device.

Tested-by: Johannes Ebke <johannes.ebke@physik.uni-muenchen.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/joystick/iforce/iforce-main.c
drivers/input/joystick/iforce/iforce-usb.c

index acc3a9efb00f583c79fefcb5d62bc2729ff3013a..b1edd778639c6f1fb2985e782e7a731e42bca2cb 100644 (file)
@@ -228,6 +228,9 @@ static void iforce_close(struct input_dev *dev)
 
                /* Disable force feedback playback */
                iforce_send_packet(iforce, FF_CMD_ENABLE, "\001");
+               /* Wait for the command to complete */
+               wait_event_interruptible(iforce->wait,
+                       !test_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags));
        }
 
        switch (iforce->bus) {
index c0ad88369442ce914653146a4548538038242a06..b41303d3ec54c339428e60cc4684b727050e4af8 100644 (file)
@@ -109,6 +109,7 @@ static void iforce_usb_out(struct urb *urb)
        struct iforce *iforce = urb->context;
 
        if (urb->status) {
+               clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags);
                dbg("urb->status %d, exiting", urb->status);
                return;
        }