staging: comedi: usbduxsigma: use usbdux_pwm_stop() to force unlink urb

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 <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2013-05-23 12:44:17 -07:00 committed by Greg Kroah-Hartman
parent 0c32b57e77
commit 7bcc313186

View File

@ -1934,13 +1934,10 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp)
usbduxsub_tmp->urbOut = NULL; usbduxsub_tmp->urbOut = NULL;
} }
if (usbduxsub_tmp->urbPwm) { if (usbduxsub_tmp->urbPwm) {
if (usbduxsub_tmp->pwm_cmd_running) { /* force unlink urb */
usbduxsub_tmp->pwm_cmd_running = 0; usbdux_pwm_stop(usbduxsub_tmp, 1);
usbduxsub_unlink_PwmURBs(usbduxsub_tmp);
}
kfree(usbduxsub_tmp->urbPwm->transfer_buffer); kfree(usbduxsub_tmp->urbPwm->transfer_buffer);
usbduxsub_tmp->urbPwm->transfer_buffer = NULL; usbduxsub_tmp->urbPwm->transfer_buffer = NULL;
usb_kill_urb(usbduxsub_tmp->urbPwm);
usb_free_urb(usbduxsub_tmp->urbPwm); usb_free_urb(usbduxsub_tmp->urbPwm);
usbduxsub_tmp->urbPwm = NULL; usbduxsub_tmp->urbPwm = NULL;
} }
@ -1954,7 +1951,6 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp)
usbduxsub_tmp->dac_commands = NULL; usbduxsub_tmp->dac_commands = NULL;
kfree(usbduxsub_tmp->dux_commands); kfree(usbduxsub_tmp->dux_commands);
usbduxsub_tmp->dux_commands = NULL; usbduxsub_tmp->dux_commands = NULL;
usbduxsub_tmp->pwm_cmd_running = 0;
} }
static int usbduxsigma_attach_common(struct comedi_device *dev, static int usbduxsigma_attach_common(struct comedi_device *dev,