In tidy_up(), instead of duplicating the code in usbdux_pwm_stop() to
unlink the pwm urb, just use usbdux_pwm_stop(). Since that function calls
usb_kill_urb() and clears the 'pwm_cmd_running' flag, we can also remove
the redundant code in tidy_up().

Signed-off-by: H Hartley Sweeten <[email protected]>
Cc: Ian Abbott <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 161c912..2c8f78b 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -1934,13 +1934,10 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp)
                usbduxsub_tmp->urbOut = NULL;
        }
        if (usbduxsub_tmp->urbPwm) {
-               if (usbduxsub_tmp->pwm_cmd_running) {
-                       usbduxsub_tmp->pwm_cmd_running = 0;
-                       usbduxsub_unlink_PwmURBs(usbduxsub_tmp);
-               }
+               /* force unlink urb */
+               usbdux_pwm_stop(usbduxsub_tmp, 1);
                kfree(usbduxsub_tmp->urbPwm->transfer_buffer);
                usbduxsub_tmp->urbPwm->transfer_buffer = NULL;
-               usb_kill_urb(usbduxsub_tmp->urbPwm);
                usb_free_urb(usbduxsub_tmp->urbPwm);
                usbduxsub_tmp->urbPwm = NULL;
        }
@@ -1954,7 +1951,6 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp)
        usbduxsub_tmp->dac_commands = NULL;
        kfree(usbduxsub_tmp->dux_commands);
        usbduxsub_tmp->dux_commands = NULL;
-       usbduxsub_tmp->pwm_cmd_running = 0;
 }
 
 static int usbduxsigma_attach_common(struct comedi_device *dev,
-- 
1.8.1.4

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to