]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
p54: fix lm87 checksum endianness
authorJohannes Berg <johannes@sipsolutions.net>
Sat, 24 Jan 2009 09:44:26 +0000 (10:44 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 6 Feb 2009 21:47:20 +0000 (13:47 -0800)
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@sipsolutions.net>
Acked-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/p54/p54usb.c

index 8a2e32d087a5c8949238a8ff0069fa132be62579..b5963ebb67181e3e01b5a3535b447000316b396c 100644 (file)
@@ -222,13 +222,13 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct p54_control_hdr *data,
        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 ieee80211_hw *dev,
        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,