[PATCH 42/77] staging: comedi: usbduxsigma: kill all urbs before freeing them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For aesthetic reasons, kill all the urbs before freeing them.
Also, remove a redundant killing of the ai and ao urbs in the
(*detach).

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c
index 30ada7d..f85a477 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -1521,9 +1521,12 @@ static void tidy_up(struct usbduxsigma_private *usbduxsub_tmp)
 {
 	int i;
 
+	/* force unlink all urbs */
+	usbdux_ai_stop(usbduxsub_tmp, 1);
+	usbdux_ao_stop(usbduxsub_tmp, 1);
+	usbdux_pwm_stop(usbduxsub_tmp, 1);
+
 	if (usbduxsub_tmp->urbIn) {
-		/* 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;
@@ -1534,8 +1537,6 @@ static void tidy_up(struct usbduxsigma_private *usbduxsub_tmp)
 		usbduxsub_tmp->urbIn = NULL;
 	}
 	if (usbduxsub_tmp->urbOut) {
-		/* force unlink all urbs */
-		usbdux_ao_stop(usbduxsub_tmp, 1);
 		for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) {
 			if (usbduxsub_tmp->urbOut[i]->transfer_buffer) {
 				kfree(usbduxsub_tmp->
@@ -1552,8 +1553,6 @@ static void tidy_up(struct usbduxsigma_private *usbduxsub_tmp)
 		usbduxsub_tmp->urbOut = NULL;
 	}
 	if (usbduxsub_tmp->urbPwm) {
-		/* force unlink urb */
-		usbdux_pwm_stop(usbduxsub_tmp, 1);
 		kfree(usbduxsub_tmp->urbPwm->transfer_buffer);
 		usbduxsub_tmp->urbPwm->transfer_buffer = NULL;
 		usb_free_urb(usbduxsub_tmp->urbPwm);
@@ -1849,10 +1848,6 @@ static void usbduxsigma_detach(struct comedi_device *dev)
 	if (!devpriv)
 		return;
 
-	/* stop any running commands */
-	usbdux_ai_stop(devpriv, devpriv->ai_cmd_running);
-	usbdux_ao_stop(devpriv, devpriv->ao_cmd_running);
-
 	usb_set_intfdata(intf, NULL);
 
 	down(&devpriv->sem);
-- 
1.8.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux