diff options
author | Jérôme Pouiller <jerome.pouiller@silabs.com> | 2020-05-12 17:04:11 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-13 13:49:45 +0200 |
commit | ecda229e7ce3224fe9937d23c41e5ef74d4e6db3 (patch) | |
tree | 6cb78ea3d18434771f135c64e5a5b7144b0516fd /drivers/staging/wfx/hif_api_general.h | |
parent | 808fcf2e976d0afd3279a2b85fa9dcb4a0c26d85 (diff) | |
download | linux-stable-ecda229e7ce3224fe9937d23c41e5ef74d4e6db3.tar.gz linux-stable-ecda229e7ce3224fe9937d23c41e5ef74d4e6db3.tar.bz2 linux-stable-ecda229e7ce3224fe9937d23c41e5ef74d4e6db3.zip |
staging: wfx: fix endianness of the field 'status'
The field 'status' appears in most of structs returned by the hardware.
This field is encoded as little endian. Sparse complains this field is
not always correctly accessed:
drivers/staging/wfx/data_rx.c:53:16: warning: restricted __le32 degrades to integer
drivers/staging/wfx/data_rx.c:84:16: warning: restricted __le32 degrades to integer
drivers/staging/wfx/data_tx.c:526:24: warning: restricted __le32 degrades to integer
drivers/staging/wfx/data_tx.c:569:23: warning: restricted __le32 degrades to integer
drivers/staging/wfx/hif_rx.c:128:33: warning: restricted __le32 degrades to integer
drivers/staging/wfx/./traces.h:401:1: warning: restricted __le32 degrades to integer
drivers/staging/wfx/./traces.h:401:1: warning: restricted __le32 degrades to integer
In most of cases, this field is only compared with HIF_STATUS values.
Finally, it is more convenient to solve the problem by defining the
HIF_STATUS values directly in little endian.
It is also the right time to make some clean up in the HIF_STATUS names.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200512150414.267198-15-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx/hif_api_general.h')
-rw-r--r-- | drivers/staging/wfx/hif_api_general.h | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/staging/wfx/hif_api_general.h b/drivers/staging/wfx/hif_api_general.h index 995752b9f168..f5abd8174706 100644 --- a/drivers/staging/wfx/hif_api_general.h +++ b/drivers/staging/wfx/hif_api_general.h @@ -67,21 +67,27 @@ enum hif_general_indications_ids { HIF_IND_ID_SL_EXCHANGE_PUB_KEYS = 0xe5 }; -enum hif_hi_status { - HI_STATUS_SUCCESS = 0x0000, - HI_STATUS_FAILURE = 0x0001, - HI_INVALID_PARAMETER = 0x0002, - HI_STATUS_GPIO_WARNING = 0x0003, - HI_ERROR_UNSUPPORTED_MSG_ID = 0x0004, - SL_MAC_KEY_STATUS_SUCCESS = 0x005A, - SL_MAC_KEY_STATUS_FAILED_KEY_ALREADY_BURNED = 0x006B, - SL_MAC_KEY_STATUS_FAILED_RAM_MODE_NOT_ALLOWED = 0x007C, - SL_MAC_KEY_STATUS_FAILED_UNKNOWN_MODE = 0x008D, - SL_PUB_KEY_EXCHANGE_STATUS_SUCCESS = 0x009E, - SL_PUB_KEY_EXCHANGE_STATUS_FAILED = 0x00AF, - PREVENT_ROLLBACK_CNF_SUCCESS = 0x1234, - PREVENT_ROLLBACK_CNF_WRONG_MAGIC_WORD = 0x1256 -}; +#define HIF_STATUS_SUCCESS (cpu_to_le32(0x0000)) +#define HIF_STATUS_FAIL (cpu_to_le32(0x0001)) +#define HIF_STATUS_INVALID_PARAMETER (cpu_to_le32(0x0002)) +#define HIF_STATUS_WARNING (cpu_to_le32(0x0003)) +#define HIF_STATUS_UNKNOWN_REQUEST (cpu_to_le32(0x0004)) +#define HIF_STATUS_RX_FAIL_DECRYPT (cpu_to_le32(0x0010)) +#define HIF_STATUS_RX_FAIL_MIC (cpu_to_le32(0x0011)) +#define HIF_STATUS_RX_FAIL_NO_KEY (cpu_to_le32(0x0012)) +#define HIF_STATUS_TX_FAIL_RETRIES (cpu_to_le32(0x0013)) +#define HIF_STATUS_TX_FAIL_TIMEOUT (cpu_to_le32(0x0014)) +#define HIF_STATUS_TX_FAIL_REQUEUE (cpu_to_le32(0x0015)) +#define HIF_STATUS_REFUSED (cpu_to_le32(0x0016)) +#define HIF_STATUS_BUSY (cpu_to_le32(0x0017)) +#define HIF_STATUS_SLK_SET_KEY_SUCCESS (cpu_to_le32(0x005A)) +#define HIF_STATUS_SLK_SET_KEY_ALREADY_BURNED (cpu_to_le32(0x006B)) +#define HIF_STATUS_SLK_SET_KEY_DISALLOWED_MODE (cpu_to_le32(0x007C)) +#define HIF_STATUS_SLK_SET_KEY_UNKNOWN_MODE (cpu_to_le32(0x008D)) +#define HIF_STATUS_SLK_NEGO_SUCCESS (cpu_to_le32(0x009E)) +#define HIF_STATUS_SLK_NEGO_FAILED (cpu_to_le32(0x00AF)) +#define HIF_STATUS_ROLLBACK_SUCCESS (cpu_to_le32(0x1234)) +#define HIF_STATUS_ROLLBACK_FAIL (cpu_to_le32(0x1256)) enum hif_api_rate_index { API_RATE_INDEX_B_1MBPS = 0, |