Skip to contentSkip to conversation

fix w1 for big-endian

PATCH RESEND In review roger blofeld 2 participants 2 messages Jun 30, 2005 W1 dallas's 1-wire bus

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 fix w1 for big-endian

Hi
In the 2.6.13-rc1 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.

I sent this earlier to greg k-h & lkml, but he said I should send it
here first.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------

drivers/w1/w1.c +2 -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);
 	}
 			
#1 lore raw
Quoted 9 lines · On Thu, 30 Jun 2005 08:47:51 -0700 (PDT) roger blofeld <[email protected]>…

Hi
In the 2.6.13-rc1 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.

I sent this earlier to greg k-h & lkml, but he said I should send it
here first.

Sorry for long delay - I agree with your patch and will push it upstream. Thank you.

Quoted 1 line

Evgeniy Polyakov

Only failure makes us experts. -- Theo de Raadt