From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: Michael Wu <flamingice@sourmilk.net>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: p54: fix EEPROM structure endianness
Date: Fri, 29 Feb 2008 13:56:33 +0100 [thread overview]
Message-ID: <1204289793.3938.20.camel@johannes.berg> (raw)
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));
next reply other threads:[~2008-02-29 15:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-29 12:56 Johannes Berg [this message]
2008-03-02 12:24 ` p54: fix EEPROM structure endianness Florian Fainelli
2008-03-02 13:40 ` Johannes Berg
2008-03-02 14:59 ` Florian Fainelli
2008-03-02 15:11 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1204289793.3938.20.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=flamingice@sourmilk.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox