mirror of https://gitee.com/openkylin/linux.git
staging: wfx: fix endianness of the struct hif_ind_startup
The struct hif_ind_startup is received from the hardware. So it is declared as little endian. However, it is also stored in the main driver structure and used on different places in the driver. Sparse complains about that: drivers/staging/wfx/data_tx.c:388:43: warning: restricted __le16 degrades to integer drivers/staging/wfx/bh.c:199:9: warning: restricted __le16 degrades to integer drivers/staging/wfx/bh.c:221:62: warning: restricted __le16 degrades to integer In order to make Sparse happy and to keep access from the driver easy, this patch declare hif_ind_startup with native endianness. On reception of this struct, this patch takes care to do byte-swap and keep Sparse happy. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200512150414.267198-13-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9fee675c2c
commit
4246fdbf8c
|
@ -136,12 +136,15 @@ struct hif_otp_phy_info {
|
|||
} __packed;
|
||||
|
||||
struct hif_ind_startup {
|
||||
// As the others, this struct is interpreted as little endian by the
|
||||
// device. However, this struct is also used by the driver. We prefer to
|
||||
// declare it in native order and doing byte swap on reception.
|
||||
__le32 status;
|
||||
__le16 hardware_id;
|
||||
u16 hardware_id;
|
||||
u8 opn[14];
|
||||
u8 uid[8];
|
||||
__le16 num_inp_ch_bufs;
|
||||
__le16 size_inp_ch_buf;
|
||||
u16 num_inp_ch_bufs;
|
||||
u16 size_inp_ch_buf;
|
||||
u8 num_links_ap;
|
||||
u8 num_interfaces;
|
||||
u8 mac_addr[2][ETH_ALEN];
|
||||
|
@ -155,7 +158,7 @@ struct hif_ind_startup {
|
|||
u8 disabled_channel_list[2];
|
||||
struct hif_otp_regul_sel_mode_info regul_sel_mode_info;
|
||||
struct hif_otp_phy_info otp_phy_info;
|
||||
__le32 supported_rate_mask;
|
||||
u32 supported_rate_mask;
|
||||
u8 firmware_label[128];
|
||||
} __packed;
|
||||
|
||||
|
|
|
@ -100,10 +100,10 @@ static int hif_startup_indication(struct wfx_dev *wdev,
|
|||
return -EINVAL;
|
||||
}
|
||||
memcpy(&wdev->hw_caps, body, sizeof(struct hif_ind_startup));
|
||||
le32_to_cpus(&wdev->hw_caps.status);
|
||||
le16_to_cpus(&wdev->hw_caps.hardware_id);
|
||||
le16_to_cpus(&wdev->hw_caps.num_inp_ch_bufs);
|
||||
le16_to_cpus(&wdev->hw_caps.size_inp_ch_buf);
|
||||
le16_to_cpus((__le16 *)&wdev->hw_caps.hardware_id);
|
||||
le16_to_cpus((__le16 *)&wdev->hw_caps.num_inp_ch_bufs);
|
||||
le16_to_cpus((__le16 *)&wdev->hw_caps.size_inp_ch_buf);
|
||||
le32_to_cpus((__le32 *)&wdev->hw_caps.supported_rate_mask);
|
||||
|
||||
complete(&wdev->firmware_ready);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue