Skip to content

Commit

Permalink
[PATCH] w1: real fix for big endian machines.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
johnpol@2ka.mipt.ru authored and Greg KH committed Apr 19, 2005
1 parent c0698f2 commit 8523ff4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/w1/w1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8523ff4

Please sign in to comment.