diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-02-02 22:53:57 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-02 22:53:57 +0100 |
commit | 26351479ed43288be92935826c215fbe01e2abb2 (patch) | |
tree | 07b9669909f757e781ecb8d1694607099c75ae9f /drivers/net/qlge/qlge_main.c | |
parent | udp: increments sk_drops in __udp_queue_rcv_skb() (diff) | |
download | linux-26351479ed43288be92935826c215fbe01e2abb2.tar.xz linux-26351479ed43288be92935826c215fbe01e2abb2.zip |
qlge: bugfix: Fix endian issue when reading flash.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlge/qlge_main.c')
-rw-r--r-- | drivers/net/qlge/qlge_main.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 45421c8b6010..17d02eb6c8be 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c @@ -641,7 +641,7 @@ static void ql_enable_all_completion_interrupts(struct ql_adapter *qdev) } -static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data) +static int ql_read_flash_word(struct ql_adapter *qdev, int offset, __le32 *data) { int status = 0; /* wait for reg to come ready */ @@ -656,8 +656,11 @@ static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data) FLASH_ADDR, FLASH_ADDR_RDY, FLASH_ADDR_ERR); if (status) goto exit; - /* get the data */ - *data = ql_read32(qdev, FLASH_DATA); + /* This data is stored on flash as an array of + * __le32. Since ql_read32() returns cpu endian + * we need to swap it back. + */ + *data = cpu_to_le32(ql_read32(qdev, FLASH_DATA)); exit: return status; } @@ -666,7 +669,7 @@ static int ql_get_flash_params(struct ql_adapter *qdev) { int i; int status; - u32 *p = (u32 *)&qdev->flash; + __le32 *p = (__le32 *)&qdev->flash; if (ql_sem_spinlock(qdev, SEM_FLASH_MASK)) return -ETIMEDOUT; |