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: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
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;
length >>= 2;
while (length--) {
- chk ^= *data++;
+ chk ^= le32_to_cpu(*data++);
chk = (chk >> 5) ^ (chk << 3);
}
if (!data_urb)
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->chksum = checksum;
hdr->device_addr = addr;