diff options
author | Ajay Singh <ajay.kathat@microchip.com> | 2018-08-01 16:41:00 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-08-02 09:41:37 +0200 |
commit | 02211edc9a1f71942a67d545614f8c7382230de7 (patch) | |
tree | cb8b875d2ff54424504c4f98957162be3a951b58 /drivers/staging/wilc1000/wilc_wlan_cfg.c | |
parent | 41203a451b6c9f6458195d9c0de964bf33c52e93 (diff) |
staging: wilc1000: fix endianness warnings reported by sparse
This patch fixes the sparse warnings by making use of le32_to_cpus() &
cpu_to_le32s() conversion API's.
Remove the unnecessary byte-order conversion in
wilc_wlan_parse_response_frame() as the data is copied using individual
byte operation.
Also added the byte-order conversion for 'header' in
wilc_wfi_monitor_rx() & wilc_wfi_p2p_rx() as received in LE byte-order.
The link [1] contains the details of discussion related to this patch.
[1]. https://patchwork.kernel.org/patch/10436791/
Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000/wilc_wlan_cfg.c')
-rw-r--r-- | drivers/staging/wilc1000/wilc_wlan_cfg.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 331be7b95294..b215f982a246 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -268,16 +268,17 @@ static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size) * ********************************************/ +#define GET_WID_TYPE(wid) (((wid) >> 12) & 0x7) static void wilc_wlan_parse_response_frame(u8 *info, int size) { - u32 wid, len = 0, i = 0; + u16 wid; + u32 len = 0, i = 0; while (size > 0) { i = 0; wid = info[0] | (info[1] << 8); - wid = cpu_to_le32(wid); - switch ((wid >> 12) & 0x7) { + switch (GET_WID_TYPE(wid)) { case WID_CHAR: do { if (g_cfg_byte[i].id == WID_NIL) @@ -298,9 +299,8 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) break; if (g_cfg_hword[i].id == wid) { - g_cfg_hword[i].val = - cpu_to_le16(info[4] | - (info[5] << 8)); + g_cfg_hword[i].val = (info[4] | + (info[5] << 8)); break; } i++; @@ -314,11 +314,10 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) break; if (g_cfg_word[i].id == wid) { - g_cfg_word[i].val = - cpu_to_le32(info[4] | - (info[5] << 8) | - (info[6] << 16) | - (info[7] << 24)); + g_cfg_word[i].val = (info[4] | + (info[5] << 8) | + (info[6] << 16) | + (info[7] << 24)); break; } i++; |