[PATCH 30/39] staging: comedi: usbduxfast: tidy up usbduxfast_ai_stop()

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

 



Remove the devpriv sanity check, all the callers have previously
verified that its valid.

Absorb usbduxfast_unlink_urbs() into this function since it's the
only caller and the only thing it does is call usb_kill_urb().

This function will always succeed so just return 0 and remove the
local variable 'ret'.

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

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index e1c3787..dd4f177 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -185,45 +185,19 @@ static int usbduxfast_send_cmd(struct comedi_device *dev, int cmd_type)
 	return ret;
 }
 
-/*
- * Stops the data acquision.
- * It should be safe to call this function from any context.
- */
-static int usbduxfast_unlink_urbs(struct comedi_device *dev)
+static int usbduxfast_ai_stop(struct comedi_device *dev, int do_unlink)
 {
 	struct usbduxfast_private *devpriv = dev->private;
 
-	if (devpriv && devpriv->urb) {
-		devpriv->ai_cmd_running = 0;
-		/* waits until a running transfer is over */
-		usb_kill_urb(devpriv->urb);
-	}
-	return 0;
-}
-
-/*
- * This will stop a running acquisition operation.
- * Is called from within this driver from both the
- * interrupt context and from comedi.
- */
-static int usbduxfast_ai_stop(struct comedi_device *dev,
-			      int do_unlink)
-{
-	struct usbduxfast_private *devpriv = dev->private;
-	int ret = 0;
-
-	if (!devpriv) {
-		pr_err("%s: devpriv=NULL!\n", __func__);
-		return -EFAULT;
-	}
-
+	/* stop aquistion */
 	devpriv->ai_cmd_running = 0;
 
-	if (do_unlink)
-		/* stop aquistion */
-		ret = usbduxfast_unlink_urbs(dev);
+	if (do_unlink && devpriv->urb) {
+		/* kill the running transfer */
+		usb_kill_urb(devpriv->urb);
+	}
 
-	return ret;
+	return 0;
 }
 
 /*
-- 
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