From: Johannes Berg Date: Fri, 29 Feb 2008 12:56:33 +0000 (+0100) Subject: p54: fix EEPROM structure endianness X-Git-Tag: v2.6.25-rc4~2^2~1^2~5 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c28293f5514f64ba064bac7946aebeda4a663c6;p=linux-2.6 p54: fix EEPROM structure endianness 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 Cc: Michael Wu Tested-by: Florian Fainelli Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c index 5cda49aff3..56aabec73c 100644 --- a/drivers/net/wireless/p54common.c +++ b/drivers/net/wireless/p54common.c @@ -172,7 +172,7 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) 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) { diff --git a/drivers/net/wireless/p54common.h b/drivers/net/wireless/p54common.h index a721334e20..b67ff34e26 100644 --- a/drivers/net/wireless/p54common.h +++ b/drivers/net/wireless/p54common.h @@ -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));