aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>2005-06-30 14:52:38 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-07-11 17:10:37 -0400
commit0e65f82814e9828d3ff54988de9e7c0b36794daa (patch)
treea4d5dfb9ab550160a453c6266fe67d18ace76857
parent80efa8c72006a1c04004f8fb07b22073348e4bf2 (diff)
[PATCH] w1: fix CRC calculation on bigendian platforms.
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>
-rw-r--r--drivers/w1/w1.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 312cf3220f12..8a9c42822502 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -516,6 +516,7 @@ static void w1_slave_found(unsigned long data, u64 rn)
516 struct w1_reg_num *tmp; 516 struct w1_reg_num *tmp;
517 int family_found = 0; 517 int family_found = 0;
518 struct w1_master *dev; 518 struct w1_master *dev;
519 u64 rn_le = cpu_to_le64(rn);
519 520
520 dev = w1_search_master(data); 521 dev = w1_search_master(data);
521 if (!dev) { 522 if (!dev) {
@@ -544,10 +545,8 @@ static void w1_slave_found(unsigned long data, u64 rn)
544 slave_count++; 545 slave_count++;
545 } 546 }
546 547
547 rn = cpu_to_le64(rn);
548
549 if (slave_count == dev->slave_count && 548 if (slave_count == dev->slave_count &&
550 rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) { 549 rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn_le, 7)) {
551 w1_attach_slave_device(dev, tmp); 550 w1_attach_slave_device(dev, tmp);
552 } 551 }
553 552