* [W1] Fix slave addition on big-endian platform
@ 2005-06-23 1:27 roger blofeld
2005-06-23 7:04 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: roger blofeld @ 2005-06-23 1:27 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel
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.
Signed-off-by: Roger Blofeld <blofeldus@yahoo.com>
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [W1] Fix slave addition on big-endian platform
2005-06-23 1:27 [W1] Fix slave addition on big-endian platform roger blofeld
@ 2005-06-23 7:04 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2005-06-23 7:04 UTC (permalink / raw)
To: roger blofeld; +Cc: linux-kernel
On Wed, Jun 22, 2005 at 06:27:32PM -0700, roger blofeld wrote:
> 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.
>
> Signed-off-by: Roger Blofeld <blofeldus@yahoo.com>
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-06-23 8:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-23 1:27 [W1] Fix slave addition on big-endian platform roger blofeld
2005-06-23 7:04 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox