[patch 21/33] p54: fix lm87 checksum endianness

From: Greg KH
Date: Wed Feb 04 2009 - 13:44:53 EST



2.6.28-stable review patch. If anyone has any objections, please let us know.

------------------

From: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>

commit c91276592695e13d1b52eab572551017cbf96ee7 upstream

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@xxxxxxxxxxxxxxxx>
Acked-by: Christian Lamparter <chunkeey@xxxxxx>
Signed-off-by: John W. Linville <linville@xxxxxxxxxxxxx>

---
drivers/net/wireless/p54/p54usb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -222,13 +222,13 @@ static void p54u_tx_3887(struct ieee8021
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);
}

@@ -247,7 +247,7 @@ static void p54u_tx_lm87(struct ieee8021
if (!data_urb)
return;

- hdr->chksum = p54u_lm87_chksum((u32 *)data, len);
+ hdr->chksum = p54u_lm87_chksum((__le32 *) data, len);
hdr->device_addr = data->req_id;

usb_fill_bulk_urb(data_urb, priv->udev,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/