Commit c9127659 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

p54: fix lm87 checksum endianness

This fixes the checksum calculation for lm87 firmwares
on big endian platforms, the device treats the data as
an array of 32-bit little endian values so the driver
needs to do that as well.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Acked-by: default avatarChristian Lamparter <chunkeey@web.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 0f70f398
...@@ -244,13 +244,13 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct sk_buff *skb, ...@@ -244,13 +244,13 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct sk_buff *skb,
usb_submit_urb(data_urb, GFP_ATOMIC); usb_submit_urb(data_urb, GFP_ATOMIC);
} }
static __le32 p54u_lm87_chksum(const u32 *data, size_t length) static __le32 p54u_lm87_chksum(const __le32 *data, size_t length)
{ {
u32 chk = 0; u32 chk = 0;
length >>= 2; length >>= 2;
while (length--) { while (length--) {
chk ^= *data++; chk ^= le32_to_cpu(*data++);
chk = (chk >> 5) ^ (chk << 3); chk = (chk >> 5) ^ (chk << 3);
} }
...@@ -270,7 +270,7 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb, ...@@ -270,7 +270,7 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb,
if (!data_urb) if (!data_urb)
return; return;
checksum = p54u_lm87_chksum((u32 *)skb->data, skb->len); checksum = p54u_lm87_chksum((__le32 *)skb->data, skb->len);
hdr = (struct lm87_tx_hdr *)skb_push(skb, sizeof(*hdr)); hdr = (struct lm87_tx_hdr *)skb_push(skb, sizeof(*hdr));
hdr->chksum = checksum; hdr->chksum = checksum;
hdr->device_addr = addr; hdr->device_addr = addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment