Fix slave addition on big-endian platform
Hi
In the 2.6.12 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. The following patch fixes the problem for me.
drivers/w1/w1.c +1 -3
@@ -493,6 +493,7 @@ void w1_slave_found(unsigned long data,struct w1_reg_num *tmp;int family_found =0 ;struct w1_master *dev; +u64 rn_le =cpu_to_le64 (rn); dev =w1_search_master (data);if (!dev) {
@@ -522,10 +523,8 @@ void w1_slave_found(unsigned long data, slave_count++; } - rn =cpu_to_le64 (rn); - if (slave_count == dev->slave_count && - rn && ((le64_to_cpu(rn) >> 56) & 0xff) ==
w1_calc_crc8((u8 *)&rn, 7)) {
+ rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn_le,
7)) {
w1_attach_slave_device(dev, tmp);
}__________________________________
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html
Quoted 7 lines · roger blofeld
Hi
In the 2.6.12 code the "rn" structure is in the wrong-endianness when
passed tow1_attach_slave_device(). This causes problems like the family and crc being swapped around. The following patch fixes the problem for me.Signed-off-by Roger Blofeld <[email protected]>
Hm, your patch is line-wrapped and the tabs are missing :(
You should also send this to the w1 author/maintainer first, he would know if this is the correct fix or not.
thanks,
greg k-h