staging: wlan-ng: Fix endianness warnings
PATCH 1/1 staging: wlan-ng: Fix endianness warnings
From: Alfonso Lima Astor <[email protected]>
These variables were set to u16 and u32 although they always hold a little endian value.
This patch fixes multiple sparse warnings like:drivers/staging/wlan-ng/prism2sta.c:375:46: warning: cast to restricted __le16
Signed-off-by Alfonso Lima Astor <[email protected]>
--- drivers/staging/wlan-ng/hfa384x.h | 92 ++++++++++++++++++------------------- drivers/staging/wlan-ng/prism2sta.c | 8 ++-- 2 files changed, 50 insertions(+), 50 deletions(-)
drivers/staging/wlan-ng/hfa384x.h +46 -46
@@ -445,9 +445,9 @@ struct hfa384x_downloadbuffer {/*-- Information Record: commsquality --*/ struct hfa384x_commsquality { -u16 cq_curr_bss; -u16 asl_curr_bss; -u16 anl_curr_fc; +__le16 cq_curr_bss; +__le16 asl_curr_bss; +__le16 anl_curr_fc; } __packed;/*-- Information Record: dmbcommsquality --*/
@@ -598,51 +598,51 @@ struct hfa384x_rx_frame {/*-- Inquiry Frame, Diagnose: Communication Tallies --*/ struct hfa384x_comm_tallies_16 { -u16 txunicastframes; -u16 txmulticastframes; -u16 txfragments; -u16 txunicastoctets; -u16 txmulticastoctets; -u16 txdeferredtrans; -u16 txsingleretryframes; -u16 txmultipleretryframes; -u16 txretrylimitexceeded; -u16 txdiscards; -u16 rxunicastframes; -u16 rxmulticastframes; -u16 rxfragments; -u16 rxunicastoctets; -u16 rxmulticastoctets; -u16 rxfcserrors; -u16 rxdiscardsnobuffer; -u16 txdiscardswrongsa; -u16 rxdiscardswepundecr; -u16 rxmsginmsgfrag; -u16 rxmsginbadmsgfrag; +__le16 txunicastframes; +__le16 txmulticastframes; +__le16 txfragments; +__le16 txunicastoctets; +__le16 txmulticastoctets; +__le16 txdeferredtrans; +__le16 txsingleretryframes; +__le16 txmultipleretryframes; +__le16 txretrylimitexceeded; +__le16 txdiscards; +__le16 rxunicastframes; +__le16 rxmulticastframes; +__le16 rxfragments; +__le16 rxunicastoctets; +__le16 rxmulticastoctets; +__le16 rxfcserrors; +__le16 rxdiscardsnobuffer; +__le16 txdiscardswrongsa; +__le16 rxdiscardswepundecr; +__le16 rxmsginmsgfrag; +__le16 rxmsginbadmsgfrag; } __packed;struct hfa384x_comm_tallies_32 { -u32 txunicastframes; -u32 txmulticastframes; -u32 txfragments; -u32 txunicastoctets; -u32 txmulticastoctets; -u32 txdeferredtrans; -u32 txsingleretryframes; -u32 txmultipleretryframes; -u32 txretrylimitexceeded; -u32 txdiscards; -u32 rxunicastframes; -u32 rxmulticastframes; -u32 rxfragments; -u32 rxunicastoctets; -u32 rxmulticastoctets; -u32 rxfcserrors; -u32 rxdiscardsnobuffer; -u32 txdiscardswrongsa; -u32 rxdiscardswepundecr; -u32 rxmsginmsgfrag; -u32 rxmsginbadmsgfrag; +__le32 txunicastframes; +__le32 txmulticastframes; +__le32 txfragments; +__le32 txunicastoctets; +__le32 txmulticastoctets; +__le32 txdeferredtrans; +__le32 txsingleretryframes; +__le32 txmultipleretryframes; +__le32 txretrylimitexceeded; +__le32 txdiscards; +__le32 rxunicastframes; +__le32 rxmulticastframes; +__le32 rxfragments; +__le32 rxunicastoctets; +__le32 rxmulticastoctets; +__le32 rxfcserrors; +__le32 rxdiscardsnobuffer; +__le32 txdiscardswrongsa; +__le32 rxdiscardswepundecr; +__le32 rxmsginmsgfrag; +__le32 rxmsginbadmsgfrag; } __packed;/*-- Inquiry Frame, Diagnose: Scan Results & Subfields--*/
@@ -711,7 +711,7 @@ struct hfa384x_hscan_result {#define HFA384x_LINK_ASSOCFAIL ((u16)6)struct hfa384x_link_status { -u16 linkstatus; +__le16 linkstatus; } __packed;/*-- Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
drivers/staging/wlan-ng/prism2sta.c +4 -4
@@ -991,9 +991,9 @@ static void prism2sta_inf_tallies(struct wlandevice *wlandev, struct hfa384x_inf_frame *inf) {struct hfa384x *hw = wlandev->priv; -u16 *src16; +__le16 *src16;u32 *dst; -u32 *src32; +__le32 *src32;int i;int cnt;
@@ -1005,12 +1005,12 @@ static void prism2sta_inf_tallies(struct wlandevice *wlandev, cnt =sizeof (struct hfa384x_comm_tallies_32 ) /sizeof (u32);if (inf->framelen >22 ) { dst = (u32 *)&hw->tallies; - src32 = (u32 *)&inf->info.commtallies32; + src32 = (__le32 *)&inf->info.commtallies32;for (i =0 ; i < cnt; i++, dst++, src32++) *dst +=le32_to_cpu (*src32); }else { dst = (u32 *)&hw->tallies; - src16 = (u16 *)&inf->info.commtallies16; + src16 = (__le16 *)&inf->info.commtallies16;for (i =0 ; i < cnt; i++, dst++, src16++) *dst +=le16_to_cpu (*src16); }
Signature · 1 line
2.11.0
Greg KH
maintainerQuoted 5 lines · On Wed, Jul 12, 2017 at 09:38:50PM +0100, [email protected] wrote:
From: Alfonso Lima Astor <[email protected]>
These variables were set to u16 and u32 although they always hold a little endian value.
Quoted 8 lines
This patch fixes multiple sparse warnings like:
drivers/staging/wlan-ng/prism2sta.c:375:46: warning: cast to restricted__le16Signed-off-by Alfonso Lima Astor <[email protected]>--- drivers/staging/wlan-ng/hfa384x.h | 92 ++++++++++++++++++------------------- drivers/staging/wlan-ng/prism2sta.c | 8 ++-- 2 files changed, 50 insertions(+), 50 deletions(-)
Does not apply to my tree, I think someone else already did this same thing, sorry.
greg k-h