wl1251: convert 32-bit values to le32 before writing to the chip
authorLuciano Coelho <coelho@ti.com>
Wed, 21 Dec 2011 20:36:28 +0000 (22:36 +0200)
committerLuciano Coelho <coelho@ti.com>
Wed, 15 Feb 2012 06:38:27 +0000 (08:38 +0200)
The 32-bit values were not converted before writing them to the chip.
Change the wl1251_read32() and wl1251_write32() so that they always
read and write le32 values and convert to and from the CPU endianess.

Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl1251/io.h
drivers/net/wireless/wl1251/wl1251.h

index c545e9d5f512a34f2cc8a61e847f829dc74d73bc..d382877c34cc179c35cb7b0f65a8efa42c2ed341 100644 (file)
 
 static inline u32 wl1251_read32(struct wl1251 *wl, int addr)
 {
-       u32 response;
-
-       wl->if_ops->read(wl, addr, &response, sizeof(u32));
+       wl->if_ops->read(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32));
 
-       return response;
+       return le32_to_cpu(wl->buffer_32);
 }
 
 static inline void wl1251_write32(struct wl1251 *wl, int addr, u32 val)
 {
-       wl->if_ops->write(wl, addr, &val, sizeof(u32));
+       wl->buffer_32 = cpu_to_le32(val);
+       wl->if_ops->write(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32));
 }
 
 static inline u32 wl1251_read_elp(struct wl1251 *wl, int addr)
index a77f1bbbed0ad063aae085ff857c4cc7abadd717..9d8f5816c6f91628d609ecd0090c438133c5b115 100644 (file)
@@ -380,7 +380,7 @@ struct wl1251 {
        struct wl1251_stats stats;
        struct wl1251_debugfs debugfs;
 
-       u32 buffer_32;
+       __le32 buffer_32;
        u32 buffer_cmd;
        u8 buffer_busyword[WL1251_BUSY_WORD_LEN];
        struct wl1251_rx_descriptor *rx_descriptor;