Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Evgeniy Polyakov and committed by
Linus Torvalds
f00a1892 cc6c2ca3

+3 -1
+3 -1
drivers/w1/w1_io.c
··· 356 356 w1_write_8(sl->master, W1_SKIP_ROM); 357 357 else { 358 358 u8 match[9] = {W1_MATCH_ROM, }; 359 - memcpy(&match[1], (u8 *)&sl->reg_num, 8); 359 + u64 rn = le64_to_cpu(*((u64*)&sl->reg_num)); 360 + 361 + memcpy(&match[1], &rn, 8); 360 362 w1_write_block(sl->master, match, 9); 361 363 } 362 364 return 0;