diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-04-29 04:03:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:06:28 -0400 |
commit | a5abdeafedf722b0f3f357f4a23089a686b1b80d (patch) | |
tree | 06dc1712a552ddd190c4e1a323e9e069a4d5e059 /drivers/usb/gadget | |
parent | 6b1e6f637469647f435f8f8ab00fbafa3c129712 (diff) |
usb: use get/put_unaligned_* helpers
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/goku_udc.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/rndis.c | 40 | ||||
-rw-r--r-- | drivers/usb/gadget/usbstring.c | 2 |
3 files changed, 17 insertions, 27 deletions
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index 64a592cbbe7b..be6613afedbf 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -127,7 +127,7 @@ goku_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) | |||
127 | 127 | ||
128 | /* enabling the no-toggle interrupt mode would need an api hook */ | 128 | /* enabling the no-toggle interrupt mode would need an api hook */ |
129 | mode = 0; | 129 | mode = 0; |
130 | max = le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)); | 130 | max = get_unaligned_le16(&desc->wMaxPacketSize); |
131 | switch (max) { | 131 | switch (max) { |
132 | case 64: mode++; | 132 | case 64: mode++; |
133 | case 32: mode++; | 133 | case 32: mode++; |
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index bd58dd504f6f..d0677f5d3cd5 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -183,14 +183,10 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
183 | DBG("query OID %08x value, len %d:\n", OID, buf_len); | 183 | DBG("query OID %08x value, len %d:\n", OID, buf_len); |
184 | for (i = 0; i < buf_len; i += 16) { | 184 | for (i = 0; i < buf_len; i += 16) { |
185 | DBG("%03d: %08x %08x %08x %08x\n", i, | 185 | DBG("%03d: %08x %08x %08x %08x\n", i, |
186 | le32_to_cpu(get_unaligned((__le32 *) | 186 | get_unaligned_le32(&buf[i]), |
187 | &buf[i])), | 187 | get_unaligned_le32(&buf[i + 4]), |
188 | le32_to_cpu(get_unaligned((__le32 *) | 188 | get_unaligned_le32(&buf[i + 8]), |
189 | &buf[i + 4])), | 189 | get_unaligned_le32(&buf[i + 12])); |
190 | le32_to_cpu(get_unaligned((__le32 *) | ||
191 | &buf[i + 8])), | ||
192 | le32_to_cpu(get_unaligned((__le32 *) | ||
193 | &buf[i + 12]))); | ||
194 | } | 190 | } |
195 | } | 191 | } |
196 | 192 | ||
@@ -666,7 +662,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
666 | break; | 662 | break; |
667 | case OID_PNP_QUERY_POWER: | 663 | case OID_PNP_QUERY_POWER: |
668 | DBG("%s: OID_PNP_QUERY_POWER D%d\n", __func__, | 664 | DBG("%s: OID_PNP_QUERY_POWER D%d\n", __func__, |
669 | le32_to_cpu(get_unaligned((__le32 *)buf)) - 1); | 665 | get_unaligned_le32(buf) - 1); |
670 | /* only suspend is a real power state, and | 666 | /* only suspend is a real power state, and |
671 | * it can't be entered by OID_PNP_SET_POWER... | 667 | * it can't be entered by OID_PNP_SET_POWER... |
672 | */ | 668 | */ |
@@ -705,14 +701,10 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, | |||
705 | DBG("set OID %08x value, len %d:\n", OID, buf_len); | 701 | DBG("set OID %08x value, len %d:\n", OID, buf_len); |
706 | for (i = 0; i < buf_len; i += 16) { | 702 | for (i = 0; i < buf_len; i += 16) { |
707 | DBG("%03d: %08x %08x %08x %08x\n", i, | 703 | DBG("%03d: %08x %08x %08x %08x\n", i, |
708 | le32_to_cpu(get_unaligned((__le32 *) | 704 | get_unaligned_le32(&buf[i]), |
709 | &buf[i])), | 705 | get_unaligned_le32(&buf[i + 4]), |
710 | le32_to_cpu(get_unaligned((__le32 *) | 706 | get_unaligned_le32(&buf[i + 8]), |
711 | &buf[i + 4])), | 707 | get_unaligned_le32(&buf[i + 12])); |
712 | le32_to_cpu(get_unaligned((__le32 *) | ||
713 | &buf[i + 8])), | ||
714 | le32_to_cpu(get_unaligned((__le32 *) | ||
715 | &buf[i + 12]))); | ||
716 | } | 708 | } |
717 | } | 709 | } |
718 | 710 | ||
@@ -726,8 +718,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len, | |||
726 | * PROMISCUOUS, DIRECTED, | 718 | * PROMISCUOUS, DIRECTED, |
727 | * MULTICAST, ALL_MULTICAST, BROADCAST | 719 | * MULTICAST, ALL_MULTICAST, BROADCAST |
728 | */ | 720 | */ |
729 | *params->filter = (u16) le32_to_cpu(get_unaligned( | 721 | *params->filter = (u16)get_unaligned_le32(buf); |
730 | (__le32 *)buf)); | ||
731 | DBG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", | 722 | DBG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", |
732 | __func__, *params->filter); | 723 | __func__, *params->filter); |
733 | 724 | ||
@@ -777,7 +768,7 @@ update_linkstate: | |||
777 | * resuming, Windows forces a reset, and then SET_POWER D0. | 768 | * resuming, Windows forces a reset, and then SET_POWER D0. |
778 | * FIXME ... then things go batty; Windows wedges itself. | 769 | * FIXME ... then things go batty; Windows wedges itself. |
779 | */ | 770 | */ |
780 | i = le32_to_cpu(get_unaligned((__le32 *)buf)); | 771 | i = get_unaligned_le32(buf); |
781 | DBG("%s: OID_PNP_SET_POWER D%d\n", __func__, i - 1); | 772 | DBG("%s: OID_PNP_SET_POWER D%d\n", __func__, i - 1); |
782 | switch (i) { | 773 | switch (i) { |
783 | case NdisDeviceStateD0: | 774 | case NdisDeviceStateD0: |
@@ -1064,8 +1055,8 @@ int rndis_msg_parser (u8 configNr, u8 *buf) | |||
1064 | return -ENOMEM; | 1055 | return -ENOMEM; |
1065 | 1056 | ||
1066 | tmp = (__le32 *) buf; | 1057 | tmp = (__le32 *) buf; |
1067 | MsgType = le32_to_cpu(get_unaligned(tmp++)); | 1058 | MsgType = get_unaligned_le32(tmp++); |
1068 | MsgLength = le32_to_cpu(get_unaligned(tmp++)); | 1059 | MsgLength = get_unaligned_le32(tmp++); |
1069 | 1060 | ||
1070 | if (configNr >= RNDIS_MAX_CONFIGS) | 1061 | if (configNr >= RNDIS_MAX_CONFIGS) |
1071 | return -ENOTSUPP; | 1062 | return -ENOTSUPP; |
@@ -1296,10 +1287,9 @@ int rndis_rm_hdr(struct sk_buff *skb) | |||
1296 | tmp++; | 1287 | tmp++; |
1297 | 1288 | ||
1298 | /* DataOffset, DataLength */ | 1289 | /* DataOffset, DataLength */ |
1299 | if (!skb_pull(skb, le32_to_cpu(get_unaligned(tmp++)) | 1290 | if (!skb_pull(skb, get_unaligned_le32(tmp++) + 8)) |
1300 | + 8 /* offset of DataOffset */)) | ||
1301 | return -EOVERFLOW; | 1291 | return -EOVERFLOW; |
1302 | skb_trim(skb, le32_to_cpu(get_unaligned(tmp++))); | 1292 | skb_trim(skb, get_unaligned_le32(tmp++)); |
1303 | 1293 | ||
1304 | return 0; | 1294 | return 0; |
1305 | } | 1295 | } |
diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c index 878e428a0ec1..4154be375c7a 100644 --- a/drivers/usb/gadget/usbstring.c +++ b/drivers/usb/gadget/usbstring.c | |||
@@ -74,7 +74,7 @@ static int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len) | |||
74 | goto fail; | 74 | goto fail; |
75 | } else | 75 | } else |
76 | uchar = c; | 76 | uchar = c; |
77 | put_unaligned (cpu_to_le16 (uchar), cp++); | 77 | put_unaligned_le16(uchar, cp++); |
78 | count++; | 78 | count++; |
79 | len--; | 79 | len--; |
80 | } | 80 | } |