From johnpol@2ka.mipt.ru Thu Jun 30 13:25:50 2005 Date: Thu, 30 Jun 2005 22:52:38 +0400 From: Evgeniy Polyakov To: Greg Kroah-Hartman Subject: w1: fix CRC calculation on bigendian platforms. Message-ID: <20050630225238.0cb63b4b@zanzibar.2ka.mipt.ru> 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 Signed-off-by: Evgeniy Polyakov Signed-off-by: Greg Kroah-Hartman --- drivers/w1/w1.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) --- gregkh-2.6.orig/drivers/w1/w1.c 2005-06-29 07:55:20.000000000 -0700 +++ gregkh-2.6/drivers/w1/w1.c 2005-07-01 14:43:18.000000000 -0700 @@ -516,6 +516,7 @@ 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 @@ 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); }