linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* p54: fix EEPROM structure endianness
@ 2008-02-29 12:56 Johannes Berg
  2008-03-02 12:24 ` Florian Fainelli
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2008-02-29 12:56 UTC (permalink / raw)
  To: John Linville; +Cc: Michael Wu, linux-wireless

Since the EEPROM structure is read from hardware, it is
always little endian, annotate that in the struct and
make sure to convert where applicable.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Michael Wu <flamingice@sourmilk.net>
---
Does anybody have a p54 card and big endian hardware to test it on? I'm
fairly sure this is a correct change but if it currently works on big
endian the change would be bad (and I'd be rather surprised.)

 drivers/net/wireless/p54common.c |    2 +-
 drivers/net/wireless/p54common.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

--- everything.orig/drivers/net/wireless/p54common.c	2008-02-28 17:26:23.000000000 +0100
+++ everything/drivers/net/wireless/p54common.c	2008-02-29 13:53:05.000000000 +0100
@@ -212,7 +212,7 @@ int p54_parse_eeprom(struct ieee80211_hw
 	int err;
 
 	wrap = (struct eeprom_pda_wrap *) eeprom;
-	entry = (void *)wrap->data + wrap->len;
+	entry = (void *)wrap->data + le16_to_cpu(wrap->len);
 	i += 2;
 	i += le16_to_cpu(entry->len)*2;
 	while (i < len) {
--- everything.orig/drivers/net/wireless/p54common.h	2008-02-19 23:10:32.000000000 +0100
+++ everything/drivers/net/wireless/p54common.h	2008-02-29 13:53:05.000000000 +0100
@@ -53,10 +53,10 @@ struct pda_entry {
 } __attribute__ ((packed));
 
 struct eeprom_pda_wrap {
-	u32 magic;
-	u16 pad;
-	u16 len;
-	u32 arm_opcode;
+	__le32 magic;
+	__le16 pad;
+	__le16 len;
+	__le32 arm_opcode;
 	u8 data[0];
 } __attribute__ ((packed));
 



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-02 15:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-29 12:56 p54: fix EEPROM structure endianness Johannes Berg
2008-03-02 12:24 ` Florian Fainelli
2008-03-02 13:40   ` Johannes Berg
2008-03-02 14:59     ` Florian Fainelli
2008-03-02 15:11       ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).