diff options
Diffstat (limited to 'drivers/usb/gadget/rndis.c')
-rw-r--r-- | drivers/usb/gadget/rndis.c | 40 |
1 files changed, 15 insertions, 25 deletions
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 | } |