[RFC PATCH 28/39] staging: comedi: usbduxfast: tidy up send_dux_commands()

H Hartley Sweeten hsweeten at visionengravers.com
Wed May 1 22:31:05 UTC 2013


Rename this function so it has namespace associated with the driver.

For aesthetic reasons, rename the local variable 'tmp' to 'ret' as
this is more common for checking errno values.

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfonudation.org>
---
 drivers/staging/comedi/drivers/usbduxfast.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index 2232075..382e43b 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -168,23 +168,24 @@ struct usbduxfast_private {
 #define SENDADCOMMANDS            0
 #define SENDINITEP6               1
 
-static int send_dux_commands(struct comedi_device *dev, int cmd_type)
+static int usbduxfast_send_cmd(struct comedi_device *dev, int cmd_type)
 {
 	struct usb_interface *intf = comedi_to_usb_interface(dev);
 	struct usb_device *usb = interface_to_usbdev(intf);
 	struct usbduxfast_private *devpriv = dev->private;
-	int tmp, nsent;
+	int nsent;
+	int ret;
 
 	devpriv->duxbuf[0] = cmd_type;
 
-	tmp = usb_bulk_msg(usb, usb_sndbulkpipe(usb, CHANNELLISTEP),
+	ret = usb_bulk_msg(usb, usb_sndbulkpipe(usb, CHANNELLISTEP),
 			   devpriv->duxbuf, SIZEOFDUXBUF,
 			   &nsent, 10000);
-	if (tmp < 0)
+	if (ret < 0)
 		dev_err(dev->class_dev,
 			"could not transmit command to the usb-device, err=%d\n",
-			tmp);
-	return tmp;
+			ret);
+	return ret;
 }
 
 /*
@@ -998,7 +999,7 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
 	}
 
 	/* 0 means that the AD commands are sent */
-	result = send_dux_commands(dev, SENDADCOMMANDS);
+	result = usbduxfast_send_cmd(dev, SENDADCOMMANDS);
 	if (result < 0) {
 		up(&devpriv->sem);
 		return result;
@@ -1118,7 +1119,7 @@ static int usbduxfast_ai_insn_read(struct comedi_device *dev,
 	devpriv->duxbuf[LOGBASE + 0] = 0;
 
 	/* 0 means that the AD commands are sent */
-	err = send_dux_commands(dev, SENDADCOMMANDS);
+	err = usbduxfast_send_cmd(dev, SENDADCOMMANDS);
 	if (err < 0) {
 		up(&devpriv->sem);
 		return err;
-- 
1.8.1.4




More information about the devel mailing list