[PATCH 5/9] USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb.c

Felipe Balbi <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
From: Felipe Balbi <[email protected]>

Better indentation

Signed-off-by: Felipe Balbi <[email protected]>
---
 drivers/usb/misc/sisusbvga/sisusb.c | 1808 ++++++++++++++++++-----------------
 1 files changed, 928 insertions(+), 880 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 4676520..227f205 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -10,27 +10,27 @@
  *
  * Otherwise, the following license terms apply:
  *
- * * Redistribution and use in source and binary forms, with or without
- * * modification, are permitted provided that the following conditions
- * * are met:
- * * 1) Redistributions of source code must retain the above copyright
- * *    notice, this list of conditions and the following disclaimer.
- * * 2) Redistributions in binary form must reproduce the above copyright
- * *    notice, this list of conditions and the following disclaimer in the
- * *    documentation and/or other materials provided with the distribution.
- * * 3) The name of the author may not be used to endorse or promote products
- * *    derived from this software without specific psisusbr written permission.
- * *
- * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
- * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1) Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2) Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3) The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific psisusbr written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * Author:	Thomas Winischhofer <[email protected]>
  *
@@ -66,33 +66,34 @@ static int sisusb_first_vc = 0;
 static int sisusb_last_vc = 0;
 module_param_named(first, sisusb_first_vc, int, 0);
 module_param_named(last, sisusb_last_vc, int, 0);
-MODULE_PARM_DESC(first, "Number of first console to take over (1 - MAX_NR_CONSOLES)");
-MODULE_PARM_DESC(last, "Number of last console to take over (1 - MAX_NR_CONSOLES)");
+MODULE_PARM_DESC(first,
+		 "Number of first console to take over (1 - MAX_NR_CONSOLES)");
+MODULE_PARM_DESC(last,
+		 "Number of last console to take over (1 - MAX_NR_CONSOLES)");
 #endif
 
 static struct usb_driver sisusb_driver;
 
-static void
-sisusb_free_buffers(struct sisusb_usb_data *sisusb)
+static void sisusb_free_buffers(struct sisusb_usb_data *sisusb)
 {
 	int i;
 
 	for (i = 0; i < NUMOBUFS; i++) {
 		if (sisusb->obuf[i]) {
 			usb_buffer_free(sisusb->sisusb_dev, sisusb->obufsize,
-				sisusb->obuf[i], sisusb->transfer_dma_out[i]);
+					sisusb->obuf[i],
+					sisusb->transfer_dma_out[i]);
 			sisusb->obuf[i] = NULL;
 		}
 	}
 	if (sisusb->ibuf) {
 		usb_buffer_free(sisusb->sisusb_dev, sisusb->ibufsize,
-			sisusb->ibuf, sisusb->transfer_dma_in);
+				sisusb->ibuf, sisusb->transfer_dma_in);
 		sisusb->ibuf = NULL;
 	}
 }
 
-static void
-sisusb_free_urbs(struct sisusb_usb_data *sisusb)
+static void sisusb_free_urbs(struct sisusb_usb_data *sisusb)
 {
 	int i;
 
@@ -104,15 +105,14 @@ sisusb_free_urbs(struct sisusb_usb_data *sisusb)
 	sisusb->sisurbin = NULL;
 }
 
-/* Level 0: USB transport layer */
-
-/* 1. out-bulks */
-
-/* out-urb management */
+/*
+ * Level 0: USB transport layer
+ * 1. out-bulks
+ * out-urb management
+ */
 
 /* Return 1 if all free, 0 otherwise */
-static int
-sisusb_all_free(struct sisusb_usb_data *sisusb)
+static int sisusb_all_free(struct sisusb_usb_data *sisusb)
 {
 	int i;
 
@@ -127,8 +127,7 @@ sisusb_all_free(struct sisusb_usb_data *sisusb)
 }
 
 /* Kill all busy URBs */
-static void
-sisusb_kill_all_busy(struct sisusb_usb_data *sisusb)
+static void sisusb_kill_all_busy(struct sisusb_usb_data *sisusb)
 {
 	int i;
 
@@ -144,26 +143,23 @@ sisusb_kill_all_busy(struct sisusb_usb_data *sisusb)
 }
 
 /* Return 1 if ok, 0 if error (not all complete within timeout) */
-static int
-sisusb_wait_all_out_complete(struct sisusb_usb_data *sisusb)
+static int sisusb_wait_all_out_complete(struct sisusb_usb_data *sisusb)
 {
 	int timeout = 5 * HZ, i = 1;
 
 	wait_event_timeout(sisusb->wait_q,
-				(i = sisusb_all_free(sisusb)),
-				 timeout);
+			   (i = sisusb_all_free(sisusb)), timeout);
 
 	return i;
 }
 
-static int
-sisusb_outurb_available(struct sisusb_usb_data *sisusb)
+static int sisusb_outurb_available(struct sisusb_usb_data *sisusb)
 {
 	int i;
 
 	for (i = 0; i < sisusb->numobufs; i++) {
 
-		if ((sisusb->urbstatus[i] & (SU_URB_BUSY|SU_URB_ALLOC)) == 0)
+		if ((sisusb->urbstatus[i] & (SU_URB_BUSY | SU_URB_ALLOC)) == 0)
 			return i;
 
 	}
@@ -171,20 +167,18 @@ sisusb_outurb_available(struct sisusb_usb_data *sisusb)
 	return -1;
 }
 
-static int
-sisusb_get_free_outbuf(struct sisusb_usb_data *sisusb)
+static int sisusb_get_free_outbuf(struct sisusb_usb_data *sisusb)
 {
 	int i, timeout = 5 * HZ;
 
 	wait_event_timeout(sisusb->wait_q,
-				((i = sisusb_outurb_available(sisusb)) >= 0),
-				timeout);
+			   ((i = sisusb_outurb_available(sisusb)) >= 0),
+			   timeout);
 
 	return i;
 }
 
-static int
-sisusb_alloc_outbuf(struct sisusb_usb_data *sisusb)
+static int sisusb_alloc_outbuf(struct sisusb_usb_data *sisusb)
 {
 	int i;
 
@@ -196,8 +190,7 @@ sisusb_alloc_outbuf(struct sisusb_usb_data *sisusb)
 	return i;
 }
 
-static void
-sisusb_free_outbuf(struct sisusb_usb_data *sisusb, int index)
+static void sisusb_free_outbuf(struct sisusb_usb_data *sisusb, int index)
 {
 	if ((index >= 0) && (index < sisusb->numobufs))
 		sisusb->urbstatus[index] &= ~SU_URB_ALLOC;
@@ -205,8 +198,7 @@ sisusb_free_outbuf(struct sisusb_usb_data *sisusb, int index)
 
 /* completion callback */
 
-static void
-sisusb_bulk_completeout(struct urb *urb)
+static void sisusb_bulk_completeout(struct urb *urb)
 {
 	struct sisusb_urb_context *context = urb->context;
 	struct sisusb_usb_data *sisusb;
@@ -229,9 +221,9 @@ sisusb_bulk_completeout(struct urb *urb)
 }
 
 static int
-sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe, void *data,
-		int len, int *actual_length, int timeout, unsigned int tflags,
-		dma_addr_t transfer_dma)
+sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe,
+		   void *data, int len, int *actual_length, int timeout,
+		   unsigned int tflags, dma_addr_t transfer_dma)
 {
 	struct urb *urb = sisusb->sisurbout[index];
 	int retval, byteswritten = 0;
@@ -240,7 +232,8 @@ sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe,
 	urb->transfer_flags = 0;
 
 	usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len,
-		sisusb_bulk_completeout, &sisusb->urbout_context[index]);
+			  sisusb_bulk_completeout,
+			  &sisusb->urbout_context[index]);
 
 	urb->transfer_flags |= tflags;
 	urb->actual_length = 0;
@@ -250,7 +243,7 @@ sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe,
 
 	/* Set up context */
 	sisusb->urbout_context[index].actual_length = (timeout) ?
-						NULL : actual_length;
+	    NULL : actual_length;
 
 	/* Declare this urb/buffer in use */
 	sisusb->urbstatus[index] |= SU_URB_BUSY;
@@ -284,8 +277,7 @@ sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe,
 
 /* completion callback */
 
-static void
-sisusb_bulk_completein(struct urb *urb)
+static void sisusb_bulk_completein(struct urb *urb)
 {
 	struct sisusb_usb_data *sisusb = urb->context;
 
@@ -297,8 +289,9 @@ sisusb_bulk_completein(struct urb *urb)
 }
 
 static int
-sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data, int len,
-		int *actual_length, int timeout, unsigned int tflags, dma_addr_t transfer_dma)
+sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data,
+		  int len, int *actual_length, int timeout, unsigned int tflags,
+		  dma_addr_t transfer_dma)
 {
 	struct urb *urb = sisusb->sisurbin;
 	int retval, readbytes = 0;
@@ -306,7 +299,7 @@ sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data,
 	urb->transfer_flags = 0;
 
 	usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len,
-			sisusb_bulk_completein, sisusb);
+			  sisusb_bulk_completein, sisusb);
 
 	urb->transfer_flags |= tflags;
 	urb->actual_length = 0;
@@ -335,7 +328,6 @@ sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data,
 	return retval;
 }
 
-
 /* Level 1:  */
 
 /* Send a bulk message of variable size
@@ -352,8 +344,10 @@ sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data,
  */
 
 static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
-		char *kernbuffer, const char __user *userbuffer, int index,
-		ssize_t *bytes_written, unsigned int tflags, int async)
+				char *kernbuffer,
+				const char __user * userbuffer, int index,
+				ssize_t * bytes_written, unsigned int tflags,
+				int async)
 {
 	int result = 0, retry, count = len;
 	int passsize, thispass, transferred_len = 0;
@@ -385,7 +379,7 @@ static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
 
 	do {
 		passsize = thispass = (sisusb->obufsize < count) ?
-						sisusb->obufsize : count;
+		    sisusb->obufsize : count;
 
 		if (index < 0)
 			index = sisusb_get_free_outbuf(sisusb);
@@ -416,14 +410,15 @@ static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
 				return -ENODEV;
 
 			result = sisusb_bulkout_msg(sisusb,
-						index,
-						pipe,
-						buffer,
-						thispass,
-						&transferred_len,
-						async ? 0 : 5 * HZ,
-						tflags,
-						sisusb->transfer_dma_out[index]);
+						    index,
+						    pipe,
+						    buffer,
+						    thispass,
+						    &transferred_len,
+						    async ? 0 : 5 * HZ,
+						    tflags,
+						    sisusb->
+						    transfer_dma_out[index]);
 
 			if (result == -ETIMEDOUT) {
 
@@ -460,7 +455,7 @@ static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
 			return result;
 
 		(*bytes_written) += passsize;
-		count            -= passsize;
+		count -= passsize;
 
 		/* Force new allocation in next iteration */
 		if (fromuser || fromkern)
@@ -492,8 +487,8 @@ static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
  */
 
 static int sisusb_recv_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
-		void *kernbuffer, char __user *userbuffer, ssize_t *bytes_read,
-		unsigned int tflags)
+				void *kernbuffer, char __user * userbuffer,
+				ssize_t * bytes_read, unsigned int tflags)
 {
 	int result = 0, retry, count = len;
 	int bufsize, thispass, transferred_len;
@@ -530,8 +525,7 @@ static int sisusb_recv_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
 					   thispass,
 					   &transferred_len,
 					   5 * HZ,
-					   tflags,
-					   sisusb->transfer_dma_in);
+					   tflags, sisusb->transfer_dma_in);
 
 		if (transferred_len)
 			thispass = transferred_len;
@@ -546,11 +540,10 @@ static int sisusb_recv_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
 		} else
 			return -EIO;
 
-
 		if (thispass) {
 
 			(*bytes_read) += thispass;
-			count         -= thispass;
+			count -= thispass;
 
 			if (userbuffer) {
 
@@ -574,7 +567,7 @@ static int sisusb_recv_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
 }
 
 static int sisusb_send_packet(struct sisusb_usb_data *sisusb, int len,
-						struct sisusb_packet *packet)
+			      struct sisusb_packet *packet)
 {
 	int ret;
 	ssize_t bytes_transferred = 0;
@@ -593,7 +586,8 @@ static int sisusb_send_packet(struct sisusb_usb_data *sisusb, int len,
 
 	/* 1. send the packet */
 	ret = sisusb_send_bulk_msg(sisusb, SISUSB_EP_GFX_OUT, len,
-			(char *)packet, NULL, 0, &bytes_transferred, 0, 0);
+				   (char *)packet, NULL, 0, &bytes_transferred,
+				   0, 0);
 
 	if ((ret == 0) && (len == 6)) {
 
@@ -601,7 +595,8 @@ static int sisusb_send_packet(struct sisusb_usb_data *sisusb, int len,
 		 *    return value and write it to packet->data
 		 */
 		ret = sisusb_recv_bulk_msg(sisusb, SISUSB_EP_GFX_IN, 4,
-				(char *)&tmp, NULL, &bytes_transferred, 0);
+					   (char *)&tmp, NULL,
+					   &bytes_transferred, 0);
 
 		packet->data = le32_to_cpu(tmp);
 	}
@@ -610,8 +605,8 @@ static int sisusb_send_packet(struct sisusb_usb_data *sisusb, int len,
 }
 
 static int sisusb_send_bridge_packet(struct sisusb_usb_data *sisusb, int len,
-					struct sisusb_packet *packet,
-					unsigned int tflags)
+				     struct sisusb_packet *packet,
+				     unsigned int tflags)
 {
 	int ret;
 	ssize_t bytes_transferred = 0;
@@ -630,7 +625,8 @@ static int sisusb_send_bridge_packet(struct sisusb_usb_data *sisusb, int len,
 
 	/* 1. send the packet */
 	ret = sisusb_send_bulk_msg(sisusb, SISUSB_EP_BRIDGE_OUT, len,
-			(char *)packet, NULL, 0, &bytes_transferred, tflags, 0);
+				   (char *)packet, NULL, 0, &bytes_transferred,
+				   tflags, 0);
 
 	if ((ret == 0) && (len == 6)) {
 
@@ -638,7 +634,8 @@ static int sisusb_send_bridge_packet(struct sisusb_usb_data *sisusb, int len,
 		 *    return value and write it to packet->data
 		 */
 		ret = sisusb_recv_bulk_msg(sisusb, SISUSB_EP_BRIDGE_IN, 4,
-				(char *)&tmp, NULL, &bytes_transferred, 0);
+					   (char *)&tmp, NULL,
+					   &bytes_transferred, 0);
 
 		packet->data = le32_to_cpu(tmp);
 	}
@@ -659,20 +656,20 @@ static int sisusb_send_bridge_packet(struct sisusb_usb_data *sisusb, int len,
  */
 
 static int sisusb_write_memio_byte(struct sisusb_usb_data *sisusb, int type,
-							u32 addr, u8 data)
+				   u32 addr, u8 data)
 {
 	struct sisusb_packet packet;
 	int ret;
 
-	packet.header  = (1 << (addr & 3)) | (type << 6);
+	packet.header = (1 << (addr & 3)) | (type << 6);
 	packet.address = addr & ~3;
-	packet.data    = data << ((addr & 3) << 3);
+	packet.data = data << ((addr & 3) << 3);
 	ret = sisusb_send_packet(sisusb, 10, &packet);
 	return ret;
 }
 
 static int sisusb_write_memio_word(struct sisusb_usb_data *sisusb, int type,
-							u32 addr, u16 data)
+				   u32 addr, u16 data)
 {
 	struct sisusb_packet packet;
 	int ret = 0;
@@ -680,36 +677,36 @@ static int sisusb_write_memio_word(struct sisusb_usb_data *sisusb, int type,
 	packet.address = addr & ~3;
 
 	switch (addr & 3) {
-		case 0:
-			packet.header = (type << 6) | 0x0003;
-			packet.data   = (u32)data;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			break;
-		case 1:
-			packet.header = (type << 6) | 0x0006;
-			packet.data   = (u32)data << 8;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			break;
-		case 2:
-			packet.header = (type << 6) | 0x000c;
-			packet.data   = (u32)data << 16;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			break;
-		case 3:
-			packet.header = (type << 6) | 0x0008;
-			packet.data   = (u32)data << 24;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			packet.header = (type << 6) | 0x0001;
-			packet.address = (addr & ~3) + 4;
-			packet.data   = (u32)data >> 8;
-			ret |= sisusb_send_packet(sisusb, 10, &packet);
+	case 0:
+		packet.header = (type << 6) | 0x0003;
+		packet.data = (u32) data;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		break;
+	case 1:
+		packet.header = (type << 6) | 0x0006;
+		packet.data = (u32) data << 8;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		break;
+	case 2:
+		packet.header = (type << 6) | 0x000c;
+		packet.data = (u32) data << 16;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		break;
+	case 3:
+		packet.header = (type << 6) | 0x0008;
+		packet.data = (u32) data << 24;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		packet.header = (type << 6) | 0x0001;
+		packet.address = (addr & ~3) + 4;
+		packet.data = (u32) data >> 8;
+		ret |= sisusb_send_packet(sisusb, 10, &packet);
 	}
 
 	return ret;
 }
 
 static int sisusb_write_memio_24bit(struct sisusb_usb_data *sisusb, int type,
-							u32 addr, u32 data)
+				    u32 addr, u32 data)
 {
 	struct sisusb_packet packet;
 	int ret = 0;
@@ -717,40 +714,40 @@ static int sisusb_write_memio_24bit(struct sisusb_usb_data *sisusb, int type,
 	packet.address = addr & ~3;
 
 	switch (addr & 3) {
-		case 0:
-			packet.header  = (type << 6) | 0x0007;
-			packet.data    = data & 0x00ffffff;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			break;
-		case 1:
-			packet.header  = (type << 6) | 0x000e;
-			packet.data    = data << 8;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			break;
-		case 2:
-			packet.header  = (type << 6) | 0x000c;
-			packet.data    = data << 16;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			packet.header  = (type << 6) | 0x0001;
-			packet.address = (addr & ~3) + 4;
-			packet.data    = (data >> 16) & 0x00ff;
-			ret |= sisusb_send_packet(sisusb, 10, &packet);
-			break;
-		case 3:
-			packet.header  = (type << 6) | 0x0008;
-			packet.data    = data << 24;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			packet.header  = (type << 6) | 0x0003;
-			packet.address = (addr & ~3) + 4;
-			packet.data    = (data >> 8) & 0xffff;
-			ret |= sisusb_send_packet(sisusb, 10, &packet);
+	case 0:
+		packet.header = (type << 6) | 0x0007;
+		packet.data = data & 0x00ffffff;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		break;
+	case 1:
+		packet.header = (type << 6) | 0x000e;
+		packet.data = data << 8;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		break;
+	case 2:
+		packet.header = (type << 6) | 0x000c;
+		packet.data = data << 16;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		packet.header = (type << 6) | 0x0001;
+		packet.address = (addr & ~3) + 4;
+		packet.data = (data >> 16) & 0x00ff;
+		ret |= sisusb_send_packet(sisusb, 10, &packet);
+		break;
+	case 3:
+		packet.header = (type << 6) | 0x0008;
+		packet.data = data << 24;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		packet.header = (type << 6) | 0x0003;
+		packet.address = (addr & ~3) + 4;
+		packet.data = (data >> 8) & 0xffff;
+		ret |= sisusb_send_packet(sisusb, 10, &packet);
 	}
 
 	return ret;
 }
 
 static int sisusb_write_memio_long(struct sisusb_usb_data *sisusb, int type,
-							u32 addr, u32 data)
+				   u32 addr, u32 data)
 {
 	struct sisusb_packet packet;
 	int ret = 0;
@@ -758,37 +755,37 @@ static int sisusb_write_memio_long(struct sisusb_usb_data *sisusb, int type,
 	packet.address = addr & ~3;
 
 	switch (addr & 3) {
-		case 0:
-			packet.header  = (type << 6) | 0x000f;
-			packet.data    = data;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			break;
-		case 1:
-			packet.header  = (type << 6) | 0x000e;
-			packet.data    = data << 8;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			packet.header  = (type << 6) | 0x0001;
-			packet.address = (addr & ~3) + 4;
-			packet.data    = data >> 24;
-			ret |= sisusb_send_packet(sisusb, 10, &packet);
-			break;
-		case 2:
-			packet.header  = (type << 6) | 0x000c;
-			packet.data    = data << 16;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			packet.header  = (type << 6) | 0x0003;
-			packet.address = (addr & ~3) + 4;
-			packet.data    = data >> 16;
-			ret |= sisusb_send_packet(sisusb, 10, &packet);
-			break;
-		case 3:
-			packet.header  = (type << 6) | 0x0008;
-			packet.data    = data << 24;
-			ret = sisusb_send_packet(sisusb, 10, &packet);
-			packet.header  = (type << 6) | 0x0007;
-			packet.address = (addr & ~3) + 4;
-			packet.data    = data >> 8;
-			ret |= sisusb_send_packet(sisusb, 10, &packet);
+	case 0:
+		packet.header = (type << 6) | 0x000f;
+		packet.data = data;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		break;
+	case 1:
+		packet.header = (type << 6) | 0x000e;
+		packet.data = data << 8;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		packet.header = (type << 6) | 0x0001;
+		packet.address = (addr & ~3) + 4;
+		packet.data = data >> 24;
+		ret |= sisusb_send_packet(sisusb, 10, &packet);
+		break;
+	case 2:
+		packet.header = (type << 6) | 0x000c;
+		packet.data = data << 16;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		packet.header = (type << 6) | 0x0003;
+		packet.address = (addr & ~3) + 4;
+		packet.data = data >> 16;
+		ret |= sisusb_send_packet(sisusb, 10, &packet);
+		break;
+	case 3:
+		packet.header = (type << 6) | 0x0008;
+		packet.data = data << 24;
+		ret = sisusb_send_packet(sisusb, 10, &packet);
+		packet.header = (type << 6) | 0x0007;
+		packet.address = (addr & ~3) + 4;
+		packet.data = data >> 8;
+		ret |= sisusb_send_packet(sisusb, 10, &packet);
 	}
 
 	return ret;
@@ -805,16 +802,16 @@ static int sisusb_write_memio_long(struct sisusb_usb_data *sisusb, int type,
  */
 
 static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
-				char *kernbuffer, int length,
-				const char __user *userbuffer, int index,
-				ssize_t *bytes_written)
+				 char *kernbuffer, int length,
+				 const char __user * userbuffer, int index,
+				 ssize_t * bytes_written)
 {
 	struct sisusb_packet packet;
-	int  ret = 0;
+	int ret = 0;
 	static int msgcount = 0;
-	u8   swap8, fromkern = kernbuffer ? 1 : 0;
-	u16  swap16;
-	u32  swap32, flag = (length >> 28) & 1;
+	u8 swap8, fromkern = kernbuffer ? 1 : 0;
+	u16 swap16;
+	u32 swap32, flag = (length >> 28) & 1;
 	char buf[4];
 
 	/* if neither kernbuffer not userbuffer are given, assume
@@ -829,18 +826,18 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 
 	while (length) {
 
-	    switch (length) {
+		switch (length) {
 
 		case 1:
 			if (userbuffer) {
-				if (get_user(swap8, (u8 __user *)userbuffer))
+				if (get_user(swap8, (u8 __user *) userbuffer))
 					return -EFAULT;
 			} else
 				swap8 = kernbuffer[0];
 
 			ret = sisusb_write_memio_byte(sisusb,
-							SISUSB_TYPE_MEM,
-							addr, swap8);
+						      SISUSB_TYPE_MEM,
+						      addr, swap8);
 
 			if (!ret)
 				(*bytes_written)++;
@@ -849,15 +846,14 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 
 		case 2:
 			if (userbuffer) {
-				if (get_user(swap16, (u16 __user *)userbuffer))
+				if (get_user(swap16, (u16 __user *) userbuffer))
 					return -EFAULT;
 			} else
-				swap16 = *((u16 *)kernbuffer);
+				swap16 = *((u16 *) kernbuffer);
 
 			ret = sisusb_write_memio_word(sisusb,
-							SISUSB_TYPE_MEM,
-							addr,
-							swap16);
+						      SISUSB_TYPE_MEM,
+						      addr, swap16);
 
 			if (!ret)
 				(*bytes_written) += 2;
@@ -870,28 +866,23 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 					return -EFAULT;
 #ifdef __BIG_ENDIAN
 				swap32 = (buf[0] << 16) |
-					 (buf[1] <<  8) |
-					 buf[2];
+				    (buf[1] << 8) | buf[2];
 #else
 				swap32 = (buf[2] << 16) |
-					 (buf[1] <<  8) |
-					 buf[0];
+				    (buf[1] << 8) | buf[0];
 #endif
 			} else
 #ifdef __BIG_ENDIAN
 				swap32 = (kernbuffer[0] << 16) |
-					 (kernbuffer[1] <<  8) |
-					 kernbuffer[2];
+				    (kernbuffer[1] << 8) | kernbuffer[2];
 #else
 				swap32 = (kernbuffer[2] << 16) |
-					 (kernbuffer[1] <<  8) |
-					 kernbuffer[0];
+				    (kernbuffer[1] << 8) | kernbuffer[0];
 #endif
 
 			ret = sisusb_write_memio_24bit(sisusb,
-							SISUSB_TYPE_MEM,
-							addr,
-							swap32);
+						       SISUSB_TYPE_MEM,
+						       addr, swap32);
 
 			if (!ret)
 				(*bytes_written) += 3;
@@ -900,15 +891,14 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 
 		case 4:
 			if (userbuffer) {
-				if (get_user(swap32, (u32 __user *)userbuffer))
+				if (get_user(swap32, (u32 __user *) userbuffer))
 					return -EFAULT;
 			} else
-				swap32 = *((u32 *)kernbuffer);
+				swap32 = *((u32 *) kernbuffer);
 
 			ret = sisusb_write_memio_long(sisusb,
-							SISUSB_TYPE_MEM,
-							addr,
-							swap32);
+						      SISUSB_TYPE_MEM,
+						      addr, swap32);
 			if (!ret)
 				(*bytes_written) += 4;
 
@@ -917,103 +907,126 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 		default:
 			if ((length & ~3) > 0x10000) {
 
-			   packet.header  = 0x001f;
-			   packet.address = 0x000001d4;
-			   packet.data    = addr;
-			   ret = sisusb_send_bridge_packet(sisusb, 10,
-								&packet, 0);
-			   packet.header  = 0x001f;
-			   packet.address = 0x000001d0;
-			   packet.data    = (length & ~3);
-			   ret |= sisusb_send_bridge_packet(sisusb, 10,
+				packet.header = 0x001f;
+				packet.address = 0x000001d4;
+				packet.data = addr;
+				ret = sisusb_send_bridge_packet(sisusb, 10,
 								&packet, 0);
-			   packet.header  = 0x001f;
-			   packet.address = 0x000001c0;
-			   packet.data    = flag | 0x16;
-			   ret |= sisusb_send_bridge_packet(sisusb, 10,
-								&packet, 0);
-			   if (userbuffer) {
-				ret |= sisusb_send_bulk_msg(sisusb,
-							SISUSB_EP_GFX_LBULK_OUT,
-							(length & ~3),
-							NULL, userbuffer, 0,
-							bytes_written, 0, 1);
-				userbuffer += (*bytes_written);
-			   } else if (fromkern) {
-				ret |= sisusb_send_bulk_msg(sisusb,
-							SISUSB_EP_GFX_LBULK_OUT,
-							(length & ~3),
-							kernbuffer, NULL, 0,
-							bytes_written, 0, 1);
-				kernbuffer += (*bytes_written);
-			   } else {
-			ret |= sisusb_send_bulk_msg(sisusb,
-							SISUSB_EP_GFX_LBULK_OUT,
-							(length & ~3),
-							NULL, NULL, index,
-							bytes_written, 0, 1);
-				kernbuffer += ((*bytes_written) &
-						(sisusb->obufsize-1));
-			   }
+				packet.header = 0x001f;
+				packet.address = 0x000001d0;
+				packet.data = (length & ~3);
+				ret |= sisusb_send_bridge_packet(sisusb, 10,
+								 &packet, 0);
+				packet.header = 0x001f;
+				packet.address = 0x000001c0;
+				packet.data = flag | 0x16;
+				ret |= sisusb_send_bridge_packet(sisusb, 10,
+								 &packet, 0);
+				if (userbuffer) {
+					ret |= sisusb_send_bulk_msg(sisusb,
+								    SISUSB_EP_GFX_LBULK_OUT,
+								    (length &
+								     ~3), NULL,
+								    userbuffer,
+								    0,
+								    bytes_written,
+								    0, 1);
+					userbuffer += (*bytes_written);
+				} else if (fromkern) {
+					ret |= sisusb_send_bulk_msg(sisusb,
+								    SISUSB_EP_GFX_LBULK_OUT,
+								    (length &
+								     ~3),
+								    kernbuffer,
+								    NULL, 0,
+								    bytes_written,
+								    0, 1);
+					kernbuffer += (*bytes_written);
+				} else {
+					ret |= sisusb_send_bulk_msg(sisusb,
+								    SISUSB_EP_GFX_LBULK_OUT,
+								    (length &
+								     ~3), NULL,
+								    NULL, index,
+								    bytes_written,
+								    0, 1);
+					kernbuffer +=
+					    ((*bytes_written) &
+					     (sisusb->obufsize - 1));
+				}
 
 			} else {
 
-			   packet.header  = 0x001f;
-			   packet.address = 0x00000194;
-			   packet.data    = addr;
-			   ret = sisusb_send_bridge_packet(sisusb, 10,
-								&packet, 0);
-			   packet.header  = 0x001f;
-			   packet.address = 0x00000190;
-			   packet.data    = (length & ~3);
-			   ret |= sisusb_send_bridge_packet(sisusb, 10,
+				packet.header = 0x001f;
+				packet.address = 0x00000194;
+				packet.data = addr;
+				ret = sisusb_send_bridge_packet(sisusb, 10,
 								&packet, 0);
-			   if (sisusb->flagb0 != 0x16) {
-				packet.header  = 0x001f;
-				packet.address = 0x00000180;
-				packet.data    = flag | 0x16;
+				packet.header = 0x001f;
+				packet.address = 0x00000190;
+				packet.data = (length & ~3);
 				ret |= sisusb_send_bridge_packet(sisusb, 10,
-								&packet, 0);
-				sisusb->flagb0 = 0x16;
-			   }
-			   if (userbuffer) {
-				ret |= sisusb_send_bulk_msg(sisusb,
-							SISUSB_EP_GFX_BULK_OUT,
-							(length & ~3),
-							NULL, userbuffer, 0,
-							bytes_written, 0, 1);
-				userbuffer += (*bytes_written);
-			   } else if (fromkern) {
-				ret |= sisusb_send_bulk_msg(sisusb,
-							SISUSB_EP_GFX_BULK_OUT,
-							(length & ~3),
-							kernbuffer, NULL, 0,
-							bytes_written, 0, 1);
-				kernbuffer += (*bytes_written);
-			   } else {
-				ret |= sisusb_send_bulk_msg(sisusb,
-							SISUSB_EP_GFX_BULK_OUT,
-							(length & ~3),
-							NULL, NULL, index,
-							bytes_written, 0, 1);
-				kernbuffer += ((*bytes_written) &
-						(sisusb->obufsize-1));
-			   }
+								 &packet, 0);
+				if (sisusb->flagb0 != 0x16) {
+					packet.header = 0x001f;
+					packet.address = 0x00000180;
+					packet.data = flag | 0x16;
+					ret |=
+					    sisusb_send_bridge_packet(sisusb,
+								      10,
+								      &packet,
+								      0);
+					sisusb->flagb0 = 0x16;
+				}
+				if (userbuffer) {
+					ret |= sisusb_send_bulk_msg(sisusb,
+								    SISUSB_EP_GFX_BULK_OUT,
+								    (length &
+								     ~3), NULL,
+								    userbuffer,
+								    0,
+								    bytes_written,
+								    0, 1);
+					userbuffer += (*bytes_written);
+				} else if (fromkern) {
+					ret |= sisusb_send_bulk_msg(sisusb,
+								    SISUSB_EP_GFX_BULK_OUT,
+								    (length &
+								     ~3),
+								    kernbuffer,
+								    NULL, 0,
+								    bytes_written,
+								    0, 1);
+					kernbuffer += (*bytes_written);
+				} else {
+					ret |= sisusb_send_bulk_msg(sisusb,
+								    SISUSB_EP_GFX_BULK_OUT,
+								    (length &
+								     ~3), NULL,
+								    NULL, index,
+								    bytes_written,
+								    0, 1);
+					kernbuffer +=
+					    ((*bytes_written) &
+					     (sisusb->obufsize - 1));
+				}
 			}
 			if (ret) {
 				msgcount++;
 				if (msgcount < 500)
-					dev_err(&sisusb->sisusb_dev->dev, "Wrote %zd of %d bytes, error %d\n",
+					dev_err(&sisusb->sisusb_dev->dev,
+						"Wrote %zd of %d bytes, error %d\n",
 						*bytes_written, length, ret);
 				else if (msgcount == 500)
-					dev_err(&sisusb->sisusb_dev->dev, "Too many errors, logging stopped\n");
+					dev_err(&sisusb->sisusb_dev->dev,
+						"Too many errors, logging stopped\n");
 			}
 			addr += (*bytes_written);
 			length -= (*bytes_written);
-	    }
+		}
 
-	    if (ret)
-		break;
+		if (ret)
+			break;
 
 	}
 
@@ -1025,21 +1038,21 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
  */
 
 static int sisusb_read_memio_byte(struct sisusb_usb_data *sisusb, int type,
-							u32 addr, u8 *data)
+				  u32 addr, u8 * data)
 {
 	struct sisusb_packet packet;
 	int ret;
 
 	CLEARPACKET(&packet);
-	packet.header  = (1 << (addr & 3)) | (type << 6);
+	packet.header = (1 << (addr & 3)) | (type << 6);
 	packet.address = addr & ~3;
 	ret = sisusb_send_packet(sisusb, 6, &packet);
-	*data = (u8)(packet.data >> ((addr & 3) << 3));
+	*data = (u8) (packet.data >> ((addr & 3) << 3));
 	return ret;
 }
 
 static int sisusb_read_memio_word(struct sisusb_usb_data *sisusb, int type,
-							u32 addr, u16 *data)
+				  u32 addr, u16 * data)
 {
 	struct sisusb_packet packet;
 	int ret = 0;
@@ -1049,36 +1062,36 @@ static int sisusb_read_memio_word(struct sisusb_usb_data *sisusb, int type,
 	packet.address = addr & ~3;
 
 	switch (addr & 3) {
-		case 0:
-			packet.header = (type << 6) | 0x0003;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = (u16)(packet.data);
-			break;
-		case 1:
-			packet.header = (type << 6) | 0x0006;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = (u16)(packet.data >> 8);
-			break;
-		case 2:
-			packet.header = (type << 6) | 0x000c;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = (u16)(packet.data >> 16);
-			break;
-		case 3:
-			packet.header = (type << 6) | 0x0008;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = (u16)(packet.data >> 24);
-			packet.header = (type << 6) | 0x0001;
-			packet.address = (addr & ~3) + 4;
-			ret |= sisusb_send_packet(sisusb, 6, &packet);
-			*data |= (u16)(packet.data << 8);
+	case 0:
+		packet.header = (type << 6) | 0x0003;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = (u16) (packet.data);
+		break;
+	case 1:
+		packet.header = (type << 6) | 0x0006;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = (u16) (packet.data >> 8);
+		break;
+	case 2:
+		packet.header = (type << 6) | 0x000c;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = (u16) (packet.data >> 16);
+		break;
+	case 3:
+		packet.header = (type << 6) | 0x0008;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = (u16) (packet.data >> 24);
+		packet.header = (type << 6) | 0x0001;
+		packet.address = (addr & ~3) + 4;
+		ret |= sisusb_send_packet(sisusb, 6, &packet);
+		*data |= (u16) (packet.data << 8);
 	}
 
 	return ret;
 }
 
 static int sisusb_read_memio_24bit(struct sisusb_usb_data *sisusb, int type,
-							u32 addr, u32 *data)
+				   u32 addr, u32 * data)
 {
 	struct sisusb_packet packet;
 	int ret = 0;
@@ -1086,40 +1099,40 @@ static int sisusb_read_memio_24bit(struct sisusb_usb_data *sisusb, int type,
 	packet.address = addr & ~3;
 
 	switch (addr & 3) {
-		case 0:
-			packet.header  = (type << 6) | 0x0007;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = packet.data & 0x00ffffff;
-			break;
-		case 1:
-			packet.header  = (type << 6) | 0x000e;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = packet.data >> 8;
-			break;
-		case 2:
-			packet.header  = (type << 6) | 0x000c;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = packet.data >> 16;
-			packet.header  = (type << 6) | 0x0001;
-			packet.address = (addr & ~3) + 4;
-			ret |= sisusb_send_packet(sisusb, 6, &packet);
-			*data |= ((packet.data & 0xff) << 16);
-			break;
-		case 3:
-			packet.header  = (type << 6) | 0x0008;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = packet.data >> 24;
-			packet.header  = (type << 6) | 0x0003;
-			packet.address = (addr & ~3) + 4;
-			ret |= sisusb_send_packet(sisusb, 6, &packet);
-			*data |= ((packet.data & 0xffff) << 8);
+	case 0:
+		packet.header = (type << 6) | 0x0007;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = packet.data & 0x00ffffff;
+		break;
+	case 1:
+		packet.header = (type << 6) | 0x000e;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = packet.data >> 8;
+		break;
+	case 2:
+		packet.header = (type << 6) | 0x000c;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = packet.data >> 16;
+		packet.header = (type << 6) | 0x0001;
+		packet.address = (addr & ~3) + 4;
+		ret |= sisusb_send_packet(sisusb, 6, &packet);
+		*data |= ((packet.data & 0xff) << 16);
+		break;
+	case 3:
+		packet.header = (type << 6) | 0x0008;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = packet.data >> 24;
+		packet.header = (type << 6) | 0x0003;
+		packet.address = (addr & ~3) + 4;
+		ret |= sisusb_send_packet(sisusb, 6, &packet);
+		*data |= ((packet.data & 0xffff) << 8);
 	}
 
 	return ret;
 }
 
 static int sisusb_read_memio_long(struct sisusb_usb_data *sisusb, int type,
-							u32 addr, u32 *data)
+				  u32 addr, u32 * data)
 {
 	struct sisusb_packet packet;
 	int ret = 0;
@@ -1127,37 +1140,37 @@ static int sisusb_read_memio_long(struct sisusb_usb_data *sisusb, int type,
 	packet.address = addr & ~3;
 
 	switch (addr & 3) {
-		case 0:
-			packet.header  = (type << 6) | 0x000f;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = packet.data;
-			break;
-		case 1:
-			packet.header  = (type << 6) | 0x000e;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = packet.data >> 8;
-			packet.header  = (type << 6) | 0x0001;
-			packet.address = (addr & ~3) + 4;
-			ret |= sisusb_send_packet(sisusb, 6, &packet);
-			*data |= (packet.data << 24);
-			break;
-		case 2:
-			packet.header  = (type << 6) | 0x000c;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = packet.data >> 16;
-			packet.header  = (type << 6) | 0x0003;
-			packet.address = (addr & ~3) + 4;
-			ret |= sisusb_send_packet(sisusb, 6, &packet);
-			*data |= (packet.data << 16);
-			break;
-		case 3:
-			packet.header  = (type << 6) | 0x0008;
-			ret = sisusb_send_packet(sisusb, 6, &packet);
-			*data = packet.data >> 24;
-			packet.header  = (type << 6) | 0x0007;
-			packet.address = (addr & ~3) + 4;
-			ret |= sisusb_send_packet(sisusb, 6, &packet);
-			*data |= (packet.data << 8);
+	case 0:
+		packet.header = (type << 6) | 0x000f;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = packet.data;
+		break;
+	case 1:
+		packet.header = (type << 6) | 0x000e;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = packet.data >> 8;
+		packet.header = (type << 6) | 0x0001;
+		packet.address = (addr & ~3) + 4;
+		ret |= sisusb_send_packet(sisusb, 6, &packet);
+		*data |= (packet.data << 24);
+		break;
+	case 2:
+		packet.header = (type << 6) | 0x000c;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = packet.data >> 16;
+		packet.header = (type << 6) | 0x0003;
+		packet.address = (addr & ~3) + 4;
+		ret |= sisusb_send_packet(sisusb, 6, &packet);
+		*data |= (packet.data << 16);
+		break;
+	case 3:
+		packet.header = (type << 6) | 0x0008;
+		ret = sisusb_send_packet(sisusb, 6, &packet);
+		*data = packet.data >> 24;
+		packet.header = (type << 6) | 0x0007;
+		packet.address = (addr & ~3) + 4;
+		ret |= sisusb_send_packet(sisusb, 6, &packet);
+		*data |= (packet.data << 8);
 	}
 
 	return ret;
@@ -1165,7 +1178,7 @@ static int sisusb_read_memio_long(struct sisusb_usb_data *sisusb, int type,
 
 static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 				char *kernbuffer, int length,
-				char __user *userbuffer, ssize_t *bytes_read)
+				char __user * userbuffer, ssize_t * bytes_read)
 {
 	int ret = 0;
 	char buf[4];
@@ -1178,17 +1191,18 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 
 	while (length) {
 
-	    switch (length) {
+		switch (length) {
 
 		case 1:
 
 			ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM,
-								addr, &buf[0]);
+						      addr, &buf[0]);
 			if (!ret) {
 				(*bytes_read)++;
 				if (userbuffer) {
 					if (put_user(buf[0],
-						(u8 __user *)userbuffer)) {
+						     (u8 __user *) userbuffer))
+					{
 						return -EFAULT;
 					}
 				} else {
@@ -1199,22 +1213,22 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 
 		case 2:
 			ret |= sisusb_read_memio_word(sisusb, SISUSB_TYPE_MEM,
-								addr, &swap16);
+						      addr, &swap16);
 			if (!ret) {
 				(*bytes_read) += 2;
 				if (userbuffer) {
 					if (put_user(swap16,
-						(u16 __user *)userbuffer))
+						     (u16 __user *) userbuffer))
 						return -EFAULT;
 				} else {
-					*((u16 *)kernbuffer) = swap16;
+					*((u16 *) kernbuffer) = swap16;
 				}
 			}
 			return ret;
 
 		case 3:
 			ret |= sisusb_read_memio_24bit(sisusb, SISUSB_TYPE_MEM,
-								addr, &swap32);
+						       addr, &swap32);
 			if (!ret) {
 				(*bytes_read) += 3;
 #ifdef __BIG_ENDIAN
@@ -1227,7 +1241,8 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 				buf[0] = swap32 & 0xff;
 #endif
 				if (userbuffer) {
-					if (copy_to_user(userbuffer, &buf[0], 3))
+					if (copy_to_user
+					    (userbuffer, &buf[0], 3))
 						return -EFAULT;
 				} else {
 					kernbuffer[0] = buf[0];
@@ -1239,26 +1254,26 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 
 		default:
 			ret |= sisusb_read_memio_long(sisusb, SISUSB_TYPE_MEM,
-								addr, &swap32);
+						      addr, &swap32);
 			if (!ret) {
 				(*bytes_read) += 4;
 				if (userbuffer) {
 					if (put_user(swap32,
-						(u32 __user *)userbuffer))
+						     (u32 __user *) userbuffer))
 						return -EFAULT;
 
 					userbuffer += 4;
 				} else {
-					*((u32 *)kernbuffer) = swap32;
+					*((u32 *) kernbuffer) = swap32;
 					kernbuffer += 4;
 				}
 				addr += 4;
 				length -= 4;
 			}
-	    }
+		}
 
-	    if (ret)
-		break;
+		if (ret)
+			break;
 	}
 
 	return ret;
@@ -1267,14 +1282,12 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
 /* High level: Gfx (indexed) register access */
 
 #ifdef INCL_SISUSB_CON
-int
-sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data)
+int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data)
 {
 	return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data);
 }
 
-int
-sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data)
+int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 * data)
 {
 	return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data);
 }
@@ -1290,7 +1303,7 @@ sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data)
 }
 
 int
-sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data)
+sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 * data)
 {
 	int ret;
 	ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, index);
@@ -1300,7 +1313,7 @@ sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data)
 
 int
 sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx,
-							u8 myand, u8 myor)
+		      u8 myand, u8 myor)
 {
 	int ret;
 	u8 tmp;
@@ -1315,7 +1328,7 @@ sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx,
 
 static int
 sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx,
-							u8 data, u8 mask)
+		     u8 data, u8 mask)
 {
 	int ret;
 	u8 tmp;
@@ -1330,65 +1343,67 @@ sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx,
 int
 sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor)
 {
-	return(sisusb_setidxregandor(sisusb, port, index, 0xff, myor));
+	return (sisusb_setidxregandor(sisusb, port, index, 0xff, myor));
 }
 
 int
 sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand)
 {
-	return(sisusb_setidxregandor(sisusb, port, idx, myand, 0x00));
+	return (sisusb_setidxregandor(sisusb, port, idx, myand, 0x00));
 }
 
 /* Write/read video ram */
 
 #ifdef INCL_SISUSB_CON
-int
-sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data)
+int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data)
 {
-	return(sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data));
+	return (sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data));
 }
 
-int
-sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 *data)
+int sisusb_readb(struct sisusb_usb_data *sisusb, u32 adr, u8 * data)
 {
-	return(sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data));
+	return (sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data));
 }
 
 int
 sisusb_copy_memory(struct sisusb_usb_data *sisusb, char *src,
-			u32 dest, int length, size_t *bytes_written)
+		   u32 dest, int length, size_t * bytes_written)
 {
-	return(sisusb_write_mem_bulk(sisusb, dest, src, length, NULL, 0, bytes_written));
+	return (sisusb_write_mem_bulk
+		(sisusb, dest, src, length, NULL, 0, bytes_written));
 }
 
 #ifdef SISUSBENDIANTEST
 int
 sisusb_read_memory(struct sisusb_usb_data *sisusb, char *dest,
-			u32 src, int length, size_t *bytes_written)
+		   u32 src, int length, size_t * bytes_written)
 {
-	return(sisusb_read_mem_bulk(sisusb, src, dest, length, NULL, bytes_written));
+	return (sisusb_read_mem_bulk
+		(sisusb, src, dest, length, NULL, bytes_written));
 }
 #endif
 #endif
 
 #ifdef SISUSBENDIANTEST
-static void
-sisusb_testreadwrite(struct sisusb_usb_data *sisusb)
-{
-    static char srcbuffer[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 };
-    char destbuffer[10];
-    size_t dummy;
-    int i,j;
-
-    sisusb_copy_memory(sisusb, srcbuffer, sisusb->vrambase, 7, &dummy);
-
-    for(i = 1; i <= 7; i++) {
-        dev_dbg(sisusb->sisusb_dev->dev, "sisusb: rwtest %d bytes\n", i);
-	sisusb_read_memory(sisusb, destbuffer, sisusb->vrambase, i, &dummy);
-	for(j = 0; j < i; j++) {
-	     dev_dbg(sisusb->sisusb_dev->dev, "rwtest read[%d] = %x\n", j, destbuffer[j]);
+static void sisusb_testreadwrite(struct sisusb_usb_data *sisusb)
+{
+	static char srcbuffer[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 };
+	char destbuffer[10];
+	size_t dummy;
+	int i, j;
+
+	sisusb_copy_memory(sisusb, srcbuffer, sisusb->vrambase, 7, &dummy);
+
+	for (i = 1; i <= 7; i++) {
+		dev_dbg(sisusb->sisusb_dev->dev, "sisusb: rwtest %d bytes\n",
+			i);
+		sisusb_read_memory(sisusb, destbuffer, sisusb->vrambase, i,
+				   &dummy);
+		for (j = 0; j < i; j++) {
+			dev_dbg(sisusb->sisusb_dev->dev,
+				"rwtest read[%d] = %x\n", j, destbuffer[j]);
+		}
 	}
-    }
 }
 #endif
 
@@ -1408,13 +1423,13 @@ sisusb_write_pci_config(struct sisusb_usb_data *sisusb, int regnum, u32 data)
 }
 
 static int
-sisusb_read_pci_config(struct sisusb_usb_data *sisusb, int regnum, u32 *data)
+sisusb_read_pci_config(struct sisusb_usb_data *sisusb, int regnum, u32 * data)
 {
 	struct sisusb_packet packet;
 	int ret;
 
 	packet.header = 0x008f;
-	packet.address = (u32)regnum | 0x10000;
+	packet.address = (u32) regnum | 0x10000;
 	ret = sisusb_send_packet(sisusb, 6, &packet);
 	*data = packet.data;
 	return ret;
@@ -1474,8 +1489,7 @@ sisusb_clear_vram(struct sisusb_usb_data *sisusb, u32 address, int length)
 #define READB(a,d)	sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)
 #define WRITEB(a,d)	sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)
 
-static int
-sisusb_triggersr16(struct sisusb_usb_data *sisusb, u8 ramtype)
+static int sisusb_triggersr16(struct sisusb_usb_data *sisusb, u8 ramtype)
 {
 	int ret;
 	u8 tmp8;
@@ -1509,7 +1523,7 @@ static int
 sisusb_getbuswidth(struct sisusb_usb_data *sisusb, int *bw, int *chab)
 {
 	int ret;
-	u8  ramtype, done = 0;
+	u8 ramtype, done = 0;
 	u32 t0, t1, t2, t3;
 	u32 ramptr = SISUSB_PCI_MEMBASE;
 
@@ -1526,41 +1540,44 @@ sisusb_getbuswidth(struct sisusb_usb_data *sisusb, int *bw, int *chab)
 	}
 
 	ret |= sisusb_triggersr16(sisusb, ramtype);
-	ret |= WRITEL(ramptr +  0, 0x01234567);
-	ret |= WRITEL(ramptr +  4, 0x456789ab);
-	ret |= WRITEL(ramptr +  8, 0x89abcdef);
+	ret |= WRITEL(ramptr + 0, 0x01234567);
+	ret |= WRITEL(ramptr + 4, 0x456789ab);
+	ret |= WRITEL(ramptr + 8, 0x89abcdef);
 	ret |= WRITEL(ramptr + 12, 0xcdef0123);
 	ret |= WRITEL(ramptr + 16, 0x55555555);
 	ret |= WRITEL(ramptr + 20, 0x55555555);
 	ret |= WRITEL(ramptr + 24, 0xffffffff);
 	ret |= WRITEL(ramptr + 28, 0xffffffff);
-	ret |= READL(ramptr +  0, &t0);
-	ret |= READL(ramptr +  4, &t1);
-	ret |= READL(ramptr +  8, &t2);
+	ret |= READL(ramptr + 0, &t0);
+	ret |= READL(ramptr + 4, &t1);
+	ret |= READL(ramptr + 8, &t2);
 	ret |= READL(ramptr + 12, &t3);
 
 	if (ramtype <= 1) {
 
-		*chab = 0; *bw = 64;
+		*chab = 0;
+		*bw = 64;
 
 		if ((t3 != 0xcdef0123) || (t2 != 0x89abcdef)) {
 			if ((t1 == 0x456789ab) && (t0 == 0x01234567)) {
-				*chab = 0; *bw = 64;
+				*chab = 0;
+				*bw = 64;
 				ret |= SETIREGAND(SISSR, 0x14, 0xfd);
 			}
 		}
 		if ((t1 != 0x456789ab) || (t0 != 0x01234567)) {
-			*chab = 1; *bw = 64;
-			ret |= SETIREGANDOR(SISSR, 0x14, 0xfc,0x01);
+			*chab = 1;
+			*bw = 64;
+			ret |= SETIREGANDOR(SISSR, 0x14, 0xfc, 0x01);
 
 			ret |= sisusb_triggersr16(sisusb, ramtype);
-			ret |= WRITEL(ramptr +  0, 0x89abcdef);
-			ret |= WRITEL(ramptr +  4, 0xcdef0123);
-			ret |= WRITEL(ramptr +  8, 0x55555555);
+			ret |= WRITEL(ramptr + 0, 0x89abcdef);
+			ret |= WRITEL(ramptr + 4, 0xcdef0123);
+			ret |= WRITEL(ramptr + 8, 0x55555555);
 			ret |= WRITEL(ramptr + 12, 0x55555555);
 			ret |= WRITEL(ramptr + 16, 0xaaaaaaaa);
 			ret |= WRITEL(ramptr + 20, 0xaaaaaaaa);
-			ret |= READL(ramptr +  4, &t1);
+			ret |= READL(ramptr + 4, &t1);
 
 			if (t1 != 0xcdef0123) {
 				*bw = 32;
@@ -1570,18 +1587,21 @@ sisusb_getbuswidth(struct sisusb_usb_data *sisusb, int *bw, int *chab)
 
 	} else {
 
-		*chab = 0; *bw = 64;	/* default: cha, bw = 64 */
+		*chab = 0;
+		*bw = 64;	/* default: cha, bw = 64 */
 
 		done = 0;
 
 		if (t1 == 0x456789ab) {
 			if (t0 == 0x01234567) {
-				*chab = 0; *bw = 64;
+				*chab = 0;
+				*bw = 64;
 				done = 1;
 			}
 		} else {
 			if (t0 == 0x01234567) {
-				*chab = 0; *bw = 32;
+				*chab = 0;
+				*bw = 32;
 				ret |= SETIREG(SISSR, 0x14, 0x00);
 				done = 1;
 			}
@@ -1591,35 +1611,36 @@ sisusb_getbuswidth(struct sisusb_usb_data *sisusb, int *bw, int *chab)
 			ret |= SETIREG(SISSR, 0x14, 0x03);
 			ret |= sisusb_triggersr16(sisusb, ramtype);
 
-			ret |= WRITEL(ramptr +  0, 0x01234567);
-			ret |= WRITEL(ramptr +  4, 0x456789ab);
-			ret |= WRITEL(ramptr +  8, 0x89abcdef);
+			ret |= WRITEL(ramptr + 0, 0x01234567);
+			ret |= WRITEL(ramptr + 4, 0x456789ab);
+			ret |= WRITEL(ramptr + 8, 0x89abcdef);
 			ret |= WRITEL(ramptr + 12, 0xcdef0123);
 			ret |= WRITEL(ramptr + 16, 0x55555555);
 			ret |= WRITEL(ramptr + 20, 0x55555555);
 			ret |= WRITEL(ramptr + 24, 0xffffffff);
 			ret |= WRITEL(ramptr + 28, 0xffffffff);
-			ret |= READL(ramptr +  0, &t0);
-			ret |= READL(ramptr +  4, &t1);
+			ret |= READL(ramptr + 0, &t0);
+			ret |= READL(ramptr + 4, &t1);
 
 			if (t1 == 0x456789ab) {
 				if (t0 == 0x01234567) {
-					*chab = 1; *bw = 64;
+					*chab = 1;
+					*bw = 64;
 					return ret;
-				} /* else error */
+				}	/* else error */
 			} else {
 				if (t0 == 0x01234567) {
-					*chab = 1; *bw = 32;
+					*chab = 1;
+					*bw = 32;
 					ret |= SETIREG(SISSR, 0x14, 0x01);
-				} /* else error */
+				}	/* else error */
 			}
 		}
 	}
 	return ret;
 }
 
-static int
-sisusb_verify_mclk(struct sisusb_usb_data *sisusb)
+static int sisusb_verify_mclk(struct sisusb_usb_data *sisusb)
 {
 	int ret = 0;
 	u32 ramptr = SISUSB_PCI_MEMBASE;
@@ -1633,8 +1654,8 @@ sisusb_verify_mclk(struct sisusb_usb_data *sisusb)
 		for (i = 0, j = 16; i < 2; i++, j += 16) {
 			ret |= GETIREG(SISSR, 0x21, &tmp1);
 			ret |= SETIREGAND(SISSR, 0x21, (tmp1 & 0xfb));
-			ret |= SETIREGOR(SISSR, 0x3c, 0x01);  /* not on 330 */
-			ret |= SETIREGAND(SISSR, 0x3c, 0xfe); /* not on 330 */
+			ret |= SETIREGOR(SISSR, 0x3c, 0x01);	/* not on 330 */
+			ret |= SETIREGAND(SISSR, 0x3c, 0xfe);	/* not on 330 */
 			ret |= SETIREG(SISSR, 0x21, tmp1);
 			ret |= WRITEB(ramptr + 16 + j, j);
 			ret |= READB(ramptr + 16 + j, &tmp1);
@@ -1649,8 +1670,7 @@ sisusb_verify_mclk(struct sisusb_usb_data *sisusb)
 
 static int
 sisusb_set_rank(struct sisusb_usb_data *sisusb, int *iret, int index,
-			u8 rankno, u8 chab, const u8 dramtype[][5],
-			int bw)
+		u8 rankno, u8 chab, const u8 dramtype[][5], int bw)
 {
 	int ret = 0, ranksize;
 	u8 tmp;
@@ -1666,13 +1686,14 @@ sisusb_set_rank(struct sisusb_usb_data *sisusb, int *iret, int index,
 		return ret;
 
 	tmp = 0;
-	while ((ranksize >>= 1) > 0) tmp += 0x10;
+	while ((ranksize >>= 1) > 0)
+		tmp += 0x10;
 	tmp |= ((rankno - 1) << 2);
 	tmp |= ((bw / 64) & 0x02);
 	tmp |= (chab & 0x01);
 
 	ret = SETIREG(SISSR, 0x14, tmp);
-	ret |= sisusb_triggersr16(sisusb, 0); /* sic! */
+	ret |= sisusb_triggersr16(sisusb, 0);	/* sic! */
 
 	*iret = 1;
 
@@ -1694,7 +1715,8 @@ sisusb_check_rbc(struct sisusb_usb_data *sisusb, int *iret, u32 inc, int testn)
 
 	for (i = 0, j = 0; i < testn; i++) {
 		ret |= READL(sisusb->vrambase + j, &tmp);
-		if (tmp != j) return ret;
+		if (tmp != j)
+			return ret;
 		j += inc;
 	}
 
@@ -1704,7 +1726,7 @@ sisusb_check_rbc(struct sisusb_usb_data *sisusb, int *iret, u32 inc, int testn)
 
 static int
 sisusb_check_ranks(struct sisusb_usb_data *sisusb, int *iret, int rankno,
-					int idx, int bw, const u8 rtype[][5])
+		   int idx, int bw, const u8 rtype[][5])
 {
 	int ret = 0, i, i2ret;
 	u32 inc;
@@ -1713,9 +1735,7 @@ sisusb_check_ranks(struct sisusb_usb_data *sisusb, int *iret, int rankno,
 
 	for (i = rankno; i >= 1; i--) {
 		inc = 1 << (rtype[idx][2] +
-			    rtype[idx][1] +
-			    rtype[idx][0] +
-			    bw / 64 + i);
+			    rtype[idx][1] + rtype[idx][0] + bw / 64 + i);
 		ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 2);
 		if (!i2ret)
 			return ret;
@@ -1737,37 +1757,37 @@ sisusb_check_ranks(struct sisusb_usb_data *sisusb, int *iret, int rankno,
 
 static int
 sisusb_get_sdram_size(struct sisusb_usb_data *sisusb, int *iret, int bw,
-								int chab)
+		      int chab)
 {
 	int ret = 0, i2ret = 0, i, j;
 	static const u8 sdramtype[13][5] = {
-		{ 2, 12, 9, 64, 0x35 },
-		{ 1, 13, 9, 64, 0x44 },
-		{ 2, 12, 8, 32, 0x31 },
-		{ 2, 11, 9, 32, 0x25 },
-		{ 1, 12, 9, 32, 0x34 },
-		{ 1, 13, 8, 32, 0x40 },
-		{ 2, 11, 8, 16, 0x21 },
-		{ 1, 12, 8, 16, 0x30 },
-		{ 1, 11, 9, 16, 0x24 },
-		{ 1, 11, 8,  8, 0x20 },
-		{ 2,  9, 8,  4, 0x01 },
-		{ 1, 10, 8,  4, 0x10 },
-		{ 1,  9, 8,  2, 0x00 }
+		{2, 12, 9, 64, 0x35},
+		{1, 13, 9, 64, 0x44},
+		{2, 12, 8, 32, 0x31},
+		{2, 11, 9, 32, 0x25},
+		{1, 12, 9, 32, 0x34},
+		{1, 13, 8, 32, 0x40},
+		{2, 11, 8, 16, 0x21},
+		{1, 12, 8, 16, 0x30},
+		{1, 11, 9, 16, 0x24},
+		{1, 11, 8, 8, 0x20},
+		{2, 9, 8, 4, 0x01},
+		{1, 10, 8, 4, 0x10},
+		{1, 9, 8, 2, 0x00}
 	};
 
-	*iret = 1; /* error */
+	*iret = 1;		/* error */
 
 	for (i = 0; i < 13; i++) {
 		ret |= SETIREGANDOR(SISSR, 0x13, 0x80, sdramtype[i][4]);
 		for (j = 2; j > 0; j--) {
 			ret |= sisusb_set_rank(sisusb, &i2ret, i, j,
-						chab, sdramtype, bw);
+					       chab, sdramtype, bw);
 			if (!i2ret)
 				continue;
 
 			ret |= sisusb_check_ranks(sisusb, &i2ret, j, i,
-						bw, sdramtype);
+						  bw, sdramtype);
 			if (i2ret) {
 				*iret = 0;	/* ram size found */
 				return ret;
@@ -1785,7 +1805,9 @@ sisusb_setup_screen(struct sisusb_usb_data *sisusb, int clrall, int drwfr)
 	u32 address;
 	int i, length, modex, modey, bpp;
 
-	modex = 640; modey = 480; bpp = 2;
+	modex = 640;
+	modey = 480;
+	bpp = 2;
 
 	address = sisusb->vrambase;	/* Clear video ram */
 
@@ -1800,18 +1822,18 @@ sisusb_setup_screen(struct sisusb_usb_data *sisusb, int clrall, int drwfr)
 		for (i = 0; i < modex; i++) {
 			address = sisusb->vrambase + (i * bpp);
 			ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM,
-							address, 0xf100);
-			address += (modex * (modey-1) * bpp);
+						       address, 0xf100);
+			address += (modex * (modey - 1) * bpp);
 			ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM,
-							address, 0xf100);
+						       address, 0xf100);
 		}
 		for (i = 0; i < modey; i++) {
 			address = sisusb->vrambase + ((i * modex) * bpp);
 			ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM,
-							address, 0xf100);
+						       address, 0xf100);
 			address += ((modex - 1) * bpp);
 			ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM,
-							address, 0xf100);
+						       address, 0xf100);
 		}
 	}
 
@@ -1824,27 +1846,29 @@ sisusb_set_default_mode(struct sisusb_usb_data *sisusb, int touchengines)
 	int ret = 0, i, j, modex, modey, bpp, du;
 	u8 sr31, cr63, tmp8;
 	static const char attrdata[] = {
-		0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
-		0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
-		0x01,0x00,0x00,0x00
+		0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+		0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+		0x01, 0x00, 0x00, 0x00
 	};
 	static const char crtcrdata[] = {
-		0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
-		0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
-		0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
+		0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
+		0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3,
 		0xff
 	};
 	static const char grcdata[] = {
-		0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f,
 		0xff
 	};
 	static const char crtcdata[] = {
-		0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e,
-		0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05,
+		0x5f, 0x4f, 0x4f, 0x83, 0x55, 0x81, 0x0b, 0x3e,
+		0xe9, 0x8b, 0xdf, 0xe8, 0x0c, 0x00, 0x00, 0x05,
 		0x00
 	};
 
-	modex = 640; modey = 480; bpp = 2;
+	modex = 640;
+	modey = 480;
+	bpp = 2;
 
 	GETIREG(SISSR, 0x31, &sr31);
 	GETIREG(SISCR, 0x63, &cr63);
@@ -1858,7 +1882,7 @@ sisusb_set_default_mode(struct sisusb_usb_data *sisusb, int touchengines)
 	SETIREG(SISSR, 0x02, 0x0f);
 	SETIREG(SISSR, 0x03, 0x00);
 	SETIREG(SISSR, 0x04, 0x0e);
-	SETREG(SISMISCW, 0x23);		/* misc */
+	SETREG(SISMISCW, 0x23);	/* misc */
 	for (i = 0; i <= 0x18; i++) {	/* crtc */
 		SETIREG(SISCR, i, crtcrdata[i]);
 	}
@@ -1881,7 +1905,7 @@ sisusb_set_default_mode(struct sisusb_usb_data *sisusb, int touchengines)
 		SETIREG(SISSR, i, 0x00);
 	}
 	SETIREGAND(SISSR, 0x37, 0xfe);
-	SETREG(SISMISCW, 0xef);		/* sync */
+	SETREG(SISMISCW, 0xef);	/* sync */
 	SETIREG(SISCR, 0x11, 0x00);	/* crtc */
 	for (j = 0x00, i = 0; i <= 7; i++, j++) {
 		SETIREG(SISCR, j, crtcdata[i]);
@@ -1899,12 +1923,14 @@ sisusb_set_default_mode(struct sisusb_usb_data *sisusb, int touchengines)
 	SETIREGANDOR(SISCR, 0x09, 0x5f, ((crtcdata[16] & 0x01) << 5));
 	SETIREG(SISCR, 0x14, 0x4f);
 	du = (modex / 16) * (bpp * 2);	/* offset/pitch */
-	if (modex % 16) du += bpp;
+	if (modex % 16)
+		du += bpp;
 	SETIREGANDOR(SISSR, 0x0e, 0xf0, ((du >> 8) & 0x0f));
 	SETIREG(SISCR, 0x13, (du & 0xff));
 	du <<= 5;
 	tmp8 = du >> 8;
-	if (du & 0xff) tmp8++;
+	if (du & 0xff)
+		tmp8++;
 	SETIREG(SISSR, 0x10, tmp8);
 	SETIREG(SISSR, 0x31, 0x00);	/* VCLK */
 	SETIREG(SISSR, 0x2b, 0x1b);
@@ -1950,8 +1976,7 @@ sisusb_set_default_mode(struct sisusb_usb_data *sisusb, int touchengines)
 	return ret;
 }
 
-static int
-sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
+static int sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
 {
 	int ret = 0, i, j, bw, chab, iret, retry = 3;
 	u8 tmp8, ramtype;
@@ -1995,7 +2020,8 @@ sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
 		ret |= GETREG(SISMISCR, &tmp8);
 		ret |= SETREG(SISMISCW, (tmp8 | 0x01));
 
-		if (ret) continue;
+		if (ret)
+			continue;
 
 		/* Reset registers */
 		ret |= SETIREGAND(SISCR, 0x5b, 0xdf);
@@ -2020,7 +2046,8 @@ sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
 			ret |= SETIREG(SISCR, i, 0x00);
 		}
 
-		if (ret) continue;
+		if (ret)
+			continue;
 
 		ret |= SETIREG(SISCR, 0x63, 0x80);
 
@@ -2038,13 +2065,16 @@ sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
 		ret |= SETIREG(SISSR, 0x07, 0x18);
 		ret |= SETIREG(SISSR, 0x11, 0x0f);
 
-		if (ret) continue;
+		if (ret)
+			continue;
 
 		for (i = 0x15, j = 0; i <= 0x1b; i++, j++) {
-			ret |= SETIREG(SISSR, i, ramtypetable1[(j*4) + ramtype]);
+			ret |=
+			    SETIREG(SISSR, i, ramtypetable1[(j * 4) + ramtype]);
 		}
 		for (i = 0x40, j = 0; i <= 0x44; i++, j++) {
-			ret |= SETIREG(SISCR, i, ramtypetable2[(j*4) + ramtype]);
+			ret |=
+			    SETIREG(SISCR, i, ramtypetable2[(j * 4) + ramtype]);
 		}
 
 		ret |= SETIREG(SISCR, 0x49, 0xaa);
@@ -2061,7 +2091,8 @@ sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
 
 		ret |= SETIREGAND(SISCAP, 0x3f, 0xef);
 
-		if (ret) continue;
+		if (ret)
+			continue;
 
 		ret |= SETIREG(SISPART1, 0x00, 0x00);
 
@@ -2083,7 +2114,8 @@ sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
 		ret |= SETIREG(SISSR, 0x32, 0x11);
 		ret |= SETIREG(SISSR, 0x33, 0x00);
 
-		if (ret) continue;
+		if (ret)
+			continue;
 
 		ret |= SETIREG(SISCR, 0x83, 0x00);
 
@@ -2105,13 +2137,15 @@ sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
 		if (ramtype <= 1) {
 			ret |= sisusb_get_sdram_size(sisusb, &iret, bw, chab);
 			if (iret) {
-				dev_err(&sisusb->sisusb_dev->dev,"RAM size detection failed, assuming 8MB video RAM\n");
-				ret |= SETIREG(SISSR,0x14,0x31);
+				dev_err(&sisusb->sisusb_dev->dev,
+					"RAM size detection failed, assuming 8MB video RAM\n");
+				ret |= SETIREG(SISSR, 0x14, 0x31);
 				/* TODO */
 			}
 		} else {
-			dev_err(&sisusb->sisusb_dev->dev, "DDR RAM device found, assuming 8MB video RAM\n");
-			ret |= SETIREG(SISSR,0x14,0x31);
+			dev_err(&sisusb->sisusb_dev->dev,
+				"DDR RAM device found, assuming 8MB video RAM\n");
+			ret |= SETIREG(SISSR, 0x14, 0x31);
 			/* *** TODO *** */
 		}
 
@@ -2142,17 +2176,18 @@ sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
 #undef READL
 #undef WRITEL
 
-static void
-sisusb_get_ramconfig(struct sisusb_usb_data *sisusb)
+static void sisusb_get_ramconfig(struct sisusb_usb_data *sisusb)
 {
 	u8 tmp8, tmp82, ramtype;
 	int bw = 0;
 	char *ramtypetext1 = NULL;
-	const char *ramtypetext2[] = {	"SDR SDRAM", "SDR SGRAM",
-					"DDR SDRAM", "DDR SGRAM" };
-	static const int busSDR[4]  = {64, 64, 128, 128};
-	static const int busDDR[4]  = {32, 32,  64,  64};
-	static const int busDDRA[4] = {64+32, 64+32 , (64+32)*2, (64+32)*2};
+	const char *ramtypetext2[] = { "SDR SDRAM", "SDR SGRAM",
+		"DDR SDRAM", "DDR SGRAM"
+	};
+	static const int busSDR[4] = { 64, 64, 128, 128 };
+	static const int busDDR[4] = { 32, 32, 64, 64 };
+	static const int busDDRA[4] =
+	    { 64 + 32, 64 + 32, (64 + 32) * 2, (64 + 32) * 2 };
 
 	sisusb_getidxreg(sisusb, SISSR, 0x14, &tmp8);
 	sisusb_getidxreg(sisusb, SISSR, 0x15, &tmp82);
@@ -2160,60 +2195,64 @@ sisusb_get_ramconfig(struct sisusb_usb_data *sisusb)
 	sisusb->vramsize = (1 << ((tmp8 & 0xf0) >> 4)) * 1024 * 1024;
 	ramtype &= 0x03;
 	switch ((tmp8 >> 2) & 0x03) {
-	case 0: ramtypetext1 = "1 ch/1 r";
+	case 0:
+		ramtypetext1 = "1 ch/1 r";
 		if (tmp82 & 0x10) {
 			bw = 32;
 		} else {
 			bw = busSDR[(tmp8 & 0x03)];
 		}
 		break;
-	case 1: ramtypetext1 = "1 ch/2 r";
+	case 1:
+		ramtypetext1 = "1 ch/2 r";
 		sisusb->vramsize <<= 1;
 		bw = busSDR[(tmp8 & 0x03)];
 		break;
-	case 2: ramtypetext1 = "asymmeric";
-		sisusb->vramsize += sisusb->vramsize/2;
+	case 2:
+		ramtypetext1 = "asymmeric";
+		sisusb->vramsize += sisusb->vramsize / 2;
 		bw = busDDRA[(tmp8 & 0x03)];
 		break;
-	case 3: ramtypetext1 = "2 channel";
+	case 3:
+		ramtypetext1 = "2 channel";
 		sisusb->vramsize <<= 1;
 		bw = busDDR[(tmp8 & 0x03)];
 		break;
 	}
 
-	dev_info(&sisusb->sisusb_dev->dev, "%dMB %s %s, bus width %d\n", (sisusb->vramsize >> 20), ramtypetext1,
-			ramtypetext2[ramtype], bw);
+	dev_info(&sisusb->sisusb_dev->dev, "%dMB %s %s, bus width %d\n",
+		 (sisusb->vramsize >> 20), ramtypetext1, ramtypetext2[ramtype],
+		 bw);
 }
 
-static int
-sisusb_do_init_gfxdevice(struct sisusb_usb_data *sisusb)
+static int sisusb_do_init_gfxdevice(struct sisusb_usb_data *sisusb)
 {
 	struct sisusb_packet packet;
 	int ret;
 	u32 tmp32;
 
 	/* Do some magic */
-	packet.header  = 0x001f;
+	packet.header = 0x001f;
 	packet.address = 0x00000324;
-	packet.data    = 0x00000004;
+	packet.data = 0x00000004;
 	ret = sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
 
-	packet.header  = 0x001f;
+	packet.header = 0x001f;
 	packet.address = 0x00000364;
-	packet.data    = 0x00000004;
+	packet.data = 0x00000004;
 	ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
 
-	packet.header  = 0x001f;
+	packet.header = 0x001f;
 	packet.address = 0x00000384;
-	packet.data    = 0x00000004;
+	packet.data = 0x00000004;
 	ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
 
-	packet.header  = 0x001f;
+	packet.header = 0x001f;
 	packet.address = 0x00000100;
-	packet.data    = 0x00000700;
+	packet.data = 0x00000700;
 	ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
 
-	packet.header  = 0x000f;
+	packet.header = 0x000f;
 	packet.address = 0x00000004;
 	ret |= sisusb_send_bridge_packet(sisusb, 6, &packet, 0);
 	packet.data |= 0x17;
@@ -2250,9 +2289,9 @@ sisusb_do_init_gfxdevice(struct sisusb_usb_data *sisusb)
 
 	if (ret == 0) {
 		/* Some further magic */
-		packet.header  = 0x001f;
+		packet.header = 0x001f;
 		packet.address = 0x00000050;
-		packet.data    = 0x000000ff;
+		packet.data = 0x000000ff;
 		ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
 	}
 
@@ -2264,8 +2303,7 @@ sisusb_do_init_gfxdevice(struct sisusb_usb_data *sisusb)
  * of the graphics board.
  */
 
-static int
-sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen)
+static int sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen)
 {
 	int ret = 0, test = 0;
 	u32 tmp32;
@@ -2273,16 +2311,22 @@ sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen)
 	if (sisusb->devinit == 1) {
 		/* Read PCI BARs and see if they have been set up */
 		ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32);
-		if (ret) return ret;
-		if ((tmp32 & 0xfffffff0) == SISUSB_PCI_MEMBASE) test++;
+		if (ret)
+			return ret;
+		if ((tmp32 & 0xfffffff0) == SISUSB_PCI_MEMBASE)
+			test++;
 
 		ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32);
-		if (ret) return ret;
-		if ((tmp32 & 0xfffffff0) == SISUSB_PCI_MMIOBASE) test++;
+		if (ret)
+			return ret;
+		if ((tmp32 & 0xfffffff0) == SISUSB_PCI_MMIOBASE)
+			test++;
 
 		ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32);
-		if (ret) return ret;
-		if ((tmp32 & 0xfffffff0) == SISUSB_PCI_IOPORTBASE) test++;
+		if (ret)
+			return ret;
+		if ((tmp32 & 0xfffffff0) == SISUSB_PCI_IOPORTBASE)
+			test++;
 	}
 
 	/* No? So reset the device */
@@ -2308,7 +2352,6 @@ sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen)
 	return ret;
 }
 
-
 #ifdef INCL_SISUSB_CON
 
 /* Set up default text mode:
@@ -2317,15 +2360,15 @@ sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen)
    - Upload user font (if available)
 */
 
-int
-sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
+int sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
 {
 	int ret = 0, slot = sisusb->font_slot, i;
 	const struct font_desc *myfont;
 	u8 *tempbuf;
 	u16 *tempbufb;
 	size_t written;
-	static const char bootstring[] = "SiSUSB VGA text console, (C) 2005 Thomas Winischhofer.";
+	static const char bootstring[] =
+	    "SiSUSB VGA text console, (C) 2005 Thomas Winischhofer.";
 	static const char bootlogo[] = "(o_ //\\ V_/_";
 
 	/* sisusb->lock is down */
@@ -2349,18 +2392,21 @@ sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
 		memcpy(tempbuf + (i * 32), myfont->data + (i * 16), 16);
 
 	/* Upload default font */
-	ret = sisusbcon_do_font_op(sisusb, 1, 0, tempbuf, 8192, 0, 1, NULL, 16, 0);
+	ret =
+	    sisusbcon_do_font_op(sisusb, 1, 0, tempbuf, 8192, 0, 1, NULL, 16,
+				 0);
 
 	vfree(tempbuf);
 
 	/* Upload user font (and reset current slot) */
 	if (sisusb->font_backup) {
 		ret |= sisusbcon_do_font_op(sisusb, 1, 2, sisusb->font_backup,
-				8192, sisusb->font_backup_512, 1, NULL,
-				sisusb->font_backup_height, 0);
+					    8192, sisusb->font_backup_512, 1,
+					    NULL, sisusb->font_backup_height,
+					    0);
 		if (slot != 2)
 			sisusbcon_do_font_op(sisusb, 1, 0, NULL, 0, 0, 1,
-					NULL, 16, 0);
+					     NULL, 16, 0);
 	}
 
 	if (init && !sisusb->scrbuf) {
@@ -2368,12 +2414,12 @@ sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
 		if ((tempbuf = vmalloc(8192))) {
 
 			i = 4096;
-			tempbufb = (u16 *)tempbuf;
+			tempbufb = (u16 *) tempbuf;
 			while (i--)
 				*(tempbufb++) = 0x0720;
 
 			i = 0;
-			tempbufb = (u16 *)tempbuf;
+			tempbufb = (u16 *) tempbuf;
 			while (bootlogo[i]) {
 				*(tempbufb++) = 0x0700 | bootlogo[i++];
 				if (!(i % 4))
@@ -2381,12 +2427,13 @@ sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
 			}
 
 			i = 0;
-			tempbufb = (u16 *)tempbuf + 6;
+			tempbufb = (u16 *) tempbuf + 6;
 			while (bootstring[i])
 				*(tempbufb++) = 0x0700 | bootstring[i++];
 
 			ret |= sisusb_copy_memory(sisusb, tempbuf,
-				sisusb->vrambase, 8192, &written);
+						  sisusb->vrambase, 8192,
+						  &written);
 
 			vfree(tempbuf);
 
@@ -2395,16 +2442,17 @@ sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
 	} else if (sisusb->scrbuf) {
 
 		ret |= sisusb_copy_memory(sisusb, (char *)sisusb->scrbuf,
-				sisusb->vrambase, sisusb->scrbuf_size, &written);
+					  sisusb->vrambase, sisusb->scrbuf_size,
+					  &written);
 
 	}
 
 	if (sisusb->sisusb_cursor_size_from >= 0 &&
 	    sisusb->sisusb_cursor_size_to >= 0) {
 		sisusb_setidxreg(sisusb, SISCR, 0x0a,
-				sisusb->sisusb_cursor_size_from);
+				 sisusb->sisusb_cursor_size_from);
 		sisusb_setidxregandor(sisusb, SISCR, 0x0b, 0xe0,
-				sisusb->sisusb_cursor_size_to);
+				      sisusb->sisusb_cursor_size_to);
 	} else {
 		sisusb_setidxreg(sisusb, SISCR, 0x0a, 0x2d);
 		sisusb_setidxreg(sisusb, SISCR, 0x0b, 0x0e);
@@ -2412,7 +2460,8 @@ sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
 	}
 
 	slot = sisusb->sisusb_cursor_loc;
-	if(slot < 0) slot = 0;
+	if (slot < 0)
+		slot = 0;
 
 	sisusb->sisusb_cursor_loc = -1;
 	sisusb->bad_cursor_pos = 1;
@@ -2433,8 +2482,7 @@ sisusb_reset_text_mode(struct sisusb_usb_data *sisusb, int init)
 
 /* fops */
 
-static int
-sisusb_open(struct inode *inode, struct file *file)
+static int sisusb_open(struct inode *inode, struct file *file)
 {
 	struct sisusb_usb_data *sisusb;
 	struct usb_interface *interface;
@@ -2464,12 +2512,14 @@ sisusb_open(struct inode *inode, struct file *file)
 		if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH) {
 			if (sisusb_init_gfxdevice(sisusb, 0)) {
 				mutex_unlock(&sisusb->lock);
-				dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n");
+				dev_err(&sisusb->sisusb_dev->dev,
+					"Failed to initialize device\n");
 				return -EIO;
 			}
 		} else {
 			mutex_unlock(&sisusb->lock);
-			dev_err(&sisusb->sisusb_dev->dev, "Device not attached to USB 2.0 hub\n");
+			dev_err(&sisusb->sisusb_dev->dev,
+				"Device not attached to USB 2.0 hub\n");
 			return -EIO;
 		}
 	}
@@ -2486,8 +2536,7 @@ sisusb_open(struct inode *inode, struct file *file)
 	return 0;
 }
 
-void
-sisusb_delete(struct kref *kref)
+void sisusb_delete(struct kref *kref)
 {
 	struct sisusb_usb_data *sisusb = to_sisusb_dev(kref);
 
@@ -2506,8 +2555,7 @@ sisusb_delete(struct kref *kref)
 	kfree(sisusb);
 }
 
-static int
-sisusb_release(struct inode *inode, struct file *file)
+static int sisusb_release(struct inode *inode, struct file *file)
 {
 	struct sisusb_usb_data *sisusb;
 
@@ -2534,7 +2582,8 @@ sisusb_release(struct inode *inode, struct file *file)
 }
 
 static ssize_t
-sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
+sisusb_read(struct file *file, char __user * buffer, size_t count,
+	    loff_t * ppos)
 {
 	struct sisusb_usb_data *sisusb;
 	ssize_t bytes_read = 0;
@@ -2555,11 +2604,10 @@ sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 	}
 
 	if ((*ppos) >= SISUSB_PCI_PSEUDO_IOPORTBASE &&
-	    (*ppos) <  SISUSB_PCI_PSEUDO_IOPORTBASE + 128) {
+	    (*ppos) < SISUSB_PCI_PSEUDO_IOPORTBASE + 128) {
 
 		address = (*ppos) -
-			SISUSB_PCI_PSEUDO_IOPORTBASE +
-			SISUSB_PCI_IOPORTBASE;
+		    SISUSB_PCI_PSEUDO_IOPORTBASE + SISUSB_PCI_IOPORTBASE;
 
 		/* Read i/o ports
 		 * Byte, word and long(32) can be read. As this
@@ -2568,81 +2616,79 @@ sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 		 */
 		switch (count) {
 
-			case 1:
-				if (sisusb_read_memio_byte(sisusb,
-							SISUSB_TYPE_IO,
-							address, &buf8))
-					errno = -EIO;
-				else if (put_user(buf8, (u8 __user *)buffer))
-					errno = -EFAULT;
-				else
-					bytes_read = 1;
+		case 1:
+			if (sisusb_read_memio_byte(sisusb,
+						   SISUSB_TYPE_IO,
+						   address, &buf8))
+				errno = -EIO;
+			else if (put_user(buf8, (u8 __user *) buffer))
+				errno = -EFAULT;
+			else
+				bytes_read = 1;
 
-				break;
+			break;
 
-			case 2:
-				if (sisusb_read_memio_word(sisusb,
-							SISUSB_TYPE_IO,
-							address, &buf16))
-					errno = -EIO;
-				else if (put_user(buf16, (u16 __user *)buffer))
-					errno = -EFAULT;
-				else
-					bytes_read = 2;
+		case 2:
+			if (sisusb_read_memio_word(sisusb,
+						   SISUSB_TYPE_IO,
+						   address, &buf16))
+				errno = -EIO;
+			else if (put_user(buf16, (u16 __user *) buffer))
+				errno = -EFAULT;
+			else
+				bytes_read = 2;
 
-				break;
+			break;
 
-			case 4:
-				if (sisusb_read_memio_long(sisusb,
-							SISUSB_TYPE_IO,
-							address, &buf32))
-					errno = -EIO;
-				else if (put_user(buf32, (u32 __user *)buffer))
-					errno = -EFAULT;
-				else
-					bytes_read = 4;
+		case 4:
+			if (sisusb_read_memio_long(sisusb,
+						   SISUSB_TYPE_IO,
+						   address, &buf32))
+				errno = -EIO;
+			else if (put_user(buf32, (u32 __user *) buffer))
+				errno = -EFAULT;
+			else
+				bytes_read = 4;
 
-				break;
+			break;
 
-			default:
-				errno = -EIO;
+		default:
+			errno = -EIO;
 
 		}
 
 	} else if ((*ppos) >= SISUSB_PCI_PSEUDO_MEMBASE &&
-		   (*ppos) <  SISUSB_PCI_PSEUDO_MEMBASE + sisusb->vramsize) {
+		   (*ppos) < SISUSB_PCI_PSEUDO_MEMBASE + sisusb->vramsize) {
 
 		address = (*ppos) -
-			SISUSB_PCI_PSEUDO_MEMBASE +
-			SISUSB_PCI_MEMBASE;
+		    SISUSB_PCI_PSEUDO_MEMBASE + SISUSB_PCI_MEMBASE;
 
 		/* Read video ram
 		 * Remember: Data delivered is never endian-corrected
 		 */
 		errno = sisusb_read_mem_bulk(sisusb, address,
-					NULL, count, buffer, &bytes_read);
+					     NULL, count, buffer, &bytes_read);
 
 		if (bytes_read)
 			errno = bytes_read;
 
-	} else  if ((*ppos) >= SISUSB_PCI_PSEUDO_MMIOBASE &&
-		    (*ppos) <  SISUSB_PCI_PSEUDO_MMIOBASE + SISUSB_PCI_MMIOSIZE) {
+	} else if ((*ppos) >= SISUSB_PCI_PSEUDO_MMIOBASE &&
+		   (*ppos) < SISUSB_PCI_PSEUDO_MMIOBASE + SISUSB_PCI_MMIOSIZE) {
 
 		address = (*ppos) -
-			SISUSB_PCI_PSEUDO_MMIOBASE +
-			SISUSB_PCI_MMIOBASE;
+		    SISUSB_PCI_PSEUDO_MMIOBASE + SISUSB_PCI_MMIOBASE;
 
 		/* Read MMIO
 		 * Remember: Data delivered is never endian-corrected
 		 */
 		errno = sisusb_read_mem_bulk(sisusb, address,
-					NULL, count, buffer, &bytes_read);
+					     NULL, count, buffer, &bytes_read);
 
 		if (bytes_read)
 			errno = bytes_read;
 
-	} else  if ((*ppos) >= SISUSB_PCI_PSEUDO_PCIBASE &&
-		    (*ppos) <= SISUSB_PCI_PSEUDO_PCIBASE + 0x5c) {
+	} else if ((*ppos) >= SISUSB_PCI_PSEUDO_PCIBASE &&
+		   (*ppos) <= SISUSB_PCI_PSEUDO_PCIBASE + 0x5c) {
 
 		if (count != 4) {
 			mutex_unlock(&sisusb->lock);
@@ -2656,7 +2702,7 @@ sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 		 */
 		if (sisusb_read_pci_config(sisusb, address, &buf32))
 			errno = -EIO;
-		else if (put_user(buf32, (u32 __user *)buffer))
+		else if (put_user(buf32, (u32 __user *) buffer))
 			errno = -EFAULT;
 		else
 			bytes_read = 4;
@@ -2675,8 +2721,8 @@ sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 }
 
 static ssize_t
-sisusb_write(struct file *file, const char __user *buffer, size_t count,
-								loff_t *ppos)
+sisusb_write(struct file *file, const char __user * buffer, size_t count,
+	     loff_t * ppos)
 {
 	struct sisusb_usb_data *sisusb;
 	int errno = 0;
@@ -2697,11 +2743,10 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
 	}
 
 	if ((*ppos) >= SISUSB_PCI_PSEUDO_IOPORTBASE &&
-	    (*ppos) <  SISUSB_PCI_PSEUDO_IOPORTBASE + 128) {
+	    (*ppos) < SISUSB_PCI_PSEUDO_IOPORTBASE + 128) {
 
 		address = (*ppos) -
-			SISUSB_PCI_PSEUDO_IOPORTBASE +
-			SISUSB_PCI_IOPORTBASE;
+		    SISUSB_PCI_PSEUDO_IOPORTBASE + SISUSB_PCI_IOPORTBASE;
 
 		/* Write i/o ports
 		 * Byte, word and long(32) can be written. As this
@@ -2710,52 +2755,51 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
 		 */
 		switch (count) {
 
-			case 1:
-				if (get_user(buf8, (u8 __user *)buffer))
-					errno = -EFAULT;
-				else if (sisusb_write_memio_byte(sisusb,
-							SISUSB_TYPE_IO,
-							address, buf8))
-					errno = -EIO;
-				else
-					bytes_written = 1;
+		case 1:
+			if (get_user(buf8, (u8 __user *) buffer))
+				errno = -EFAULT;
+			else if (sisusb_write_memio_byte(sisusb,
+							 SISUSB_TYPE_IO,
+							 address, buf8))
+				errno = -EIO;
+			else
+				bytes_written = 1;
 
-				break;
+			break;
 
-			case 2:
-				if (get_user(buf16, (u16 __user *)buffer))
-					errno = -EFAULT;
-				else if (sisusb_write_memio_word(sisusb,
-							SISUSB_TYPE_IO,
-							address, buf16))
-					errno = -EIO;
-				else
-					bytes_written = 2;
+		case 2:
+			if (get_user(buf16, (u16 __user *) buffer))
+				errno = -EFAULT;
+			else if (sisusb_write_memio_word(sisusb,
+							 SISUSB_TYPE_IO,
+							 address, buf16))
+				errno = -EIO;
+			else
+				bytes_written = 2;
 
-				break;
+			break;
 
-			case 4:
-				if (get_user(buf32, (u32 __user *)buffer))
-					errno = -EFAULT;
-				else if (sisusb_write_memio_long(sisusb,
-							SISUSB_TYPE_IO,
-							address, buf32))
-					errno = -EIO;
-				else
-					bytes_written = 4;
+		case 4:
+			if (get_user(buf32, (u32 __user *) buffer))
+				errno = -EFAULT;
+			else if (sisusb_write_memio_long(sisusb,
+							 SISUSB_TYPE_IO,
+							 address, buf32))
+				errno = -EIO;
+			else
+				bytes_written = 4;
 
-				break;
+			break;
 
-			default:
-				errno = -EIO;
+		default:
+			errno = -EIO;
 		}
 
 	} else if ((*ppos) >= SISUSB_PCI_PSEUDO_MEMBASE &&
-		   (*ppos) <  SISUSB_PCI_PSEUDO_MEMBASE + sisusb->vramsize) {
+		   (*ppos) < SISUSB_PCI_PSEUDO_MEMBASE + sisusb->vramsize) {
 
 		address = (*ppos) -
-			SISUSB_PCI_PSEUDO_MEMBASE +
-			SISUSB_PCI_MEMBASE;
+		    SISUSB_PCI_PSEUDO_MEMBASE + SISUSB_PCI_MEMBASE;
 
 		/* Write video ram.
 		 * Buffer is copied 1:1, therefore, on big-endian
@@ -2764,17 +2808,16 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
 		 * mode or if YUV data is being transferred).
 		 */
 		errno = sisusb_write_mem_bulk(sisusb, address, NULL,
-					count, buffer, 0, &bytes_written);
+					      count, buffer, 0, &bytes_written);
 
 		if (bytes_written)
 			errno = bytes_written;
 
-	} else  if ((*ppos) >= SISUSB_PCI_PSEUDO_MMIOBASE &&
-		    (*ppos) <  SISUSB_PCI_PSEUDO_MMIOBASE + SISUSB_PCI_MMIOSIZE) {
+	} else if ((*ppos) >= SISUSB_PCI_PSEUDO_MMIOBASE &&
+		   (*ppos) < SISUSB_PCI_PSEUDO_MMIOBASE + SISUSB_PCI_MMIOSIZE) {
 
 		address = (*ppos) -
-			SISUSB_PCI_PSEUDO_MMIOBASE +
-			SISUSB_PCI_MMIOBASE;
+		    SISUSB_PCI_PSEUDO_MMIOBASE + SISUSB_PCI_MMIOBASE;
 
 		/* Write MMIO.
 		 * Buffer is copied 1:1, therefore, on big-endian
@@ -2782,13 +2825,14 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
 		 * in advance.
 		 */
 		errno = sisusb_write_mem_bulk(sisusb, address, NULL,
-					count, buffer, 0, &bytes_written);
+					      count, buffer, 0, &bytes_written);
 
 		if (bytes_written)
 			errno = bytes_written;
 
-	} else  if ((*ppos) >= SISUSB_PCI_PSEUDO_PCIBASE &&
-		    (*ppos) <= SISUSB_PCI_PSEUDO_PCIBASE + SISUSB_PCI_PCONFSIZE) {
+	} else if ((*ppos) >= SISUSB_PCI_PSEUDO_PCIBASE &&
+		   (*ppos) <=
+		   SISUSB_PCI_PSEUDO_PCIBASE + SISUSB_PCI_PCONFSIZE) {
 
 		if (count != 4) {
 			mutex_unlock(&sisusb->lock);
@@ -2800,14 +2844,13 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
 		/* Write PCI config register.
 		 * Given value expected in machine endianness.
 		 */
-		if (get_user(buf32, (u32 __user *)buffer))
+		if (get_user(buf32, (u32 __user *) buffer))
 			errno = -EFAULT;
 		else if (sisusb_write_pci_config(sisusb, address, buf32))
 			errno = -EIO;
 		else
 			bytes_written = 4;
 
-
 	} else {
 
 		/* Error */
@@ -2822,8 +2865,7 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
 	return errno ? errno : bytes_written;
 }
 
-static loff_t
-sisusb_lseek(struct file *file, loff_t offset, int orig)
+static loff_t sisusb_lseek(struct file *file, loff_t offset, int orig)
 {
 	struct sisusb_usb_data *sisusb;
 	loff_t ret;
@@ -2840,19 +2882,19 @@ sisusb_lseek(struct file *file, loff_t offset, int orig)
 	}
 
 	switch (orig) {
-		case 0:
-			file->f_pos = offset;
-			ret = file->f_pos;
-			/* never negative, no force_successful_syscall needed */
-			break;
-		case 1:
-			file->f_pos += offset;
-			ret = file->f_pos;
-			/* never negative, no force_successful_syscall needed */
-			break;
-		default:
-			/* seeking relative to "end of file" is not supported */
-			ret = -EINVAL;
+	case 0:
+		file->f_pos = offset;
+		ret = file->f_pos;
+		/* never negative, no force_successful_syscall needed */
+		break;
+	case 1:
+		file->f_pos += offset;
+		ret = file->f_pos;
+		/* never negative, no force_successful_syscall needed */
+		break;
+	default:
+		/* seeking relative to "end of file" is not supported */
+		ret = -EINVAL;
 	}
 
 	mutex_unlock(&sisusb->lock);
@@ -2861,10 +2903,10 @@ sisusb_lseek(struct file *file, loff_t offset, int orig)
 
 static int
 sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y,
-							unsigned long arg)
+		      unsigned long arg)
 {
-	int	retval, port, length;
-	u32	address;
+	int retval, port, length;
+	u32 address;
 
 	/* All our commands require the device
 	 * to be initialized.
@@ -2872,110 +2914,102 @@ sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y,
 	if (!sisusb->devinit)
 		return -ENODEV;
 
-	port = y->data3 -
-		SISUSB_PCI_PSEUDO_IOPORTBASE +
-		SISUSB_PCI_IOPORTBASE;
+	port = y->data3 - SISUSB_PCI_PSEUDO_IOPORTBASE + SISUSB_PCI_IOPORTBASE;
 
 	switch (y->operation) {
-		case SUCMD_GET:
-			retval = sisusb_getidxreg(sisusb, port,
-							 y->data0, &y->data1);
-			if (!retval) {
-				if (copy_to_user((void __user *)arg, y,
-							sizeof(*y)))
-					retval = -EFAULT;
-			}
-			break;
+	case SUCMD_GET:
+		retval = sisusb_getidxreg(sisusb, port, y->data0, &y->data1);
+		if (!retval) {
+			if (copy_to_user((void __user *)arg, y, sizeof(*y)))
+				retval = -EFAULT;
+		}
+		break;
 
-		case SUCMD_SET:
-			retval = sisusb_setidxreg(sisusb, port,
-						y->data0, y->data1);
-			break;
+	case SUCMD_SET:
+		retval = sisusb_setidxreg(sisusb, port, y->data0, y->data1);
+		break;
 
-		case SUCMD_SETOR:
-			retval = sisusb_setidxregor(sisusb, port,
-						y->data0, y->data1);
-			break;
+	case SUCMD_SETOR:
+		retval = sisusb_setidxregor(sisusb, port, y->data0, y->data1);
+		break;
 
-		case SUCMD_SETAND:
-			retval = sisusb_setidxregand(sisusb, port,
-						y->data0, y->data1);
-			break;
+	case SUCMD_SETAND:
+		retval = sisusb_setidxregand(sisusb, port, y->data0, y->data1);
+		break;
 
-		case SUCMD_SETANDOR:
-			retval = sisusb_setidxregandor(sisusb, port,
-						y->data0, y->data1, y->data2);
-			break;
+	case SUCMD_SETANDOR:
+		retval = sisusb_setidxregandor(sisusb, port,
+					       y->data0, y->data1, y->data2);
+		break;
 
-		case SUCMD_SETMASK:
-			retval = sisusb_setidxregmask(sisusb, port,
-						y->data0, y->data1, y->data2);
-			break;
+	case SUCMD_SETMASK:
+		retval = sisusb_setidxregmask(sisusb, port,
+					      y->data0, y->data1, y->data2);
+		break;
 
-		case SUCMD_CLRSCR:
-			/* Gfx core must be initialized */
-			if (!sisusb->gfxinit)
-				return -ENODEV;
+	case SUCMD_CLRSCR:
+		/* Gfx core must be initialized */
+		if (!sisusb->gfxinit)
+			return -ENODEV;
 
-			length = (y->data0 << 16) | (y->data1 << 8) | y->data2;
-			address = y->data3 -
-				SISUSB_PCI_PSEUDO_MEMBASE +
-				SISUSB_PCI_MEMBASE;
-			retval = sisusb_clear_vram(sisusb, address, length);
-			break;
+		length = (y->data0 << 16) | (y->data1 << 8) | y->data2;
+		address = y->data3 -
+		    SISUSB_PCI_PSEUDO_MEMBASE + SISUSB_PCI_MEMBASE;
+		retval = sisusb_clear_vram(sisusb, address, length);
+		break;
 
-		case SUCMD_HANDLETEXTMODE:
-			retval = 0;
+	case SUCMD_HANDLETEXTMODE:
+		retval = 0;
 #ifdef INCL_SISUSB_CON
-			/* Gfx core must be initialized, SiS_Pr must exist */
-			if (!sisusb->gfxinit || !sisusb->SiS_Pr)
-				return -ENODEV;
+		/* Gfx core must be initialized, SiS_Pr must exist */
+		if (!sisusb->gfxinit || !sisusb->SiS_Pr)
+			return -ENODEV;
 
-			switch (y->data0) {
-			case 0:
-				retval = sisusb_reset_text_mode(sisusb, 0);
-				break;
-			case 1:
-				sisusb->textmodedestroyed = 1;
-				break;
-			}
-#endif
+		switch (y->data0) {
+		case 0:
+			retval = sisusb_reset_text_mode(sisusb, 0);
+			break;
+		case 1:
+			sisusb->textmodedestroyed = 1;
 			break;
+		}
+#endif
+		break;
 
 #ifdef INCL_SISUSB_CON
-		case SUCMD_SETMODE:
-			/* Gfx core must be initialized, SiS_Pr must exist */
-			if (!sisusb->gfxinit || !sisusb->SiS_Pr)
-				return -ENODEV;
+	case SUCMD_SETMODE:
+		/* Gfx core must be initialized, SiS_Pr must exist */
+		if (!sisusb->gfxinit || !sisusb->SiS_Pr)
+			return -ENODEV;
 
-			retval = 0;
+		retval = 0;
 
-			sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30;
-			sisusb->SiS_Pr->sisusb = (void *)sisusb;
+		sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30;
+		sisusb->SiS_Pr->sisusb = (void *)sisusb;
 
-			if (SiSUSBSetMode(sisusb->SiS_Pr, y->data3))
-				retval = -EINVAL;
+		if (SiSUSBSetMode(sisusb->SiS_Pr, y->data3))
+			retval = -EINVAL;
 
-			break;
+		break;
 
-		case SUCMD_SETVESAMODE:
-			/* Gfx core must be initialized, SiS_Pr must exist */
-			if (!sisusb->gfxinit || !sisusb->SiS_Pr)
-				return -ENODEV;
+	case SUCMD_SETVESAMODE:
+		/* Gfx core must be initialized, SiS_Pr must exist */
+		if (!sisusb->gfxinit || !sisusb->SiS_Pr)
+			return -ENODEV;
 
-			retval = 0;
+		retval = 0;
 
-			sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30;
-			sisusb->SiS_Pr->sisusb = (void *)sisusb;
+		sisusb->SiS_Pr->IOAddress = SISUSB_PCI_IOPORTBASE + 0x30;
+		sisusb->SiS_Pr->sisusb = (void *)sisusb;
 
-			if (SiSUSBSetVESAMode(sisusb->SiS_Pr, y->data3))
-				retval = -EINVAL;
+		if (SiSUSBSetVESAMode(sisusb->SiS_Pr, y->data3))
+			retval = -EINVAL;
 
-			break;
+		break;
 #endif
 
-		default:
-			retval = -EINVAL;
+	default:
+		retval = -EINVAL;
 	}
 
 	if (retval > 0)
@@ -2986,13 +3020,13 @@ sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y,
 
 static int
 sisusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-							unsigned long arg)
+	     unsigned long arg)
 {
 	struct sisusb_usb_data *sisusb;
 	struct sisusb_info x;
 	struct sisusb_command y;
-	int	retval = 0;
-	u32 __user *argp = (u32 __user *)arg;
+	int retval = 0;
+	u32 __user *argp = (u32 __user *) arg;
 
 	if (!(sisusb = (struct sisusb_usb_data *)file->private_data))
 		return -ENODEV;
@@ -3007,53 +3041,53 @@ sisusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 
 	switch (cmd) {
 
-		case SISUSB_GET_CONFIG_SIZE:
+	case SISUSB_GET_CONFIG_SIZE:
 
-			if (put_user(sizeof(x), argp))
-				retval = -EFAULT;
+		if (put_user(sizeof(x), argp))
+			retval = -EFAULT;
 
-			break;
+		break;
 
-		case SISUSB_GET_CONFIG:
-
-			x.sisusb_id	    = SISUSB_ID;
-			x.sisusb_version    = SISUSB_VERSION;
-			x.sisusb_revision   = SISUSB_REVISION;
-			x.sisusb_patchlevel = SISUSB_PATCHLEVEL;
-			x.sisusb_gfxinit    = sisusb->gfxinit;
-			x.sisusb_vrambase   = SISUSB_PCI_PSEUDO_MEMBASE;
-			x.sisusb_mmiobase   = SISUSB_PCI_PSEUDO_MMIOBASE;
-			x.sisusb_iobase     = SISUSB_PCI_PSEUDO_IOPORTBASE;
-			x.sisusb_pcibase    = SISUSB_PCI_PSEUDO_PCIBASE;
-			x.sisusb_vramsize   = sisusb->vramsize;
-			x.sisusb_minor	    = sisusb->minor;
-			x.sisusb_fbdevactive= 0;
+	case SISUSB_GET_CONFIG:
+
+		x.sisusb_id = SISUSB_ID;
+		x.sisusb_version = SISUSB_VERSION;
+		x.sisusb_revision = SISUSB_REVISION;
+		x.sisusb_patchlevel = SISUSB_PATCHLEVEL;
+		x.sisusb_gfxinit = sisusb->gfxinit;
+		x.sisusb_vrambase = SISUSB_PCI_PSEUDO_MEMBASE;
+		x.sisusb_mmiobase = SISUSB_PCI_PSEUDO_MMIOBASE;
+		x.sisusb_iobase = SISUSB_PCI_PSEUDO_IOPORTBASE;
+		x.sisusb_pcibase = SISUSB_PCI_PSEUDO_PCIBASE;
+		x.sisusb_vramsize = sisusb->vramsize;
+		x.sisusb_minor = sisusb->minor;
+		x.sisusb_fbdevactive = 0;
 #ifdef INCL_SISUSB_CON
-			x.sisusb_conactive  = sisusb->haveconsole ? 1 : 0;
+		x.sisusb_conactive = sisusb->haveconsole ? 1 : 0;
 #else
-			x.sisusb_conactive  = 0;
+		x.sisusb_conactive = 0;
 #endif
 
-			if (copy_to_user((void __user *)arg, &x, sizeof(x)))
-				retval = -EFAULT;
+		if (copy_to_user((void __user *)arg, &x, sizeof(x)))
+			retval = -EFAULT;
 
-			break;
+		break;
 
-		case SISUSB_COMMAND:
+	case SISUSB_COMMAND:
 
-			if (copy_from_user(&y, (void __user *)arg, sizeof(y)))
-				retval = -EFAULT;
-			else
-				retval = sisusb_handle_command(sisusb, &y, arg);
+		if (copy_from_user(&y, (void __user *)arg, sizeof(y)))
+			retval = -EFAULT;
+		else
+			retval = sisusb_handle_command(sisusb, &y, arg);
 
-			break;
+		break;
 
-		default:
-			retval = -ENOTTY;
-			break;
+	default:
+		retval = -ENOTTY;
+		break;
 	}
 
-err_out:
+      err_out:
 	mutex_unlock(&sisusb->lock);
 	return retval;
 }
@@ -3065,37 +3099,37 @@ sisusb_compat_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
 	long retval;
 
 	switch (cmd) {
-		case SISUSB_GET_CONFIG_SIZE:
-		case SISUSB_GET_CONFIG:
-		case SISUSB_COMMAND:
-			lock_kernel();
-			retval = sisusb_ioctl(f->f_path.dentry->d_inode, f, cmd, arg);
-			unlock_kernel();
-			return retval;
+	case SISUSB_GET_CONFIG_SIZE:
+	case SISUSB_GET_CONFIG:
+	case SISUSB_COMMAND:
+		lock_kernel();
+		retval = sisusb_ioctl(f->f_path.dentry->d_inode, f, cmd, arg);
+		unlock_kernel();
+		return retval;
 
-		default:
-			return -ENOIOCTLCMD;
+	default:
+		return -ENOIOCTLCMD;
 	}
 }
 #endif
 
 static const struct file_operations usb_sisusb_fops = {
-	.owner =	THIS_MODULE,
-	.open =		sisusb_open,
-	.release =	sisusb_release,
-	.read =		sisusb_read,
-	.write =	sisusb_write,
-	.llseek =	sisusb_lseek,
+	.owner = THIS_MODULE,
+	.open = sisusb_open,
+	.release = sisusb_release,
+	.read = sisusb_read,
+	.write = sisusb_write,
+	.llseek = sisusb_lseek,
 #ifdef SISUSB_NEW_CONFIG_COMPAT
 	.compat_ioctl = sisusb_compat_ioctl,
 #endif
-	.ioctl =	sisusb_ioctl
+	.ioctl = sisusb_ioctl
 };
 
 static struct usb_class_driver usb_sisusb_class = {
-	.name =		"sisusbvga%d",
-	.fops =		&usb_sisusb_fops,
-	.minor_base =	SISUSB_MINOR
+	.name = "sisusbvga%d",
+	.fops = &usb_sisusb_fops,
+	.minor_base = SISUSB_MINOR
 };
 
 static int sisusb_probe(struct usb_interface *intf,
@@ -3106,11 +3140,12 @@ static int sisusb_probe(struct usb_interface *intf,
 	int retval = 0, i;
 
 	dev_info(&dev->dev, "USB2VGA dongle found at address %d\n",
-		dev->devnum);
+		 dev->devnum);
 
 	/* Allocate memory for our private */
 	if (!(sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL))) {
-		dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for private data\n");
+		dev_err(&sisusb->sisusb_dev->dev,
+			"Failed to allocate memory for private data\n");
 		return -ENOMEM;
 	}
 	kref_init(&sisusb->kref);
@@ -3119,25 +3154,27 @@ static int sisusb_probe(struct usb_interface *intf,
 
 	/* Register device */
 	if ((retval = usb_register_dev(intf, &usb_sisusb_class))) {
-		dev_err(&sisusb->sisusb_dev->dev, "Failed to get a minor for device %d\n",
-			dev->devnum);
+		dev_err(&sisusb->sisusb_dev->dev,
+			"Failed to get a minor for device %d\n", dev->devnum);
 		retval = -ENODEV;
 		goto error_1;
 	}
 
 	sisusb->sisusb_dev = dev;
-	sisusb->minor      = intf->minor;
-	sisusb->vrambase   = SISUSB_PCI_MEMBASE;
-	sisusb->mmiobase   = SISUSB_PCI_MMIOBASE;
-	sisusb->mmiosize   = SISUSB_PCI_MMIOSIZE;
+	sisusb->minor = intf->minor;
+	sisusb->vrambase = SISUSB_PCI_MEMBASE;
+	sisusb->mmiobase = SISUSB_PCI_MMIOBASE;
+	sisusb->mmiosize = SISUSB_PCI_MMIOSIZE;
 	sisusb->ioportbase = SISUSB_PCI_IOPORTBASE;
 	/* Everything else is zero */
 
 	/* Allocate buffers */
 	sisusb->ibufsize = SISUSB_IBUF_SIZE;
 	if (!(sisusb->ibuf = usb_buffer_alloc(dev, SISUSB_IBUF_SIZE,
-					GFP_KERNEL, &sisusb->transfer_dma_in))) {
-		dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for input buffer");
+					      GFP_KERNEL,
+					      &sisusb->transfer_dma_in))) {
+		dev_err(&sisusb->sisusb_dev->dev,
+			"Failed to allocate memory for input buffer");
 		retval = -ENOMEM;
 		goto error_2;
 	}
@@ -3146,10 +3183,13 @@ static int sisusb_probe(struct usb_interface *intf,
 	sisusb->obufsize = SISUSB_OBUF_SIZE;
 	for (i = 0; i < NUMOBUFS; i++) {
 		if (!(sisusb->obuf[i] = usb_buffer_alloc(dev, SISUSB_OBUF_SIZE,
-					GFP_KERNEL,
-					&sisusb->transfer_dma_out[i]))) {
+							 GFP_KERNEL,
+							 &sisusb->
+							 transfer_dma_out[i])))
+		{
 			if (i == 0) {
-				dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for output buffer\n");
+				dev_err(&sisusb->sisusb_dev->dev,
+					"Failed to allocate memory for output buffer\n");
 				retval = -ENOMEM;
 				goto error_3;
 			}
@@ -3169,7 +3209,8 @@ static int sisusb_probe(struct usb_interface *intf,
 
 	for (i = 0; i < sisusb->numobufs; i++) {
 		if (!(sisusb->sisurbout[i] = usb_alloc_urb(0, GFP_KERNEL))) {
-			dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate URBs\n");
+			dev_err(&sisusb->sisusb_dev->dev,
+				"Failed to allocate URBs\n");
 			retval = -ENOMEM;
 			goto error_4;
 		}
@@ -3178,12 +3219,14 @@ static int sisusb_probe(struct usb_interface *intf,
 		sisusb->urbstatus[i] = 0;
 	}
 
-	dev_info(&sisusb->sisusb_dev->dev, "Allocated %d output buffers\n", sisusb->numobufs);
+	dev_info(&sisusb->sisusb_dev->dev, "Allocated %d output buffers\n",
+		 sisusb->numobufs);
 
 #ifdef INCL_SISUSB_CON
 	/* Allocate our SiS_Pr */
 	if (!(sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL))) {
-		dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate SiS_Pr\n");
+		dev_err(&sisusb->sisusb_dev->dev,
+			"Failed to allocate SiS_Pr\n");
 	}
 #endif
 
@@ -3199,15 +3242,16 @@ static int sisusb_probe(struct usb_interface *intf,
 
 #ifdef SISUSB_OLD_CONFIG_COMPAT
 	{
-	int ret;
-	/* Our ioctls are all "32/64bit compatible" */
-	ret =  register_ioctl32_conversion(SISUSB_GET_CONFIG_SIZE, NULL);
-	ret |= register_ioctl32_conversion(SISUSB_GET_CONFIG,      NULL);
-	ret |= register_ioctl32_conversion(SISUSB_COMMAND,         NULL);
-	if (ret)
-		dev_err(&sisusb->sisusb_dev->dev, "Error registering ioctl32 translations\n");
-	else
-		sisusb->ioctl32registered = 1;
+		int ret;
+		/* Our ioctls are all "32/64bit compatible" */
+		ret = register_ioctl32_conversion(SISUSB_GET_CONFIG_SIZE, NULL);
+		ret |= register_ioctl32_conversion(SISUSB_GET_CONFIG, NULL);
+		ret |= register_ioctl32_conversion(SISUSB_COMMAND, NULL);
+		if (ret)
+			dev_err(&sisusb->sisusb_dev->dev,
+				"Error registering ioctl32 translations\n");
+		else
+			sisusb->ioctl32registered = 1;
 	}
 #endif
 
@@ -3221,10 +3265,12 @@ static int sisusb_probe(struct usb_interface *intf,
 			initscreen = 0;
 #endif
 		if (sisusb_init_gfxdevice(sisusb, initscreen))
-			dev_err(&sisusb->sisusb_dev->dev, "Failed to early initialize device\n");
+			dev_err(&sisusb->sisusb_dev->dev,
+				"Failed to early initialize device\n");
 
 	} else
-		dev_info(&sisusb->sisusb_dev->dev, "Not attached to USB 2.0 hub, deferring init\n");
+		dev_info(&sisusb->sisusb_dev->dev,
+			 "Not attached to USB 2.0 hub, deferring init\n");
 
 	sisusb->ready = 1;
 
@@ -3240,13 +3286,13 @@ static int sisusb_probe(struct usb_interface *intf,
 
 	return 0;
 
-error_4:
+      error_4:
 	sisusb_free_urbs(sisusb);
-error_3:
+      error_3:
 	sisusb_free_buffers(sisusb);
-error_2:
+      error_2:
 	usb_deregister_dev(intf, &usb_sisusb_class);
-error_1:
+      error_1:
 	kfree(sisusb);
 	return retval;
 }
@@ -3277,11 +3323,12 @@ static void sisusb_disconnect(struct usb_interface *intf)
 	if (sisusb->ioctl32registered) {
 		int ret;
 		sisusb->ioctl32registered = 0;
-		ret =  unregister_ioctl32_conversion(SISUSB_GET_CONFIG_SIZE);
+		ret = unregister_ioctl32_conversion(SISUSB_GET_CONFIG_SIZE);
 		ret |= unregister_ioctl32_conversion(SISUSB_GET_CONFIG);
 		ret |= unregister_ioctl32_conversion(SISUSB_COMMAND);
 		if (ret) {
-			dev_err(&sisusb->sisusb_dev->dev, "Error unregistering ioctl32 translations\n");
+			dev_err(&sisusb->sisusb_dev->dev,
+				"Error unregistering ioctl32 translations\n");
 		}
 	}
 #endif
@@ -3297,22 +3344,22 @@ static void sisusb_disconnect(struct usb_interface *intf)
 	dev_info(&sisusb->sisusb_dev->dev, "Disconnected\n");
 }
 
-static struct usb_device_id sisusb_table [] = {
-	{ USB_DEVICE(0x0711, 0x0900) },
-	{ USB_DEVICE(0x0711, 0x0901) },
-	{ USB_DEVICE(0x0711, 0x0902) },
-	{ USB_DEVICE(0x182d, 0x021c) },
-	{ USB_DEVICE(0x182d, 0x0269) },
-	{ }
+static struct usb_device_id sisusb_table[] = {
+	{USB_DEVICE(0x0711, 0x0900)},
+	{USB_DEVICE(0x0711, 0x0901)},
+	{USB_DEVICE(0x0711, 0x0902)},
+	{USB_DEVICE(0x182d, 0x021c)},
+	{USB_DEVICE(0x182d, 0x0269)},
+	{}
 };
 
-MODULE_DEVICE_TABLE (usb, sisusb_table);
+MODULE_DEVICE_TABLE(usb, sisusb_table);
 
 static struct usb_driver sisusb_driver = {
-	.name =		"sisusb",
-	.probe =	sisusb_probe,
-	.disconnect =	sisusb_disconnect,
-	.id_table =	sisusb_table,
+	.name = "sisusb",
+	.probe = sisusb_probe,
+	.disconnect = sisusb_disconnect,
+	.id_table = sisusb_table,
 };
 
 static int __init usb_sisusb_init(void)
@@ -3326,9 +3373,10 @@ static int __init usb_sisusb_init(void)
 
 	if (!(retval = usb_register(&sisusb_driver))) {
 
-		dev_info(&sisusb->sisusb_dev->dev, "Driver version %d.%d.%d\n", SISUSB_VERSION,
-				SISUSB_REVISION, SISUSB_PATCHLEVEL);
-		dev_info(&sisusb->sisusb_dev->dev, "sisusb: Copyright (C) 2005 Thomas Winischhofer\n");
+		dev_info(&sisusb->sisusb_dev->dev, "Driver version %d.%d.%d\n",
+			 SISUSB_VERSION, SISUSB_REVISION, SISUSB_PATCHLEVEL);
+		dev_info(&sisusb->sisusb_dev->dev,
+			 "sisusb: Copyright (C) 2005 Thomas Winischhofer\n");
 
 	}
 
@@ -3344,6 +3392,6 @@ module_init(usb_sisusb_init);
 module_exit(usb_sisusb_exit);
 
 MODULE_AUTHOR("Thomas Winischhofer <[email protected]>");
-MODULE_DESCRIPTION("sisusbvga - Driver for Net2280/SiS315-based USB2VGA dongles");
+MODULE_DESCRIPTION
+    ("sisusbvga - Driver for Net2280/SiS315-based USB2VGA dongles");
 MODULE_LICENSE("GPL");
-
-- 
1.5.3.rc4.24.g5b56a


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.