aboutsummaryrefslogtreecommitdiff
path: root/drivers/w1
diff options
context:
space:
mode:
authorjohnpol@2ka.mipt.ru <johnpol@2ka.mipt.ru>2005-04-18 21:16:57 -0700
committerGreg KH <greg@press.kroah.org>2005-04-18 21:16:57 -0700
commit8523ff45672a5c9209ab7459142e37e7cd393e6c (patch)
tree29b32fbb32911f3aecf347675b7283b6269e7fda /drivers/w1
parentc0698f2f6e4839ce9463ce731c892993215ea067 (diff)
[PATCH] w1: real fix for big endian machines.
Real fix for big endian machines - crc must be calculated using little endian byte order. Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/w1.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index fd630cec0e7..8d7821899cc 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -522,10 +522,11 @@ void w1_slave_found(unsigned long data, u64 rn)
slave_count++;
}
- if (slave_count == dev->slave_count && rn ) {
- tmp = cpu_to_le64(rn);
- if(((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&tmp, 7))
- w1_attach_slave_device(dev, (struct w1_reg_num *) &rn);
+ rn = cpu_to_le64(rn);
+
+ if (slave_count == dev->slave_count &&
+ rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) {
+ w1_attach_slave_device(dev, tmp);
}
atomic_dec(&dev->refcnt);