[PATCH 08/77] staging: comedi: usbduxsigma: use usbdux_ai_stop() to force unlink all urbs

H Hartley Sweeten hsweeten at visionengravers.com
Thu May 23 19:42:42 UTC 2013


In tidy_up(), instead of duplicating the code in usbdux_ai_stop() to unlink
all the input urbs, just use usbdux_ai_stop(). Since that function calls
usb_kill_urb() for all the urbs and clears the 'ai_cmd_running' flag, we
can also remove the redundant code in tidy_up().

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 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 eca29e4..2add3ef 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -1912,14 +1912,11 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp)
 	usbduxsub_tmp->probed = 0;
 
 	if (usbduxsub_tmp->urbIn) {
-		if (usbduxsub_tmp->ai_cmd_running) {
-			usbduxsub_tmp->ai_cmd_running = 0;
-			usbduxsub_unlink_InURBs(usbduxsub_tmp);
-		}
+		/* force unlink all urbs */
+		usbdux_ai_stop(usbduxsub_tmp, 1);
 		for (i = 0; i < usbduxsub_tmp->numOfInBuffers; i++) {
 			kfree(usbduxsub_tmp->urbIn[i]->transfer_buffer);
 			usbduxsub_tmp->urbIn[i]->transfer_buffer = NULL;
-			usb_kill_urb(usbduxsub_tmp->urbIn[i]);
 			usb_free_urb(usbduxsub_tmp->urbIn[i]);
 			usbduxsub_tmp->urbIn[i] = NULL;
 		}
@@ -1968,7 +1965,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->ai_cmd_running = 0;
 	usbduxsub_tmp->ao_cmd_running = 0;
 	usbduxsub_tmp->pwm_cmd_running = 0;
 }
-- 
1.8.1.4




More information about the devel mailing list