[PATCH] usb: test & measurement: Finish basic cleanup

Felipe Balbi felipe.balbi at nokia.com
Wed Jun 18 15:08:57 UTC 2008


Remove all (but 2) checkpatch.pl errors/warnings/checks.
The missing two will be fixed in later patches that will
play with local variables.

TODO:
	- Remove unnecessary ifdef debug
	- Alocate some local variables
	- get rid of unnecessary gotos (too much jumps on assembly code)
	- merge similar functions into one

Cc: Greg Kroah-Hartman <gregkh at suse.de>
Signed-off-by: Felipe Balbi <felipe.balbi at nokia.com>
---
 ...add-usb-test-and-measurement-class-driver.patch |  436 ++++++++++----------
 1 files changed, 217 insertions(+), 219 deletions(-)

diff --git a/usb-add-usb-test-and-measurement-class-driver.patch b/usb-add-usb-test-and-measurement-class-driver.patch
index b6e33ca..e2cdfaf 100644
--- a/usb-add-usb-test-and-measurement-class-driver.patch
+++ b/usb-add-usb-test-and-measurement-class-driver.patch
@@ -29,9 +29,9 @@ Not-Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
 
 Index: linux-2.6/drivers/usb/class/Kconfig
 ===================================================================
---- linux-2.6.orig/drivers/usb/class/Kconfig	2008-06-11 16:38:51.000000000 +0300
-+++ linux-2.6/drivers/usb/class/Kconfig	2008-06-18 00:06:46.000000000 +0300
-@@ -40,3 +40,13 @@
+--- linux-2.6.orig/drivers/usb/class/Kconfig
++++ linux-2.6/drivers/usb/class/Kconfig
+@@ -40,3 +40,13 @@ config USB_WDM
  	  To compile this driver as a module, choose M here: the
  	  module will be called cdc-wdm.
  
@@ -47,8 +47,8 @@ Index: linux-2.6/drivers/usb/class/Kconfig
 +	  module will be called usbtmc.
 Index: linux-2.6/drivers/usb/class/Makefile
 ===================================================================
---- linux-2.6.orig/drivers/usb/class/Makefile	2008-06-11 16:38:51.000000000 +0300
-+++ linux-2.6/drivers/usb/class/Makefile	2008-06-18 00:06:46.000000000 +0300
+--- linux-2.6.orig/drivers/usb/class/Makefile
++++ linux-2.6/drivers/usb/class/Makefile
 @@ -6,3 +6,4 @@
  obj-$(CONFIG_USB_ACM)		+= cdc-acm.o
  obj-$(CONFIG_USB_PRINTER)	+= usblp.o
@@ -56,9 +56,9 @@ Index: linux-2.6/drivers/usb/class/Makefile
 +obj-$(CONFIG_USB_TMC)		+= usbtmc.o
 Index: linux-2.6/drivers/usb/class/usbtmc.c
 ===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6/drivers/usb/class/usbtmc.c	2008-06-18 00:54:14.000000000 +0300
-@@ -0,0 +1,1578 @@
+--- /dev/null
++++ linux-2.6/drivers/usb/class/usbtmc.c
+@@ -0,0 +1,1576 @@
 +/* usbtmc.c
 + * Linux kernel module for USBTMC (USB Test and Measurement Class) devices
 + * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
@@ -89,7 +89,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +#include <linux/usb.h>
 +#include <linux/fs.h>
 +#include <linux/cdev.h>
-+#include <asm/uaccess.h>
++#include <linux/uaccess.h>
 +#include <linux/wait.h>
 +#include <linux/completion.h>
 +#include "usbtmc.h"
@@ -195,7 +195,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	/* USBTMC devices have only one setting,
 +	 * so use that (current setting)
 +	 */
-+	curr_setting=p_device_data->intf->cur_altsetting;
++	curr_setting = p_device_data->intf->cur_altsetting;
 +
 +#ifdef USBTMC_DEBUG
 +	printk(KERN_NOTICE "USBTMC: Number of endpoints is %u\n",
@@ -207,12 +207,14 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		end_point = &curr_setting->endpoint[n].desc;
 +
 +		if ((end_point->bEndpointAddress & USB_DIR_IN) &&
-+				((end_point->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
++				((end_point->bmAttributes &
++				  USB_ENDPOINT_XFERTYPE_MASK) ==
 +				 USB_ENDPOINT_XFER_BULK)) {
 +
 +			bulk_in = end_point->bEndpointAddress;
 +#ifdef USBTMC_DEBUG
-+			printk(KERN_NOTICE "USBTMC: Found bulk in endpoint at %u\n",
++			printk(KERN_NOTICE "USBTMC: Found bulk in endpoint "
++					"at %u\n",
 +					bulk_in);
 +#endif
 +			n = curr_setting->desc.bNumEndpoints;
@@ -225,12 +227,14 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		end_point = &curr_setting->endpoint[n].desc;
 +
 +		if (!(end_point->bEndpointAddress & USB_DIR_IN) &&
-+			((end_point->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)==
-+			USB_ENDPOINT_XFER_BULK)) {
++			((end_point->bmAttributes &
++			  USB_ENDPOINT_XFERTYPE_MASK) ==
++			 USB_ENDPOINT_XFER_BULK)) {
 +
 +			bulk_out = end_point->bEndpointAddress;
 +#ifdef USBTMC_DEBUG
-+			printk(KERN_NOTICE "USBTMC: Found Bulk out endpoint at %u\n",
++			printk(KERN_NOTICE "USBTMC: Found Bulk out endpoint "
++					"at %u\n",
 +					bulk_out);
 +#endif
 +			n = curr_setting->desc.bNumEndpoints;
@@ -244,7 +248,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	/* Minor number 0 is reserved for communication with driver */
 +
 +	p_device_data = kmalloc(sizeof(*p_device_data), GFP_KERNEL);
-+	if(!p_device_data) {
++	if (!p_device_data) {
 +		printk(KERN_ALERT "USBTMC: Unable to allocate kernel memory\n");
 +		return -ENOMEM;
 +	}
@@ -258,7 +262,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	return 0;
 +}
 +
-+static int usbtmc_release(struct inode *inode,struct file *filp)
++static int usbtmc_release(struct inode *inode, struct file *filp)
 +{
 +#ifdef USBTMC_DEBUG
 +	printk(KERN_ALERT "USBTMC: usbtmc_release called\n");
@@ -276,23 +280,23 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	return 0;
 +}
 +
-+static int usbtmc_buffer_append(char *dest,char *src,int *count)
++static int usbtmc_buffer_append(char *dest, char *src, int *count)
 +{
-+	int n=0;
-+	while(*src != 0){
++	int n = 0;
++
++	while (*src != 0) {
 +		*dest = *src;
 +		dest++;
 +		src++;
 +		n++;
 +		(*count)++;
 +	}
++
 +	return n;
 +}
 +
 +static ssize_t usbtmc_read(struct file *filp,
-+	char __user *buf,
-+	size_t count,
-+	loff_t *f_pos)
++	char __user *buf, size_t count, loff_t *f_pos)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	unsigned int pipe;
@@ -310,7 +314,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +#ifdef USBTMC_DEBUG
 +	printk(KERN_NOTICE "USBTMC: usbtmc_read called\n");
-+	printk(KERN_NOTICE "USBTMC: Count is %u\n",count);
++	printk(KERN_NOTICE "USBTMC: Count is %u\n", count);
 +#endif
 +
 +	/* Get pointer to private data structure */
@@ -320,8 +324,9 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		goto minor_null;
 +
 +	if (p_device_data->fread && p_device_data->eof) {
-+		/* Zero will tell fread that the EOF was reached. It will keep fread
-+		 * from retrying to read up to the max number of characters.
++		/* Zero will tell fread that the EOF was reached. It will
++		 * keep fread from retrying to read up to the max number
++		 * of characters.
 +		 */
 +		p_device_data->eof = 0;
 +		return 0;
@@ -330,8 +335,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	remaining = count;
 +	done = 0;
 +
-+	while (remaining > 0)
-+	{
++	while (remaining > 0) {
 +		if (remaining > USBTMC_SIZE_IOBUFFER - 12 - 3)
 +			this_part = USBTMC_SIZE_IOBUFFER - 12 - 3;
 +		else
@@ -361,7 +365,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		/* Send bulk URB */
 +		retval = usb_bulk_msg(p_device_data->usb_dev,
 +				pipe, usbtmc_buffer, 12,
-+				&actual,p_device_data->timeout);
++				&actual, p_device_data->timeout);
 +
 +		/* Store bTag (in case we need to abort) */
 +		usbtmc_last_write_bTag = p_device_data->bTag;
@@ -390,10 +394,11 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +				&actual, p_device_data->timeout);
 +
 +		/* Store bTag (in case we need to abort) */
-+		usbtmc_last_read_bTag=p_device_data->bTag;
++		usbtmc_last_read_bTag = p_device_data->bTag;
 +
 +		if (retval < 0) {
-+			printk(KERN_NOTICE "USBTMC: Unable to read data, error %d\n",
++			printk(KERN_NOTICE "USBTMC: Unable to read data, "
++					"error %d\n",
 +					retval);
 +			if (p_device_data->auto_abort)
 +				usbtmc_ioctl_abort_bulk_in(NULL, filp,
@@ -415,7 +420,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +		done += n_characters;
 +		if (n_characters < USBTMC_SIZE_IOBUFFER)
-+			remaining=0;
++			remaining = 0;
 +	}
 +
 +	if (p_device_data->add_nl_on_read == USBTMC_ATTRIB_VAL_ON) {
@@ -441,7 +446,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	return done;
 +
 +minor_null:
-+	if(*f_pos > 0)
++	if (*f_pos > 0)
 +		return 0;
 +
 +	p = (char *)usbtmc_buffer;
@@ -449,10 +454,10 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	/* Add header line to buffer */
 +	p = p + usbtmc_buffer_append(p,
-+		"Minor Number\tManufacturer\tProduct\tSerial Number\n",&t);
++		"Minor Number\tManufacturer\tProduct\tSerial Number\n", &t);
 +
 +	/* Find out which minor numbers are used */
-+	for(n = 1; n < USBTMC_MINOR_NUMBERS; n++)
++	for (n = 1; n < USBTMC_MINOR_NUMBERS; n++)
 +		if (usbtmc_minors[n]) {
 +		/* Add entry for this device */
 +		p_device = interface_to_usbdev(usbtmc_devs[n]->intf);
@@ -470,18 +475,16 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		p = p + usbtmc_buffer_append(p, "\n", &t);
 +	}
 +
-+	if(copy_to_user(buf, usbtmc_buffer, t)) {
++	if (copy_to_user(buf, usbtmc_buffer, t))
 +		return -EFAULT;
-+	}
++
 +	*f_pos = *f_pos+t;
 +
 +	return t;
 +}
 +
 +static ssize_t usbtmc_write(struct file *filp,
-+	const char __user *buf,
-+	size_t count,
-+	loff_t *f_pos)
++	const char __user *buf, size_t count, loff_t *f_pos)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	unsigned int pipe;
@@ -499,7 +502,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	p_device_data = filp->private_data;
 +
-+	if(!p_device_data->devno)
++	if (!p_device_data->devno)
 +		goto minor_null;
 +
 +	p_device_data->eof = 0;
@@ -536,7 +539,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		if (this_part == remaining)
 +			if (p_device_data->rem_nl_on_write ==
 +					USBTMC_ATTRIB_VAL_ON)
-+				if(usbtmc_buffer[12 + this_part - 1] == '\n')
++				if (usbtmc_buffer[12 + this_part - 1] == '\n')
 +					this_part--;
 +
 +		n_bytes = 12 + this_part;
@@ -558,8 +561,9 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +			p_device_data->bTag++;
 +
 +		if (retval < 0) {
-+			printk(KERN_NOTICE "USBTMC: Unable to send data, error %d\n",
-+				retval);
++			printk(KERN_NOTICE "USBTMC: Unable to send data, "
++					"error %d\n",
++					retval);
 +			if (p_device_data->auto_abort)
 +				usbtmc_ioctl_abort_bulk_out(NULL, filp,
 +						USBTMC_IOCTL_ABORT_BULK_OUT,
@@ -578,9 +582,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +}
 +
 +static int usbtmc_ioctl_abort_bulk_in(struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	int rv;
@@ -603,7 +605,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		p_device_data->timeout);
 +
 +	if (rv < 0) {
-+		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",rv);
++		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n", rv);
 +		return rv;
 +	}
 +
@@ -636,7 +638,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	}
 +
 +#ifdef USBTMC_DEBUG
-+	printk(KERN_NOTICE "USBTMC: wMaxPacketSize is %d\n",max_size);
++	printk(KERN_NOTICE "USBTMC: wMaxPacketSize is %d\n", max_size);
 +#endif
 +
 +	n = 0;
@@ -656,7 +658,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +		n++;
 +
-+		if(rv < 0) {
++		if (rv < 0) {
 +			printk(KERN_NOTICE "USBTMC: usb_bulk_msg returned %d\n",
 +				rv);
 +			return rv;
@@ -664,9 +666,10 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	} while ((actual == max_size) &&
 +			(n < USBTMC_MAX_READS_TO_CLEAR_BULK_IN));
 +
-+	if(actual == max_size) {
++	if (actual == max_size) {
 +		printk(KERN_NOTICE
-+			"USBTMC: Couldn't clear device buffer within %d cycles\n",
++			"USBTMC: Couldn't clear device buffer "
++			"within %d cycles\n",
 +			USBTMC_MAX_READS_TO_CLEAR_BULK_IN);
 +		return -EPERM;
 +	}
@@ -677,7 +680,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	rv = usb_control_msg(
 +		p_device_data->usb_dev,
-+		usb_rcvctrlpipe(p_device_data->usb_dev,0),
++		usb_rcvctrlpipe(p_device_data->usb_dev, 0),
 +		USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS,
 +		USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_ENDPOINT,
 +		0,
@@ -687,7 +690,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		p_device_data->timeout);
 +
 +	if (rv < 0) {
-+		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",rv);
++		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n", rv);
 +		return rv;
 +	}
 +
@@ -696,10 +699,10 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +			usbtmc_buffer[0]);
 +#endif
 +
-+	if(usbtmc_buffer[0]==USBTMC_STATUS_SUCCESS)
++	if (usbtmc_buffer[0] == USBTMC_STATUS_SUCCESS)
 +		return 0;
 +
-+	if(usbtmc_buffer[0]!=USBTMC_STATUS_PENDING) {
++	if (usbtmc_buffer[0] != USBTMC_STATUS_PENDING) {
 +		printk(KERN_NOTICE
 +				"USBTMC: INITIATE_ABORT_BULK_IN returned %x\n",
 +				usbtmc_buffer[0]);
@@ -731,9 +734,10 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	} while ((actual = max_size) &&
 +			(n < USBTMC_MAX_READS_TO_CLEAR_BULK_IN));
 +
-+	if(actual == max_size) {
++	if (actual == max_size) {
 +		printk(KERN_NOTICE
-+			"USBTMC: Couldn't clear device buffer within %d cycles\n",
++			"USBTMC: Couldn't clear device buffer "
++			"within %d cycles\n",
 +			USBTMC_MAX_READS_TO_CLEAR_BULK_IN);
 +		return -EPERM;
 +	}
@@ -741,10 +745,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	goto usbtmc_abort_bulk_in_status;
 +}
 +
-+static int usbtmc_ioctl_abort_bulk_out (struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++static int usbtmc_ioctl_abort_bulk_out(struct inode *inode,
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	int rv;
@@ -754,7 +756,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	rv = usb_control_msg(
 +			p_device_data->usb_dev,
-+			usb_rcvctrlpipe(p_device_data->usb_dev,0),
++			usb_rcvctrlpipe(p_device_data->usb_dev, 0),
 +			USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT,
 +			USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_ENDPOINT,
 +			usbtmc_last_write_bTag,
@@ -764,7 +766,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +			p_device_data->timeout);
 +
 +	if (rv < 0) {
-+		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",rv);
++		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n", rv);
 +		return rv;
 +	}
 +
@@ -773,7 +775,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +			usbtmc_buffer[0]);
 +#endif
 +
-+	if (usbtmc_buffer[0]!=USBTMC_STATUS_SUCCESS) {
++	if (usbtmc_buffer[0] != USBTMC_STATUS_SUCCESS) {
 +		printk(KERN_NOTICE
 +			"USBTMC: INITIATE_ABORT_BULK_OUT returned %x\n",
 +			usbtmc_buffer[0]);
@@ -786,7 +788,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	rv = usb_control_msg(
 +			p_device_data->usb_dev,
-+			usb_rcvctrlpipe(p_device_data->usb_dev,0),
++			usb_rcvctrlpipe(p_device_data->usb_dev, 0),
 +			USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS,
 +			USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_ENDPOINT,
 +			0,
@@ -798,7 +800,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	n++;
 +
 +	if (rv < 0) {
-+		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",rv);
++		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n", rv);
 +		return rv;
 +	}
 +
@@ -810,7 +812,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	if (usbtmc_buffer[0] == USBTMC_STATUS_SUCCESS)
 +		goto usbtmc_abort_bulk_out_clear_halt;
 +
-+	if ((usbtmc_buffer[0] == USBTMC_STATUS_PENDING)&&
++	if ((usbtmc_buffer[0] == USBTMC_STATUS_PENDING) &&
 +		(n < USBTMC_MAX_READS_TO_CLEAR_BULK_IN))
 +		goto usbtmc_abort_bulk_out_check_status;
 +
@@ -822,7 +824,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	rv = usb_control_msg(
 +		p_device_data->usb_dev,
-+		usb_sndctrlpipe(p_device_data->usb_dev,0),
++		usb_sndctrlpipe(p_device_data->usb_dev, 0),
 +		USB_REQ_CLEAR_FEATURE,
 +		USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT,
 +		USB_ENDPOINT_HALT,
@@ -832,7 +834,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		p_device_data->timeout);
 +
 +	if (rv < 0) {
-+		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",rv);
++		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n", rv);
 +		return rv;
 +	}
 +
@@ -840,9 +842,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +}
 +
 +static int usbtmc_ioctl_clear(struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	int rv;
@@ -868,7 +868,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +			1,
 +			p_device_data->timeout);
 +
-+	if(rv < 0) {
++	if (rv < 0) {
 +		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n", rv);
 +		return rv;
 +	}
@@ -928,9 +928,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +			usbtmc_buffer[0]);
 +#endif
 +
-+	if (usbtmc_buffer[0] == USBTMC_STATUS_SUCCESS) {
++	if (usbtmc_buffer[0] == USBTMC_STATUS_SUCCESS)
 +		goto usbtmc_clear_bulk_out_halt;
-+	}
 +
 +	if (usbtmc_buffer[0] != USBTMC_STATUS_PENDING) {
 +		printk(KERN_NOTICE "USBTMC: CHECK_CLEAR_STATUS returned %x\n",
@@ -956,7 +955,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		n++;
 +
 +		if (rv < 0) {
-+			printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",
++			printk(KERN_NOTICE "USBTMC: usb_control_msg "
++					"returned %d\n",
 +					rv);
 +			return rv;
 +		}
@@ -965,7 +965,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	if (actual == max_size) {
 +		printk(KERN_NOTICE
-+				"USBTMC: Couldn't clear device buffer within %d cycles\n",
++				"USBTMC: Couldn't clear device buffer "
++				"within %d cycles\n",
 +				USBTMC_MAX_READS_TO_CLEAR_BULK_IN);
 +		return -EPERM;
 +	}
@@ -994,76 +995,74 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +}
 +
 +static int usbtmc_ioctl_set_attribute(struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +
 +	p_device_data = filp->private_data;
 +
-+	switch(((struct usbtmc_attribute *)arg)->attribute)
-+	{
++	switch (((struct usbtmc_attribute *)arg)->attribute) {
 +	case USBTMC_ATTRIB_AUTO_ABORT_ON_ERROR:
-+		if((((struct usbtmc_attribute *)arg)->value!=
-+					USBTMC_ATTRIB_VAL_ON)&&
-+				(((struct usbtmc_attribute *)arg)->value!=
++		if ((((struct usbtmc_attribute *)arg)->value !=
++					USBTMC_ATTRIB_VAL_ON) &&
++				(((struct usbtmc_attribute *)arg)->value !=
 +				 USBTMC_ATTRIB_VAL_OFF))
 +			return -EINVAL;
-+		p_device_data->auto_abort=((struct usbtmc_attribute *)arg)->value;
++		p_device_data->auto_abort =
++			((struct usbtmc_attribute *)arg)->value;
 +		break;
 +
 +	case USBTMC_ATTRIB_READ_MODE:
-+		if((((struct usbtmc_attribute *)arg)->value!=
-+					USBTMC_ATTRIB_VAL_FREAD)&&
-+				(((struct usbtmc_attribute *)arg)->value!=
++		if ((((struct usbtmc_attribute *)arg)->value !=
++					USBTMC_ATTRIB_VAL_FREAD) &&
++				(((struct usbtmc_attribute *)arg)->value !=
 +				 USBTMC_ATTRIB_VAL_READ))
 +			return -EINVAL;
-+		p_device_data->fread=((struct usbtmc_attribute *)arg)->value;
++		p_device_data->fread = ((struct usbtmc_attribute *)arg)->value;
 +		break;
 +
 +	case USBTMC_ATTRIB_TIMEOUT:
-+		if(((struct usbtmc_attribute *)arg)->value<0)
++		if (((struct usbtmc_attribute *)arg)->value < 0)
 +			return -EINVAL;
-+		p_device_data->timeout=
-+			((struct usbtmc_attribute *)arg)->value/1000*HZ;
++		p_device_data->timeout =
++			((struct usbtmc_attribute *)arg)->value / 1000 * HZ;
 +		break;
 +
 +	case USBTMC_ATTRIB_TERM_CHAR_ENABLED:
-+		if((((struct usbtmc_attribute *)arg)->value!=
-+					USBTMC_ATTRIB_VAL_ON)&&
-+				(((struct usbtmc_attribute *)arg)->value!=
++		if ((((struct usbtmc_attribute *)arg)->value !=
++					USBTMC_ATTRIB_VAL_ON) &&
++				(((struct usbtmc_attribute *)arg)->value !=
 +				 USBTMC_ATTRIB_VAL_OFF))
 +			return -EINVAL;
-+		p_device_data->term_char_enabled=
++		p_device_data->term_char_enabled =
 +			((struct usbtmc_attribute *)arg)->value;
 +		break;
 +
 +	case USBTMC_ATTRIB_TERM_CHAR:
-+		if((((struct usbtmc_attribute *)arg)->value<0)||
-+				(((struct usbtmc_attribute *)arg)->value>255))
++		if ((((struct usbtmc_attribute *)arg)->value < 0) ||
++				(((struct usbtmc_attribute *)arg)->value > 255))
 +			return -EINVAL;
-+		p_device_data->term_char=
++		p_device_data->term_char =
 +			((struct usbtmc_attribute *)arg)->value;
 +		break;
 +
 +	case USBTMC_ATTRIB_ADD_NL_ON_READ:
-+		if((((struct usbtmc_attribute *)arg)->value!=
-+					USBTMC_ATTRIB_VAL_ON)&&
-+				(((struct usbtmc_attribute *)arg)->value!=
++		if ((((struct usbtmc_attribute *)arg)->value !=
++					USBTMC_ATTRIB_VAL_ON) &&
++				(((struct usbtmc_attribute *)arg)->value !=
 +				 USBTMC_ATTRIB_VAL_OFF))
 +			return -EINVAL;
-+		p_device_data->add_nl_on_read=
++		p_device_data->add_nl_on_read =
 +			((struct usbtmc_attribute *)arg)->value;
 +		break;
 +
 +	case USBTMC_ATTRIB_REM_NL_ON_WRITE:
-+		if((((struct usbtmc_attribute *)arg)->value!=
-+					USBTMC_ATTRIB_VAL_ON)&&
-+				(((struct usbtmc_attribute *)arg)->value!=
++		if ((((struct usbtmc_attribute *)arg)->value !=
++					USBTMC_ATTRIB_VAL_ON) &&
++				(((struct usbtmc_attribute *)arg)->value !=
 +				 USBTMC_ATTRIB_VAL_OFF))
 +			return -EINVAL;
-+		p_device_data->rem_nl_on_write=
++		p_device_data->rem_nl_on_write =
 +			((struct usbtmc_attribute *)arg)->value;
 +		break;
 +
@@ -1074,10 +1073,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	return 0;
 +}
 +
-+static int usbtmc_ioctl_get_attribute (struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++static int usbtmc_ioctl_get_attribute(struct inode *inode,
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	int n;
@@ -1085,71 +1082,73 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	p_device_data = filp->private_data;
 +
-+	switch(((struct usbtmc_attribute *)arg)->attribute)
-+	{
++	switch (((struct usbtmc_attribute *)arg)->attribute) {
 +	case USBTMC_ATTRIB_AUTO_ABORT_ON_ERROR:
-+		((struct usbtmc_attribute *)arg)->value=p_device_data->auto_abort;
++		((struct usbtmc_attribute *)arg)->value =
++			p_device_data->auto_abort;
 +		break;
 +
 +	case USBTMC_ATTRIB_READ_MODE:
-+		((struct usbtmc_attribute *)arg)->value=p_device_data->fread;
++		((struct usbtmc_attribute *)arg)->value =
++			p_device_data->fread;
 +		break;
 +
 +	case USBTMC_ATTRIB_TIMEOUT:
-+		((struct usbtmc_attribute *)arg)->value=
-+			p_device_data->timeout/HZ*1000;
++		((struct usbtmc_attribute *)arg)->value =
++			p_device_data->timeout / HZ * 1000;
 +		break;
 +
 +	case USBTMC_ATTRIB_NUM_INSTRUMENTS:
-+		count=0;
-+		for(n=1;n<USBTMC_MINOR_NUMBERS;n++)
-+			if(usbtmc_minors[n]) count++;
-+		((struct usbtmc_attribute *)arg)->value=count;
++		count = 0;
++		for (n = 1; n < USBTMC_MINOR_NUMBERS; n++)
++			if (usbtmc_minors[n])
++				count++;
++		((struct usbtmc_attribute *)arg)->value = count;
 +		break;
 +
 +	case USBTMC_ATTRIB_MINOR_NUMBERS:
-+		((struct usbtmc_attribute *)arg)->value=
++		((struct usbtmc_attribute *)arg)->value =
 +			USBTMC_MINOR_NUMBERS;
 +		break;
 +
 +	case USBTMC_ATTRIB_SIZE_IO_BUFFER:
-+		((struct usbtmc_attribute *)arg)->value=
++		((struct usbtmc_attribute *)arg)->value =
 +			USBTMC_SIZE_IOBUFFER;
 +		break;
 +
 +	case USBTMC_ATTRIB_DEFAULT_TIMEOUT:
-+		((struct usbtmc_attribute *)arg)->value=
-+			USBTMC_DEFAULT_TIMEOUT/HZ*1000;
++		((struct usbtmc_attribute *)arg)->value =
++			USBTMC_DEFAULT_TIMEOUT / HZ * 1000;
 +		break;
 +
 +	case USBTMC_ATTRIB_DEBUG_MODE:
-+		((struct usbtmc_attribute *)arg)->value=0;
++		((struct usbtmc_attribute *)arg)->value = 0;
 +#ifdef USBTMC_DEBUG
-+		((struct usbtmc_attribute *)arg)->value=1;
++		((struct usbtmc_attribute *)arg)->value = 1;
 +#endif
 +		break;
 +
 +	case USBTMC_ATTRIB_VERSION:
-+		((struct usbtmc_attribute *)arg)->value=USBTMC_VERSION;
++		((struct usbtmc_attribute *)arg)->value = USBTMC_VERSION;
 +		break;
 +
 +	case USBTMC_ATTRIB_TERM_CHAR_ENABLED:
-+		((struct usbtmc_attribute *)arg)->value=
++		((struct usbtmc_attribute *)arg)->value =
 +			p_device_data->term_char_enabled;
 +		break;
 +
 +	case USBTMC_ATTRIB_TERM_CHAR:
-+		((struct usbtmc_attribute *)arg)->value=
++		((struct usbtmc_attribute *)arg)->value =
 +			p_device_data->term_char;
 +		break;
 +
 +	case USBTMC_ATTRIB_ADD_NL_ON_READ:
-+		((struct usbtmc_attribute *)arg)->value=
++		((struct usbtmc_attribute *)arg)->value =
 +			p_device_data->add_nl_on_read;
 +		break;
 +
 +	case USBTMC_ATTRIB_REM_NL_ON_WRITE:
-+		((struct usbtmc_attribute *)arg)->value=
++		((struct usbtmc_attribute *)arg)->value =
 +			p_device_data->rem_nl_on_write;
 +		break;
 +
@@ -1161,9 +1160,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +}
 +
 +static int usbtmc_ioctl_clear_out_halt(struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	int rv;
@@ -1190,18 +1187,16 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +}
 +
 +static int usbtmc_ioctl_clear_in_halt(struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	int rv;
 +
 +	p_device_data = filp->private_data;
 +
-+	rv=usb_control_msg(
++	rv = usb_control_msg(
 +		p_device_data->usb_dev,
-+		usb_sndctrlpipe(p_device_data->usb_dev,0),
++		usb_sndctrlpipe(p_device_data->usb_dev, 0),
 +		USB_REQ_CLEAR_FEATURE,
 +		USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT,
 +		USB_ENDPOINT_HALT,
@@ -1211,7 +1206,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		p_device_data->timeout);
 +
 +	if (rv < 0) {
-+		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",rv);
++		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n", rv);
 +		return rv;
 +	}
 +
@@ -1219,9 +1214,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +}
 +
 +static int usbtmc_ioctl_get_capabilities(struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	int rv;
@@ -1230,7 +1223,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	rv = usb_control_msg(
 +		p_device_data->usb_dev,
-+		usb_rcvctrlpipe(p_device_data->usb_dev,0),
++		usb_rcvctrlpipe(p_device_data->usb_dev, 0),
 +		USBTMC_REQUEST_GET_CAPABILITIES,
 +		USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE,
 +		0,
@@ -1240,7 +1233,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		p_device_data->timeout);
 +
 +	if (rv < 0) {
-+		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",rv);
++		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",
++				rv);
 +		return rv;
 +	}
 +
@@ -1257,28 +1251,26 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +			usbtmc_buffer[15]);
 +#endif
 +
-+	if(usbtmc_buffer[0]!=USBTMC_STATUS_SUCCESS) {
++	if (usbtmc_buffer[0] != USBTMC_STATUS_SUCCESS) {
 +		printk(KERN_NOTICE "USBTMC: GET_CAPABILITIES returned %x\n",
 +			usbtmc_buffer[0]);
 +		return -EPERM;
 +	}
 +
-+	((struct usbtmc_dev_capabilities*)arg)->interface_capabilities=
++	((struct usbtmc_dev_capabilities *)arg)->interface_capabilities =
 +		usbtmc_buffer[4];
-+	((struct usbtmc_dev_capabilities*)arg)->device_capabilities=
++	((struct usbtmc_dev_capabilities *)arg)->device_capabilities =
 +		usbtmc_buffer[5];
-+	((struct usbtmc_dev_capabilities*)arg)->usb488_interface_capabilities=
++	((struct usbtmc_dev_capabilities *)arg)->usb488_interface_capabilities =
 +		usbtmc_buffer[14];
-+	((struct usbtmc_dev_capabilities*)arg)->usb488_device_capabilities=
++	((struct usbtmc_dev_capabilities *)arg)->usb488_device_capabilities =
 +		usbtmc_buffer[15];
 +
 +	return 0;
 +}
 +
-+static int usbtmc_ioctl_indicator_pulse (struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++static int usbtmc_ioctl_indicator_pulse(struct inode *inode,
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	int rv;
@@ -1287,7 +1279,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 +	rv = usb_control_msg(
 +		p_device_data->usb_dev,
-+		usb_rcvctrlpipe(p_device_data->usb_dev,0),
++		usb_rcvctrlpipe(p_device_data->usb_dev, 0),
 +		USBTMC_REQUEST_INDICATOR_PULSE,
 +		USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE,
 +		0,
@@ -1297,7 +1289,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		p_device_data->timeout);
 +
 +	if (rv < 0) {
-+		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n",rv);
++		printk(KERN_NOTICE "USBTMC: usb_control_msg returned %d\n", rv);
 +		return rv;
 +	}
 +
@@ -1315,10 +1307,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	return 0;
 +}
 +
-+static int usbtmc_ioctl_instrument_data (struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++static int usbtmc_ioctl_instrument_data(struct inode *inode,
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +	struct usbtmc_device_data *p_device_data;
 +	struct usb_device *p_device;
@@ -1349,16 +1339,16 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +		p_device->product, n))
 +		return -EFAULT;
 +
-+	((struct usbtmc_instrument *)arg)->product[n]=0;
++	((struct usbtmc_instrument *)arg)->product[n] = 0;
 +	n = strlen(p_device->product);
 +
 +	if (n > 199)
 +		n = 199;
 +	if (copy_to_user(((struct usbtmc_instrument *)arg)->serial_number,
-+		p_device->serial,n))
++		p_device->serial, n))
 +		return -EFAULT;
 +
-+	((struct usbtmc_instrument *)arg)->serial_number[n]=0;
++	((struct usbtmc_instrument *)arg)->serial_number[n] = 0;
 +
 +	return 0;
 +}
@@ -1375,64 +1365,71 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	rv = usb_reset_configuration(p_device_data->usb_dev);
 +
 +	if (rv < 0) {
-+		printk(KERN_NOTICE "USBTMC: usb_reset_configuration returned %d\n",rv);
++		printk(KERN_NOTICE "USBTMC: usb_reset_configuration "
++				"returned %d\n", rv);
 +		return rv;
 +	}
 +
 +	return 0;
 +}
 +
-+static int usbtmc_ioctl (struct inode *inode,
-+	struct file *filp,
-+	unsigned int cmd,
-+	unsigned long arg)
++static int usbtmc_ioctl(struct inode *inode,
++	struct file *filp, unsigned int cmd, unsigned long arg)
 +{
 +#ifdef USBTMC_DEBUG
 +	printk(KERN_NOTICE "USBTMC: Ioctl function called\n");
 +#endif
 +
-+	switch(cmd)
-+	{
-+		case USBTMC_IOCTL_SET_ATTRIBUTE:
-+			return usbtmc_ioctl_set_attribute(inode, filp, cmd, arg);
++	switch (cmd) {
++	case USBTMC_IOCTL_SET_ATTRIBUTE:
++		return usbtmc_ioctl_set_attribute(inode, filp,
++				cmd, arg);
 +
-+		case USBTMC_IOCTL_GET_ATTRIBUTE:
-+			return usbtmc_ioctl_get_attribute(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_GET_ATTRIBUTE:
++		return usbtmc_ioctl_get_attribute(inode,
++				filp, cmd, arg);
 +
-+		case USBTMC_IOCTL_CLEAR_OUT_HALT:
-+			return usbtmc_ioctl_clear_out_halt(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_CLEAR_OUT_HALT:
++		return usbtmc_ioctl_clear_out_halt(inode,
++				filp, cmd, arg);
 +
-+		case USBTMC_IOCTL_CLEAR_IN_HALT:
-+			return usbtmc_ioctl_clear_in_halt(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_CLEAR_IN_HALT:
++		return usbtmc_ioctl_clear_in_halt(inode,
++				filp, cmd, arg);
 +
-+		case USBTMC_IOCTL_GET_CAPABILITIES:
-+			return usbtmc_ioctl_get_capabilities(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_GET_CAPABILITIES:
++		return usbtmc_ioctl_get_capabilities(inode,
++				filp, cmd, arg);
 +
-+		case USBTMC_IOCTL_INDICATOR_PULSE:
-+			return usbtmc_ioctl_indicator_pulse(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_INDICATOR_PULSE:
++		return usbtmc_ioctl_indicator_pulse(inode,
++				filp, cmd, arg);
 +
-+		case USBTMC_IOCTL_CLEAR:
-+			return usbtmc_ioctl_clear(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_CLEAR:
++		return usbtmc_ioctl_clear(inode, filp, cmd, arg);
 +
-+		case USBTMC_IOCTL_ABORT_BULK_OUT:
-+			return usbtmc_ioctl_abort_bulk_out(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_ABORT_BULK_OUT:
++		return usbtmc_ioctl_abort_bulk_out(inode,
++				filp, cmd, arg);
 +
-+		case USBTMC_IOCTL_ABORT_BULK_IN:
-+			return usbtmc_ioctl_abort_bulk_in(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_ABORT_BULK_IN:
++		return usbtmc_ioctl_abort_bulk_in(inode,
++				filp, cmd, arg);
 +
-+		case USBTMC_IOCTL_INSTRUMENT_DATA:
-+			return usbtmc_ioctl_instrument_data(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_INSTRUMENT_DATA:
++		return usbtmc_ioctl_instrument_data(inode,
++				filp, cmd, arg);
 +
-+		case USBTMC_IOCTL_RESET_CONF:
-+			return usbtmc_ioctl_reset_conf(inode, filp, cmd, arg);
++	case USBTMC_IOCTL_RESET_CONF:
++		return usbtmc_ioctl_reset_conf(inode, filp, cmd, arg);
 +
-+		default:
-+			return -EBADRQC;
++	default:
++		return -EBADRQC;
 +	}
 +}
 +
 +/* REVISIT Do we need this after all ? */
-+static loff_t usbtmc_llseek(struct file *filp,loff_t position,int x)
++static loff_t usbtmc_llseek(struct file *filp, loff_t position, int x)
 +{
 +#ifdef USBTMC_DEBUG
 +	printk(KERN_NOTICE "USBTMC: usbtmc_llseek called\n");
@@ -1463,8 +1460,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	printk(KERN_NOTICE "USBTMC: usbtmc_probe called\n");
 +#endif
 +
-+	p_device_data = kmalloc(sizeof(struct usbtmc_device_data),GFP_KERNEL);
-+	if(!p_device_data) {
++	p_device_data = kmalloc(sizeof(struct usbtmc_device_data), GFP_KERNEL);
++	if (!p_device_data) {
 +		printk(KERN_ALERT "USBTMC: Unable to allocate kernel memory\n");
 +		goto exit_kmalloc;
 +	}
@@ -1482,7 +1479,7 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	usbtmc_devs[n] = p_device_data;
 +
 +#ifdef USBTMC_DEBUG
-+	printk(KERN_NOTICE "USBTMC: Using minor number %d\n",n);
++	printk(KERN_NOTICE "USBTMC: Using minor number %d\n", n);
 +#endif
 +
 +	memset(&p_device_data->cdev, 0, sizeof(struct cdev));
@@ -1494,15 +1491,16 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	p_device = interface_to_usbdev(intf);
 +#ifdef USBTMC_DEBUG
 +	printk(KERN_NOTICE "USBTMC: New device attached:\n");
-+	printk(KERN_NOTICE "USBTMC: Product: %s\n",p_device->product);
-+	printk(KERN_NOTICE "USBTMC: Manufacturer: %s\n",p_device->manufacturer);
-+	printk(KERN_NOTICE "USBTMC: Serial number: %s\n",p_device->serial);
++	printk(KERN_NOTICE "USBTMC: Product: %s\n", p_device->product);
++	printk(KERN_NOTICE "USBTMC: Manufacturer: %s\n",
++			p_device->manufacturer);
++	printk(KERN_NOTICE "USBTMC: Serial number: %s\n", p_device->serial);
 +#endif
 +
 +	p_device_data->devno = MKDEV(MAJOR(dev), n);
 +
-+	retcode = cdev_add(&p_device_data->cdev,p_device_data->devno,1);
-+	if(retcode) {
++	retcode = cdev_add(&p_device_data->cdev, p_device_data->devno, 1);
++	if (retcode) {
 +		printk(KERN_ALERT "USBTMC: Unable to add character device\n");
 +		goto exit_cdev_add;
 +	}
@@ -1564,15 +1562,14 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	printk(KERN_NOTICE "USBTMC: usbtmc_init called\n");
 +#endif
 +
-+	for ( n = 0; n < USBTMC_MINOR_NUMBERS; n++)
-+		usbtmc_minors[n]=0;
++	for (n = 0; n < USBTMC_MINOR_NUMBERS; n++)
++		usbtmc_minors[n] = 0;
 +
-+	if ((retcode = alloc_chrdev_region(&dev,
-+					0,
-+					USBTMC_MINOR_NUMBERS,
-+					"USBTMCCHR"
-+				       ))) {
-+		printk(KERN_ALERT "USBTMC: Unable to allocate major/minor numbers\n");
++	retcode = alloc_chrdev_region(&dev, 0, USBTMC_MINOR_NUMBERS,
++					"USBTMCCHR");
++	if (retcode) {
++		printk(KERN_ALERT "USBTMC: Unable to allocate "
++				"major/minor numbers\n");
 +		goto exit_alloc_chrdev_region;
 +	}
 +
@@ -1580,8 +1577,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	printk(KERN_NOTICE "USBTMC: Major number is %d\n", MAJOR(dev));
 +#endif
 +
-+	usbtmc_buffer = kmalloc(USBTMC_SIZE_IOBUFFER,GFP_KERNEL);
-+	if(!usbtmc_buffer) {
++	usbtmc_buffer = kmalloc(USBTMC_SIZE_IOBUFFER, GFP_KERNEL);
++	if (!usbtmc_buffer) {
 +		printk(KERN_ALERT "USBTMC: Unable to allocate kernel memory\n");
 +		retcode = -ENOMEM;
 +		goto exit_kmalloc;
@@ -1593,7 +1590,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +	cdev.ops = &fops;
 +	devno = MKDEV(MAJOR(dev), 0);
 +
-+	if((retcode = cdev_add(&cdev, devno, 1))) {
++	retcode = cdev_add(&cdev, devno, 1);
++	if (retcode) {
 +		printk(KERN_ALERT "USBTMC: Unable to add character device\n");
 +		retcode = -ENODEV;
 +		goto exit_cdev_add;
@@ -1639,8 +1637,8 @@ Index: linux-2.6/drivers/usb/class/usbtmc.c
 +
 Index: linux-2.6/drivers/usb/class/usbtmc.h
 ===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6/drivers/usb/class/usbtmc.h	2008-06-18 00:06:46.000000000 +0300
+--- /dev/null
++++ linux-2.6/drivers/usb/class/usbtmc.h
 @@ -0,0 +1,144 @@
 +/*
 + * usbtmc.h
-- 
1.5.6.rc3.7.g336d0




More information about the devel mailing list