aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2008-04-28 02:00:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 13:03:31 -0400
commitfd05e720099e8eeddb378305d1a41c1445344b91 (patch)
treed617918be290b47b35822bc3cf21c8f01dde5dd2 /drivers/usb
parent01d7b369887b6feb7c9ce2b20988fafe3f70841c (diff)
drivers/usb annotations and fixes
* endianness annotations * endianness fixes * missing get_unaligned/put_unaligned It's pretty much all over the place, changes to different files are independent. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Serial-parts-Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/atm/cxacru.c12
-rw-r--r--drivers/usb/atm/ueagle-atm.c6
-rw-r--r--drivers/usb/gadget/amd5536udc.c20
-rw-r--r--drivers/usb/gadget/dummy_hcd.c3
-rw-r--r--drivers/usb/gadget/gmidi.c6
-rw-r--r--drivers/usb/gadget/m66592-udc.h2
-rw-r--r--drivers/usb/host/ehci-dbg.c2
-rw-r--r--drivers/usb/host/ehci-hub.c2
-rw-r--r--drivers/usb/host/ehci-q.c4
-rw-r--r--drivers/usb/host/r8a66597-hcd.c6
-rw-r--r--drivers/usb/host/sl811-hcd.c2
-rw-r--r--drivers/usb/serial/aircable.c4
-rw-r--r--drivers/usb/serial/cypress_m8.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/io_edgeport.c2
-rw-r--r--drivers/usb/serial/kl5kusb105.c3
-rw-r--r--drivers/usb/serial/oti6858.c13
-rw-r--r--drivers/usb/serial/spcp8x5.c13
18 files changed, 55 insertions, 49 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index d470c72b737e..5ea3093bc40f 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -38,6 +38,7 @@
38#include <linux/device.h> 38#include <linux/device.h>
39#include <linux/firmware.h> 39#include <linux/firmware.h>
40#include <linux/mutex.h> 40#include <linux/mutex.h>
41#include <asm/unaligned.h>
41 42
42#include "usbatm.h" 43#include "usbatm.h"
43 44
@@ -573,7 +574,7 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ
573 u32 *data, int size) 574 u32 *data, int size)
574{ 575{
575 int ret, len; 576 int ret, len;
576 u32 *buf; 577 __le32 *buf;
577 int offb, offd; 578 int offb, offd;
578 const int stride = CMD_PACKET_SIZE / (4 * 2) - 1; 579 const int stride = CMD_PACKET_SIZE / (4 * 2) - 1;
579 int buflen = ((size - 1) / stride + 1 + size * 2) * 4; 580 int buflen = ((size - 1) / stride + 1 + size * 2) * 4;
@@ -837,7 +838,7 @@ static int cxacru_fw(struct usb_device *usb_dev, enum cxacru_fw_request fw,
837 buf[offb++] = l; 838 buf[offb++] = l;
838 buf[offb++] = code1; 839 buf[offb++] = code1;
839 buf[offb++] = code2; 840 buf[offb++] = code2;
840 *((u32 *) (buf + offb)) = cpu_to_le32(addr); 841 put_unaligned(cpu_to_le32(addr), (__le32 *)(buf + offb));
841 offb += 4; 842 offb += 4;
842 addr += l; 843 addr += l;
843 if(l) 844 if(l)
@@ -874,8 +875,9 @@ static void cxacru_upload_firmware(struct cxacru_data *instance,
874 int off; 875 int off;
875 struct usbatm_data *usbatm = instance->usbatm; 876 struct usbatm_data *usbatm = instance->usbatm;
876 struct usb_device *usb_dev = usbatm->usb_dev; 877 struct usb_device *usb_dev = usbatm->usb_dev;
877 u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct }; 878 __le16 signature[] = { usb_dev->descriptor.idVendor,
878 u32 val; 879 usb_dev->descriptor.idProduct };
880 __le32 val;
879 881
880 dbg("cxacru_upload_firmware"); 882 dbg("cxacru_upload_firmware");
881 883
@@ -955,7 +957,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance,
955 /* Load config data (le32), doing one packet at a time */ 957 /* Load config data (le32), doing one packet at a time */
956 if (cf) 958 if (cf)
957 for (off = 0; off < cf->size / 4; ) { 959 for (off = 0; off < cf->size / 4; ) {
958 u32 buf[CMD_PACKET_SIZE / 4 - 1]; 960 __le32 buf[CMD_PACKET_SIZE / 4 - 1];
959 int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1); 961 int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1);
960 buf[0] = cpu_to_le32(len); 962 buf[0] = cpu_to_le32(len);
961 for (i = 0; i < len; i++, off++) { 963 for (i = 0; i < len; i++, off++) {
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index abb7d7410e63..4220f22b6660 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -996,7 +996,7 @@ static void __uea_load_page_e4(struct uea_softc *sc, u8 pageno, int boot)
996 blockoffset = sc->dsp_firm->data + le32_to_cpu(blockidx->PageOffset); 996 blockoffset = sc->dsp_firm->data + le32_to_cpu(blockidx->PageOffset);
997 997
998 bi.dwSize = cpu_to_be32(blocksize); 998 bi.dwSize = cpu_to_be32(blocksize);
999 bi.dwAddress = swab32(blockidx->PageAddress); 999 bi.dwAddress = cpu_to_be32(le32_to_cpu(blockidx->PageAddress));
1000 1000
1001 uea_dbg(INS_TO_USBDEV(sc), 1001 uea_dbg(INS_TO_USBDEV(sc),
1002 "sending block %u for DSP page %u size %u address %x\n", 1002 "sending block %u for DSP page %u size %u address %x\n",
@@ -1040,7 +1040,7 @@ static void uea_load_page_e4(struct work_struct *work)
1040 return; 1040 return;
1041 1041
1042 p = (struct l1_code *) sc->dsp_firm->data; 1042 p = (struct l1_code *) sc->dsp_firm->data;
1043 if (pageno >= p->page_header[0].PageNumber) { 1043 if (pageno >= le16_to_cpu(p->page_header[0].PageNumber)) {
1044 uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n", pageno); 1044 uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n", pageno);
1045 return; 1045 return;
1046 } 1046 }
@@ -1065,7 +1065,7 @@ static void uea_load_page_e4(struct work_struct *work)
1065 bi.bPageNumber = 0xff; 1065 bi.bPageNumber = 0xff;
1066 bi.wReserved = cpu_to_be16(UEA_RESERVED); 1066 bi.wReserved = cpu_to_be16(UEA_RESERVED);
1067 bi.dwSize = cpu_to_be32(E4_PAGE_BYTES(p->page_header[0].PageSize)); 1067 bi.dwSize = cpu_to_be32(E4_PAGE_BYTES(p->page_header[0].PageSize));
1068 bi.dwAddress = swab32(p->page_header[0].PageAddress); 1068 bi.dwAddress = cpu_to_be32(le32_to_cpu(p->page_header[0].PageAddress));
1069 1069
1070 /* send block info through the IDMA pipe */ 1070 /* send block info through the IDMA pipe */
1071 if (uea_idma_write(sc, &bi, E4_BLOCK_INFO_SIZE)) 1071 if (uea_idma_write(sc, &bi, E4_BLOCK_INFO_SIZE))
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index fc6f3483be44..ce337cb5d137 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -328,6 +328,7 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc)
328 u32 tmp; 328 u32 tmp;
329 unsigned long iflags; 329 unsigned long iflags;
330 u8 udc_csr_epix; 330 u8 udc_csr_epix;
331 unsigned maxpacket;
331 332
332 if (!usbep 333 if (!usbep
333 || usbep->name == ep0_string 334 || usbep->name == ep0_string
@@ -354,9 +355,10 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc)
354 writel(tmp, &dev->ep[ep->num].regs->ctl); 355 writel(tmp, &dev->ep[ep->num].regs->ctl);
355 356
356 /* set max packet size */ 357 /* set max packet size */
358 maxpacket = le16_to_cpu(desc->wMaxPacketSize);
357 tmp = readl(&dev->ep[ep->num].regs->bufout_maxpkt); 359 tmp = readl(&dev->ep[ep->num].regs->bufout_maxpkt);
358 tmp = AMD_ADDBITS(tmp, desc->wMaxPacketSize, UDC_EP_MAX_PKT_SIZE); 360 tmp = AMD_ADDBITS(tmp, maxpacket, UDC_EP_MAX_PKT_SIZE);
359 ep->ep.maxpacket = desc->wMaxPacketSize; 361 ep->ep.maxpacket = maxpacket;
360 writel(tmp, &dev->ep[ep->num].regs->bufout_maxpkt); 362 writel(tmp, &dev->ep[ep->num].regs->bufout_maxpkt);
361 363
362 /* IN ep */ 364 /* IN ep */
@@ -370,8 +372,8 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc)
370 /* double buffering: fifo size = 2 x max packet size */ 372 /* double buffering: fifo size = 2 x max packet size */
371 tmp = AMD_ADDBITS( 373 tmp = AMD_ADDBITS(
372 tmp, 374 tmp,
373 desc->wMaxPacketSize * UDC_EPIN_BUFF_SIZE_MULT 375 maxpacket * UDC_EPIN_BUFF_SIZE_MULT
374 / UDC_DWORD_BYTES, 376 / UDC_DWORD_BYTES,
375 UDC_EPIN_BUFF_SIZE); 377 UDC_EPIN_BUFF_SIZE);
376 writel(tmp, &dev->ep[ep->num].regs->bufin_framenum); 378 writel(tmp, &dev->ep[ep->num].regs->bufin_framenum);
377 379
@@ -390,7 +392,7 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc)
390 392
391 /* set max packet size UDC CSR */ 393 /* set max packet size UDC CSR */
392 tmp = readl(&dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); 394 tmp = readl(&dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]);
393 tmp = AMD_ADDBITS(tmp, desc->wMaxPacketSize, 395 tmp = AMD_ADDBITS(tmp, maxpacket,
394 UDC_CSR_NE_MAX_PKT); 396 UDC_CSR_NE_MAX_PKT);
395 writel(tmp, &dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]); 397 writel(tmp, &dev->csr->ne[ep->num - UDC_CSR_EP_OUT_IX_OFS]);
396 398
@@ -407,7 +409,7 @@ udc_ep_enable(struct usb_ep *usbep, const struct usb_endpoint_descriptor *desc)
407 /* set ep values */ 409 /* set ep values */
408 tmp = readl(&dev->csr->ne[udc_csr_epix]); 410 tmp = readl(&dev->csr->ne[udc_csr_epix]);
409 /* max packet */ 411 /* max packet */
410 tmp = AMD_ADDBITS(tmp, desc->wMaxPacketSize, UDC_CSR_NE_MAX_PKT); 412 tmp = AMD_ADDBITS(tmp, maxpacket, UDC_CSR_NE_MAX_PKT);
411 /* ep number */ 413 /* ep number */
412 tmp = AMD_ADDBITS(tmp, desc->bEndpointAddress, UDC_CSR_NE_NUM); 414 tmp = AMD_ADDBITS(tmp, desc->bEndpointAddress, UDC_CSR_NE_NUM);
413 /* ep direction */ 415 /* ep direction */
@@ -2832,7 +2834,7 @@ __acquires(dev->lock)
2832 /* make usb request for gadget driver */ 2834 /* make usb request for gadget driver */
2833 memset(&setup_data, 0 , sizeof(union udc_setup_data)); 2835 memset(&setup_data, 0 , sizeof(union udc_setup_data));
2834 setup_data.request.bRequest = USB_REQ_SET_CONFIGURATION; 2836 setup_data.request.bRequest = USB_REQ_SET_CONFIGURATION;
2835 setup_data.request.wValue = dev->cur_config; 2837 setup_data.request.wValue = cpu_to_le16(dev->cur_config);
2836 2838
2837 /* programm the NE registers */ 2839 /* programm the NE registers */
2838 for (i = 0; i < UDC_EP_NUM; i++) { 2840 for (i = 0; i < UDC_EP_NUM; i++) {
@@ -2881,8 +2883,8 @@ __acquires(dev->lock)
2881 memset(&setup_data, 0 , sizeof(union udc_setup_data)); 2883 memset(&setup_data, 0 , sizeof(union udc_setup_data));
2882 setup_data.request.bRequest = USB_REQ_SET_INTERFACE; 2884 setup_data.request.bRequest = USB_REQ_SET_INTERFACE;
2883 setup_data.request.bRequestType = USB_RECIP_INTERFACE; 2885 setup_data.request.bRequestType = USB_RECIP_INTERFACE;
2884 setup_data.request.wValue = dev->cur_alt; 2886 setup_data.request.wValue = cpu_to_le16(dev->cur_alt);
2885 setup_data.request.wIndex = dev->cur_intf; 2887 setup_data.request.wIndex = cpu_to_le16(dev->cur_intf);
2886 2888
2887 DBG(dev, "SET_INTERFACE interrupt: alt=%d intf=%d\n", 2889 DBG(dev, "SET_INTERFACE interrupt: alt=%d intf=%d\n",
2888 dev->cur_alt, dev->cur_intf); 2890 dev->cur_alt, dev->cur_intf);
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 66293105d136..42036192a03c 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1555,8 +1555,7 @@ hub_descriptor (struct usb_hub_descriptor *desc)
1555 memset (desc, 0, sizeof *desc); 1555 memset (desc, 0, sizeof *desc);
1556 desc->bDescriptorType = 0x29; 1556 desc->bDescriptorType = 0x29;
1557 desc->bDescLength = 9; 1557 desc->bDescLength = 9;
1558 desc->wHubCharacteristics = (__force __u16) 1558 desc->wHubCharacteristics = cpu_to_le16(0x0001);
1559 (__constant_cpu_to_le16 (0x0001));
1560 desc->bNbrPorts = 1; 1559 desc->bNbrPorts = 1;
1561 desc->bitmap [0] = 0xff; 1560 desc->bitmap [0] = 0xff;
1562 desc->bitmap [1] = 0xff; 1561 desc->bitmap [1] = 0xff;
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index ff3a8513e64d..7f4d4828e3aa 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -229,7 +229,7 @@ static const struct usb_ac_header_descriptor_1 ac_header_desc = {
229 .bDescriptorType = USB_DT_CS_INTERFACE, 229 .bDescriptorType = USB_DT_CS_INTERFACE,
230 .bDescriptorSubtype = USB_MS_HEADER, 230 .bDescriptorSubtype = USB_MS_HEADER,
231 .bcdADC = __constant_cpu_to_le16(0x0100), 231 .bcdADC = __constant_cpu_to_le16(0x0100),
232 .wTotalLength = USB_DT_AC_HEADER_SIZE(1), 232 .wTotalLength = __constant_cpu_to_le16(USB_DT_AC_HEADER_SIZE(1)),
233 .bInCollection = 1, 233 .bInCollection = 1,
234 .baInterfaceNr = { 234 .baInterfaceNr = {
235 [0] = GMIDI_MS_INTERFACE, 235 [0] = GMIDI_MS_INTERFACE,
@@ -253,9 +253,9 @@ static const struct usb_ms_header_descriptor ms_header_desc = {
253 .bDescriptorType = USB_DT_CS_INTERFACE, 253 .bDescriptorType = USB_DT_CS_INTERFACE,
254 .bDescriptorSubtype = USB_MS_HEADER, 254 .bDescriptorSubtype = USB_MS_HEADER,
255 .bcdMSC = __constant_cpu_to_le16(0x0100), 255 .bcdMSC = __constant_cpu_to_le16(0x0100),
256 .wTotalLength = USB_DT_MS_HEADER_SIZE 256 .wTotalLength = __constant_cpu_to_le16(USB_DT_MS_HEADER_SIZE
257 + 2*USB_DT_MIDI_IN_SIZE 257 + 2*USB_DT_MIDI_IN_SIZE
258 + 2*USB_DT_MIDI_OUT_SIZE(1), 258 + 2*USB_DT_MIDI_OUT_SIZE(1)),
259}; 259};
260 260
261#define JACK_IN_EMB 1 261#define JACK_IN_EMB 1
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h
index be0a4c1f80a2..f118f00f1466 100644
--- a/drivers/usb/gadget/m66592-udc.h
+++ b/drivers/usb/gadget/m66592-udc.h
@@ -485,7 +485,7 @@ struct m66592 {
485 struct m66592_ep *epaddr2ep[16]; 485 struct m66592_ep *epaddr2ep[16];
486 486
487 struct usb_request *ep0_req; /* for internal request */ 487 struct usb_request *ep0_req; /* for internal request */
488 u16 ep0_data; /* for internal request */ 488 __le16 ep0_data; /* for internal request */
489 u16 old_vbus; 489 u16 old_vbus;
490 490
491 struct timer_list timer; 491 struct timer_list timer;
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 4af90df8e7de..0f82fdcaef09 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -398,7 +398,7 @@ static void qh_lines (
398 unsigned size = *sizep; 398 unsigned size = *sizep;
399 char *next = *nextp; 399 char *next = *nextp;
400 char mark; 400 char mark;
401 u32 list_end = EHCI_LIST_END(ehci); 401 __le32 list_end = EHCI_LIST_END(ehci);
402 402
403 if (qh->hw_qtd_next == list_end) /* NEC does this */ 403 if (qh->hw_qtd_next == list_end) /* NEC does this */
404 mark = '@'; 404 mark = '@';
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index efffef64f59d..f13d1029aeb2 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -530,7 +530,7 @@ ehci_hub_descriptor (
530 if (HCS_INDICATOR (ehci->hcs_params)) 530 if (HCS_INDICATOR (ehci->hcs_params))
531 temp |= 0x0080; /* per-port indicators (LEDs) */ 531 temp |= 0x0080; /* per-port indicators (LEDs) */
532#endif 532#endif
533 desc->wHubCharacteristics = (__force __u16)cpu_to_le16 (temp); 533 desc->wHubCharacteristics = cpu_to_le16(temp);
534} 534}
535 535
536/*-------------------------------------------------------------------------*/ 536/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 5ae689139dd0..b85b54160cda 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -285,7 +285,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
285 int stopped; 285 int stopped;
286 unsigned count = 0; 286 unsigned count = 0;
287 u8 state; 287 u8 state;
288 u32 halt = HALT_BIT(ehci); 288 __le32 halt = HALT_BIT(ehci);
289 289
290 if (unlikely (list_empty (&qh->qtd_list))) 290 if (unlikely (list_empty (&qh->qtd_list)))
291 return count; 291 return count;
@@ -883,7 +883,7 @@ static struct ehci_qh *qh_append_tds (
883) 883)
884{ 884{
885 struct ehci_qh *qh = NULL; 885 struct ehci_qh *qh = NULL;
886 u32 qh_addr_mask = cpu_to_hc32(ehci, 0x7f); 886 __hc32 qh_addr_mask = cpu_to_hc32(ehci, 0x7f);
887 887
888 qh = (struct ehci_qh *) *ptr; 888 qh = (struct ehci_qh *) *ptr;
889 if (unlikely (qh == NULL)) { 889 if (unlikely (qh == NULL)) {
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index f4fa93dabdde..16667342b3c3 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -993,7 +993,7 @@ static void prepare_setup_packet(struct r8a66597 *r8a66597,
993 struct r8a66597_td *td) 993 struct r8a66597_td *td)
994{ 994{
995 int i; 995 int i;
996 u16 *p = (u16 *)td->urb->setup_packet; 996 __le16 *p = (__le16 *)td->urb->setup_packet;
997 unsigned long setup_addr = USBREQ; 997 unsigned long setup_addr = USBREQ;
998 998
999 r8a66597_write(r8a66597, make_devsel(td->address) | td->maxpacket, 999 r8a66597_write(r8a66597, make_devsel(td->address) | td->maxpacket,
@@ -1001,7 +1001,7 @@ static void prepare_setup_packet(struct r8a66597 *r8a66597,
1001 r8a66597_write(r8a66597, ~(SIGN | SACK), INTSTS1); 1001 r8a66597_write(r8a66597, ~(SIGN | SACK), INTSTS1);
1002 1002
1003 for (i = 0; i < 4; i++) { 1003 for (i = 0; i < 4; i++) {
1004 r8a66597_write(r8a66597, cpu_to_le16(p[i]), setup_addr); 1004 r8a66597_write(r8a66597, le16_to_cpu(p[i]), setup_addr);
1005 setup_addr += 2; 1005 setup_addr += 2;
1006 } 1006 }
1007 r8a66597_write(r8a66597, SUREQ, DCPCTR); 1007 r8a66597_write(r8a66597, SUREQ, DCPCTR);
@@ -2131,7 +2131,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
2131 case GetPortStatus: 2131 case GetPortStatus:
2132 if (wIndex > R8A66597_MAX_ROOT_HUB) 2132 if (wIndex > R8A66597_MAX_ROOT_HUB)
2133 goto error; 2133 goto error;
2134 *(u32 *)buf = cpu_to_le32(rh->port); 2134 *(__le32 *)buf = cpu_to_le32(rh->port);
2135 break; 2135 break;
2136 case SetPortFeature: 2136 case SetPortFeature:
2137 if (wIndex > R8A66597_MAX_ROOT_HUB) 2137 if (wIndex > R8A66597_MAX_ROOT_HUB)
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 274276cf8621..3fd7a0c12078 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1100,7 +1100,7 @@ sl811h_hub_descriptor (
1100 /* no overcurrent errors detection/handling */ 1100 /* no overcurrent errors detection/handling */
1101 temp |= 0x0010; 1101 temp |= 0x0010;
1102 1102
1103 desc->wHubCharacteristics = (__force __u16)cpu_to_le16(temp); 1103 desc->wHubCharacteristics = cpu_to_le16(temp);
1104 1104
1105 /* two bitmaps: ports removable, and legacy PortPwrCtrlMask */ 1105 /* two bitmaps: ports removable, and legacy PortPwrCtrlMask */
1106 desc->bitmap[0] = 0 << 1; 1106 desc->bitmap[0] = 0 << 1;
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index a238817762ad..9b1bb347dc2d 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -209,7 +209,7 @@ static void aircable_send(struct usb_serial_port *port)
209 int count, result; 209 int count, result;
210 struct aircable_private *priv = usb_get_serial_port_data(port); 210 struct aircable_private *priv = usb_get_serial_port_data(port);
211 unsigned char* buf; 211 unsigned char* buf;
212 u16 *dbuf; 212 __le16 *dbuf;
213 dbg("%s - port %d", __func__, port->number); 213 dbg("%s - port %d", __func__, port->number);
214 if (port->write_urb_busy) 214 if (port->write_urb_busy)
215 return; 215 return;
@@ -227,7 +227,7 @@ static void aircable_send(struct usb_serial_port *port)
227 227
228 buf[0] = TX_HEADER_0; 228 buf[0] = TX_HEADER_0;
229 buf[1] = TX_HEADER_1; 229 buf[1] = TX_HEADER_1;
230 dbuf = (u16 *)&buf[2]; 230 dbuf = (__le16 *)&buf[2];
231 *dbuf = cpu_to_le16((u16)count); 231 *dbuf = cpu_to_le16((u16)count);
232 serial_buf_get(priv->tx_buf,buf + HCI_HEADER_LENGTH, MAX_HCI_FRAMESIZE); 232 serial_buf_get(priv->tx_buf,buf + HCI_HEADER_LENGTH, MAX_HCI_FRAMESIZE);
233 233
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 32121794808d..0230d3c0888a 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -541,7 +541,7 @@ static int cypress_earthmate_startup (struct usb_serial *serial)
541 /* All Earthmate devices use the separated-count packet 541 /* All Earthmate devices use the separated-count packet
542 format! Idiotic. */ 542 format! Idiotic. */
543 priv->pkt_fmt = packet_format_1; 543 priv->pkt_fmt = packet_format_1;
544 if (serial->dev->descriptor.idProduct != PRODUCT_ID_EARTHMATEUSB) { 544 if (serial->dev->descriptor.idProduct != cpu_to_le16(PRODUCT_ID_EARTHMATEUSB)) {
545 /* The old original USB Earthmate seemed able to 545 /* The old original USB Earthmate seemed able to
546 handle GET_CONFIG requests; everything they've 546 handle GET_CONFIG requests; everything they've
547 produced since that time crashes if this command is 547 produced since that time crashes if this command is
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 23f51a41093e..c7329f43d9c9 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1104,7 +1104,7 @@ static int ftdi_mtxorb_hack_setup(struct usb_serial *serial)
1104 struct usb_endpoint_descriptor *ep_desc = &ep->desc; 1104 struct usb_endpoint_descriptor *ep_desc = &ep->desc;
1105 1105
1106 if (ep->enabled && ep_desc->wMaxPacketSize == 0) { 1106 if (ep->enabled && ep_desc->wMaxPacketSize == 0) {
1107 ep_desc->wMaxPacketSize = 0x40; 1107 ep_desc->wMaxPacketSize = cpu_to_le16(0x40);
1108 info("Fixing invalid wMaxPacketSize on read pipe"); 1108 info("Fixing invalid wMaxPacketSize on read pipe");
1109 } 1109 }
1110 1110
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index ce2e487f3240..06b52f4098f1 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2993,7 +2993,7 @@ static int edge_startup (struct usb_serial *serial)
2993 usb_fill_bulk_urb(edge_serial->read_urb, dev, 2993 usb_fill_bulk_urb(edge_serial->read_urb, dev,
2994 usb_rcvbulkpipe(dev, endpoint->bEndpointAddress), 2994 usb_rcvbulkpipe(dev, endpoint->bEndpointAddress),
2995 edge_serial->bulk_in_buffer, 2995 edge_serial->bulk_in_buffer,
2996 endpoint->wMaxPacketSize, 2996 le16_to_cpu(endpoint->wMaxPacketSize),
2997 edge_bulk_in_callback, 2997 edge_bulk_in_callback,
2998 edge_serial); 2998 edge_serial);
2999 bulk_in_found = true; 2999 bulk_in_found = true;
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index b395ac759888..f328948d74e3 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -54,6 +54,7 @@
54#include <linux/tty_flip.h> 54#include <linux/tty_flip.h>
55#include <linux/module.h> 55#include <linux/module.h>
56#include <asm/uaccess.h> 56#include <asm/uaccess.h>
57#include <asm/unaligned.h>
57#include <linux/usb.h> 58#include <linux/usb.h>
58#include <linux/usb/serial.h> 59#include <linux/usb/serial.h>
59#include "kl5kusb105.h" 60#include "kl5kusb105.h"
@@ -235,7 +236,7 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
235 if (rc < 0) 236 if (rc < 0)
236 err("Reading line status failed (error = %d)", rc); 237 err("Reading line status failed (error = %d)", rc);
237 else { 238 else {
238 status = le16_to_cpu(*(u16 *)status_buf); 239 status = le16_to_cpu(get_unaligned((__le16 *)status_buf));
239 240
240 info("%s - read status %x %x", __func__, 241 info("%s - read status %x %x", __func__,
241 status_buf[0], status_buf[1]); 242 status_buf[0], status_buf[1]);
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index d92bb6501c84..a9625c180dc3 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -98,7 +98,7 @@ struct oti6858_buf {
98 98
99/* format of the control packet */ 99/* format of the control packet */
100struct oti6858_control_pkt { 100struct oti6858_control_pkt {
101 u16 divisor; /* baud rate = 96000000 / (16 * divisor), LE */ 101 __le16 divisor; /* baud rate = 96000000 / (16 * divisor), LE */
102#define OTI6858_MAX_BAUD_RATE 3000000 102#define OTI6858_MAX_BAUD_RATE 3000000
103 u8 frame_fmt; 103 u8 frame_fmt;
104#define FMT_STOP_BITS_MASK 0xc0 104#define FMT_STOP_BITS_MASK 0xc0
@@ -211,7 +211,7 @@ struct oti6858_private {
211 struct delayed_work delayed_write_work; 211 struct delayed_work delayed_write_work;
212 212
213 struct { 213 struct {
214 u16 divisor; 214 __le16 divisor;
215 u8 frame_fmt; 215 u8 frame_fmt;
216 u8 control; 216 u8 control;
217 } pending_setup; 217 } pending_setup;
@@ -450,7 +450,7 @@ static void oti6858_set_termios(struct usb_serial_port *port,
450 unsigned long flags; 450 unsigned long flags;
451 unsigned int cflag; 451 unsigned int cflag;
452 u8 frame_fmt, control; 452 u8 frame_fmt, control;
453 u16 divisor; 453 __le16 divisor;
454 int br; 454 int br;
455 455
456 dbg("%s(port = %d)", __func__, port->number); 456 dbg("%s(port = %d)", __func__, port->number);
@@ -505,11 +505,12 @@ static void oti6858_set_termios(struct usb_serial_port *port,
505 divisor = 0; 505 divisor = 0;
506 } else { 506 } else {
507 int real_br; 507 int real_br;
508 int new_divisor;
508 br = min(br, OTI6858_MAX_BAUD_RATE); 509 br = min(br, OTI6858_MAX_BAUD_RATE);
509 510
510 divisor = (96000000 + 8 * br) / (16 * br); 511 new_divisor = (96000000 + 8 * br) / (16 * br);
511 real_br = 96000000 / (16 * divisor); 512 real_br = 96000000 / (16 * new_divisor);
512 divisor = cpu_to_le16(divisor); 513 divisor = cpu_to_le16(new_divisor);
513 tty_encode_baud_rate(port->tty, real_br, real_br); 514 tty_encode_baud_rate(port->tty, real_br, real_br);
514 } 515 }
515 516
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 2282d620186e..55b2570b8b8b 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -310,17 +310,18 @@ static int spcp8x5_startup(struct usb_serial *serial)
310 struct spcp8x5_private *priv; 310 struct spcp8x5_private *priv;
311 int i; 311 int i;
312 enum spcp8x5_type type = SPCP825_007_TYPE; 312 enum spcp8x5_type type = SPCP825_007_TYPE;
313 u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
313 314
314 if (serial->dev->descriptor.idProduct == 0x0201) 315 if (product == 0x0201)
315 type = SPCP825_007_TYPE; 316 type = SPCP825_007_TYPE;
316 else if (serial->dev->descriptor.idProduct == 0x0231) 317 else if (product == 0x0231)
317 type = SPCP835_TYPE; 318 type = SPCP835_TYPE;
318 else if (serial->dev->descriptor.idProduct == 0x0235) 319 else if (product == 0x0235)
319 type = SPCP825_008_TYPE; 320 type = SPCP825_008_TYPE;
320 else if (serial->dev->descriptor.idProduct == 0x0204) 321 else if (product == 0x0204)
321 type = SPCP825_INTERMATIC_TYPE; 322 type = SPCP825_INTERMATIC_TYPE;
322 else if (serial->dev->descriptor.idProduct == 0x0471 && 323 else if (product == 0x0471 &&
323 serial->dev->descriptor.idVendor == 0x081e) 324 serial->dev->descriptor.idVendor == cpu_to_le16(0x081e))
324 type = SPCP825_PHILIP_TYPE; 325 type = SPCP825_PHILIP_TYPE;
325 dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type); 326 dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type);
326 327