speedtch cxacru.c,1.46,1.47

Duncan Sands duncan at infradead.org
Sun Oct 29 05:26:56 EST 2006


Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv20042

Modified Files:
	cxacru.c 
Log Message:
Fix up some endian problems (or rather: non-problems) pointed out by sparse.


Index: cxacru.c
===================================================================
RCS file: /home/cvs/speedtch/cxacru.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- cxacru.c	11 Oct 2006 07:51:33 -0000	1.46
+++ cxacru.c	29 Oct 2006 10:26:53 -0000	1.47
@@ -297,8 +297,8 @@
 			       u32 *data, int size)
 {
 	int ret, len;
-	u32 *buf;
-	int offb, offd;
+	__le32 *buf;
+	u32 offb, offd;
 	const int stride = CMD_PACKET_SIZE / (4 * 2) - 1;
 	int buflen =  ((size - 1) / stride + 1 + size * 2) * 4;
 
@@ -313,7 +313,7 @@
 	/* len > 0 && len % 4 == 0 guaranteed by cxacru_cm() */
 	len = ret / 4;
 	for (offb = 0; offb < len; ) {
-		int l = le32_to_cpu(buf[offb++]);
+		u32 l = le32_to_cpu(buf[offb++]);
 		if (l > stride || l > (len - offb) / 2) {
 			dbg("wrong data length %#x in response", l);
 			ret = -EIO;
@@ -469,7 +469,7 @@
 		buf[offb++] = l;
 		buf[offb++] = code1;
 		buf[offb++] = code2;
-		*((u32 *) (buf + offb)) = cpu_to_le32(addr);
+		*((__le32 *) (buf + offb)) = cpu_to_le32(addr);
 		offb += 4;
 		addr += l;
 		if(l)
@@ -506,8 +506,8 @@
 	int off;
 	struct usbatm_data *usbatm = instance->usbatm;
 	struct usb_device *usb_dev = usbatm->usb_dev;
-	u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct };
-	u32 val;
+	__le16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct };
+	__le32 val;
 
 	dbg("cxacru_upload_firmware");
 
@@ -587,7 +587,7 @@
 	/* Load config data (le32), doing one packet at a time */
 	if (cf)
 		for (off = 0; off < cf->size / 4; ) {
-			u32 buf[CMD_PACKET_SIZE / 4 - 1];
+			__le32 buf[CMD_PACKET_SIZE / 4 - 1];
 			int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1);
 			buf[0] = cpu_to_le32(len);
 			for (i = 0; i < len; i++, off++) {




More information about the Usbatm-commits mailing list