]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] w1: fix CRC calculation on bigendian platforms.
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>
Thu, 30 Jun 2005 18:52:38 +0000 (22:52 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 11 Jul 2005 21:10:37 +0000 (14:10 -0700)
In the 2.6.13-rc1 code the "rn" structure is in the wrong-endianness
when passed to w1_attach_slave_device(). This causes problems like the
family and crc being swapped around.

Signed-off-by: Roger Blofeld <blofeldus@yahoo.com>
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/w1/w1.c

index 312cf3220f12dfa9f81f1515cb793efa3fa7db32..8a9c4282250225c7a431ea62b3c5e87c98777f30 100644 (file)
@@ -516,6 +516,7 @@ static void w1_slave_found(unsigned long data, u64 rn)
        struct w1_reg_num *tmp;
        int family_found = 0;
        struct w1_master *dev;
+       u64 rn_le = cpu_to_le64(rn);
 
        dev = w1_search_master(data);
        if (!dev) {
@@ -544,10 +545,8 @@ static void w1_slave_found(unsigned long data, u64 rn)
                slave_count++;
        }
 
-       rn = cpu_to_le64(rn);
-
        if (slave_count == dev->slave_count &&
-               rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) {
+               rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn_le, 7)) {
                w1_attach_slave_device(dev, tmp);
        }