summaryrefslogtreecommitdiffstats
path: root/drivers/w1/w1_io.c
diff options
context:
space:
mode:
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>2008-12-23 13:57:12 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-23 15:58:21 -0800
commitf00a189257836e5237ace3265f6991ef66a16c86 (patch)
tree36578b6efa3dafa6487a513fb7b6b00071a1bb62 /drivers/w1/w1_io.c
parentcc6c2ca30074a0274c05dd3212c741a550f0d3c2 (diff)
downloadop-kernel-dev-f00a189257836e5237ace3265f6991ef66a16c86.zip
op-kernel-dev-f00a189257836e5237ace3265f6991ef66a16c86.tar.gz
w1: fix slave selection on big-endian systems
During test of the w1-gpio driver i found that in "w1.c:679 w1_slave_found()" the device id is converted to little-endian with "cpu_to_le64()", but its not converted back to cpu format in "w1_io.c:293 w1_reset_select_slave()". Based on a patch created by Andreas Hummel. [akpm@linux-foundation.org: remove unneeded cast] Reported-by: Andreas Hummel <andi_hummel@gmx.de> Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/w1/w1_io.c')
-rw-r--r--drivers/w1/w1_io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
index 0d15b0e..5139c25 100644
--- a/drivers/w1/w1_io.c
+++ b/drivers/w1/w1_io.c
@@ -356,7 +356,9 @@ int w1_reset_select_slave(struct w1_slave *sl)
w1_write_8(sl->master, W1_SKIP_ROM);
else {
u8 match[9] = {W1_MATCH_ROM, };
- memcpy(&match[1], (u8 *)&sl->reg_num, 8);
+ u64 rn = le64_to_cpu(*((u64*)&sl->reg_num));
+
+ memcpy(&match[1], &rn, 8);
w1_write_block(sl->master, match, 9);
}
return 0;
OpenPOWER on IntegriCloud