[W1] Fix slave addition on big-endian platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
 In the 2.6.12 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. The following patch fixes the
problem for me.

Signed-off-by: Roger Blofeld <[email protected]>

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -493,6 +493,7 @@ void w1_slave_found(unsigned long data, 
        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) {
@@ -522,10 +523,8 @@ void w1_slave_found(unsigned long data, 
                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);
        }
                        



		
__________________________________ 
Yahoo! Mail 
Stay connected, organized, and protected. Take the tour: 
http://tour.mail.yahoo.com/mailtour.html 

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux