All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] staging: rtl8712: Fixed sparse warnings
@ 2016-12-20 17:59 Jannik Becher
  2016-12-20 17:59 ` [PATCH 01/13] staging: rtl8712: changed struct members to __le32 Jannik Becher
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

In this set of patches I fixed most sparse endian warnings for the rtl8712 driver.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 01/13] staging: rtl8712: changed struct members to __le32
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 02/13] staging: rtl8712: changed variables " Jannik Becher
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed sparse warning "cast to restricted __le32".
struct sitesurvey_parm uses little endian members.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/rtl871x_cmd.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h
index 3284dcf..4734ca8 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.h
+++ b/drivers/staging/rtl8712/rtl871x_cmd.h
@@ -156,9 +156,9 @@ struct	setopmode_parm {
  * Command-Event Mode
  */
 struct sitesurvey_parm {
-	sint passive_mode;	/*active: 1, passive: 0 */
-	sint bsslimit;	/* 1 ~ 48 */
-	sint	ss_ssidlen;
+	__le32	passive_mode;	/*active: 1, passive: 0 */
+	__le32	bsslimit;	/* 1 ~ 48 */
+	__le32	ss_ssidlen;
 	u8	ss_ssid[IW_ESSID_MAX_SIZE + 1];
 };
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/13] staging: rtl8712: changed variables to __le32
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
  2016-12-20 17:59 ` [PATCH 01/13] staging: rtl8712: changed struct members to __le32 Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 03/13] staging: rtl8712: changed function argument " Jannik Becher
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed sparse warning "cast to restricted __le32".
Changed struct tx_desc members to __le32 and pcmdbuf to __le32.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/rtl8712_cmd.c  |  5 +++--
 drivers/staging/rtl8712/rtl8712_xmit.h | 16 ++++++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c
index 9f61583..6e5e177 100644
--- a/drivers/staging/rtl8712/rtl8712_cmd.c
+++ b/drivers/staging/rtl8712/rtl8712_cmd.c
@@ -314,7 +314,8 @@ void r8712_fw_cmd_data(struct _adapter *pAdapter, u32 *value, u8 flag)
 int r8712_cmd_thread(void *context)
 {
 	struct cmd_obj *pcmd;
-	unsigned int cmdsz, wr_sz, *pcmdbuf;
+	unsigned int cmdsz, wr_sz;
+	__le32 *pcmdbuf;
 	struct tx_desc *pdesc;
 	void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj *pcmd);
 	struct _adapter *padapter = context;
@@ -334,7 +335,7 @@ int r8712_cmd_thread(void *context)
 			r8712_unregister_cmd_alive(padapter);
 			continue;
 		}
-		pcmdbuf = (unsigned int *)pcmdpriv->cmd_buf;
+		pcmdbuf = (__le32 *)pcmdpriv->cmd_buf;
 		pdesc = (struct tx_desc *)pcmdbuf;
 		memset(pdesc, 0, TXDESC_SIZE);
 		pcmd = cmd_hdl_filter(padapter, pcmd);
diff --git a/drivers/staging/rtl8712/rtl8712_xmit.h b/drivers/staging/rtl8712/rtl8712_xmit.h
index b50e7a1..02b1593 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.h
+++ b/drivers/staging/rtl8712/rtl8712_xmit.h
@@ -91,14 +91,14 @@
 
 struct tx_desc {
 	/*DWORD 0*/
-	unsigned int txdw0;
-	unsigned int txdw1;
-	unsigned int txdw2;
-	unsigned int txdw3;
-	unsigned int txdw4;
-	unsigned int txdw5;
-	unsigned int txdw6;
-	unsigned int txdw7;
+	__le32 txdw0;
+	__le32 txdw1;
+	__le32 txdw2;
+	__le32 txdw3;
+	__le32 txdw4;
+	__le32 txdw5;
+	__le32 txdw6;
+	__le32 txdw7;
 };
 
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/13] staging: rtl8712: changed function argument to __le32
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
  2016-12-20 17:59 ` [PATCH 01/13] staging: rtl8712: changed struct members to __le32 Jannik Becher
  2016-12-20 17:59 ` [PATCH 02/13] staging: rtl8712: changed variables " Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 04/13] staging: rtl8712: casted variables " Jannik Becher
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed a sparse warning "cast to restricted __le32".
Function argument is of type __le32.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/rtl8712_cmd.c   | 2 +-
 drivers/staging/rtl8712/rtl8712_event.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c
index 6e5e177..f19b6b2 100644
--- a/drivers/staging/rtl8712/rtl8712_cmd.c
+++ b/drivers/staging/rtl8712/rtl8712_cmd.c
@@ -425,7 +425,7 @@ int r8712_cmd_thread(void *context)
 	thread_exit();
 }
 
-void r8712_event_handle(struct _adapter *padapter, uint *peventbuf)
+void r8712_event_handle(struct _adapter *padapter, __le32 *peventbuf)
 {
 	u8 evt_code, evt_seq;
 	u16 evt_sz;
diff --git a/drivers/staging/rtl8712/rtl8712_event.h b/drivers/staging/rtl8712/rtl8712_event.h
index 29a4c23..b383740 100644
--- a/drivers/staging/rtl8712/rtl8712_event.h
+++ b/drivers/staging/rtl8712/rtl8712_event.h
@@ -26,7 +26,7 @@
 #ifndef _RTL8712_EVENT_H_
 #define _RTL8712_EVENT_H_
 
-void r8712_event_handle(struct _adapter *padapter, uint *peventbuf);
+void r8712_event_handle(struct _adapter *padapter, __le32 *peventbuf);
 void r8712_got_addbareq_event_callback(struct _adapter *adapter, u8 *pbuf);
 
 enum rtl8712_c2h_event {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/13] staging: rtl8712: casted variables to __le32
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (2 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 03/13] staging: rtl8712: changed function argument " Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 05/13] staging: rtl8712: changed GetFrameSubType macro Jannik Becher
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed a sparse warning.
Casting __le32 variables to the right type.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/rtl871x_security.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c
index a7f04a4..3400e49 100644
--- a/drivers/staging/rtl8712/rtl871x_security.c
+++ b/drivers/staging/rtl8712/rtl871x_security.c
@@ -192,7 +192,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 				length = pattrib->last_txcmdsz - pattrib->
 					 hdrlen - pattrib->iv_len -
 					 pattrib->icv_len;
-				*((u32 *)crc) = cpu_to_le32(getcrc32(
+				*((__le32 *)crc) = cpu_to_le32(getcrc32(
 						payload, length));
 				arcfour_init(&mycontext, wepkey, 3 + keylength);
 				arcfour_encrypt(&mycontext, payload, payload,
@@ -203,7 +203,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 				length = pxmitpriv->frag_len -
 					 pattrib->hdrlen - pattrib->iv_len -
 					 pattrib->icv_len;
-				*((u32 *)crc) = cpu_to_le32(getcrc32(
+				*((__le32 *)crc) = cpu_to_le32(getcrc32(
 						payload, length));
 				arcfour_init(&mycontext, wepkey, 3 + keylength);
 				arcfour_encrypt(&mycontext, payload, payload,
@@ -248,7 +248,7 @@ void r8712_wep_decrypt(struct _adapter  *padapter, u8 *precvframe)
 		arcfour_init(&mycontext, wepkey, 3 + keylength);
 		arcfour_encrypt(&mycontext, payload, payload,  length);
 		/* calculate icv and compare the icv */
-		*((u32 *)crc) = cpu_to_le32(getcrc32(payload, length - 4));
+		*((__le32 *)crc) = cpu_to_le32(getcrc32(payload, length - 4));
 	}
 }
 
@@ -616,7 +616,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 					     pattrib->hdrlen -
 					     pattrib->iv_len -
 					     pattrib->icv_len;
-					*((u32 *)crc) = cpu_to_le32(
+					*((__le32 *)crc) = cpu_to_le32(
 						getcrc32(payload, length));
 					arcfour_init(&mycontext, rc4key, 16);
 					arcfour_encrypt(&mycontext, payload,
@@ -628,7 +628,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 						 pattrib->hdrlen -
 						 pattrib->iv_len -
 						 pattrib->icv_len;
-					*((u32 *)crc) = cpu_to_le32(getcrc32(
+					*((__le32 *)crc) = cpu_to_le32(getcrc32(
 							payload, length));
 					arcfour_init(&mycontext, rc4key, 16);
 					arcfour_encrypt(&mycontext, payload,
@@ -696,7 +696,7 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe)
 			/* 4 decrypt payload include icv */
 			arcfour_init(&mycontext, rc4key, 16);
 			arcfour_encrypt(&mycontext, payload, payload, length);
-			*((u32 *)crc) = cpu_to_le32(getcrc32(payload,
+			*((__le32 *)crc) = cpu_to_le32(getcrc32(payload,
 					length - 4));
 			if (crc[3] != payload[length - 1] ||
 			    crc[2] != payload[length - 2] ||
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/13] staging: rtl8712: changed GetFrameSubType macro
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (3 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 04/13] staging: rtl8712: casted variables " Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 06/13] staging: rtl8712: changed typecast to __le Jannik Becher
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed a sparse warning.
GetFrameSubType and GetFrameType should cast to __le16. Furthermore
GetFramSubType should use le16_to_cpu instead of cpu_to_le16.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/rtl871x_security.c | 4 ++--
 drivers/staging/rtl8712/wifi.h             | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c
index 3400e49..62d5694 100644
--- a/drivers/staging/rtl8712/rtl871x_security.c
+++ b/drivers/staging/rtl8712/rtl871x_security.c
@@ -1047,8 +1047,8 @@ static sint aes_cipher(u8 *key, uint	hdrlen,
 	u8 aes_out[16];
 	u8 padded_buffer[16];
 	u8 mic[8];
-	uint	frtype  = GetFrameType(pframe);
-	uint	frsubtype  = GetFrameSubType(pframe);
+	u16 frtype  = GetFrameType(pframe);
+	u16 frsubtype  = GetFrameSubType(pframe);
 
 	frsubtype >>= 4;
 	memset((void *)mic_iv, 0, 16);
diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h
index b8af965..7ebf247 100644
--- a/drivers/staging/rtl8712/wifi.h
+++ b/drivers/staging/rtl8712/wifi.h
@@ -229,7 +229,7 @@ enum WIFI_REG_DOMAIN {
 #define GetOrder(pbuf)	(((*(unsigned short *)(pbuf)) & \
 			le16_to_cpu(_ORDER_)) != 0)
 
-#define GetFrameType(pbuf)	(le16_to_cpu(*(unsigned short *)(pbuf)) & \
+#define GetFrameType(pbuf)	(le16_to_cpu(*(__le16 *)(pbuf)) & \
 				(BIT(3) | BIT(2)))
 
 #define SetFrameType(pbuf, type)	\
@@ -239,7 +239,7 @@ enum WIFI_REG_DOMAIN {
 		*(unsigned short *)(pbuf) |= cpu_to_le16(type); \
 	} while (0)
 
-#define GetFrameSubType(pbuf)	(cpu_to_le16(*(unsigned short *)(pbuf)) & \
+#define GetFrameSubType(pbuf)	(le16_to_cpu(*(__le16 *)(pbuf)) & \
 				(BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | \
 				BIT(2)))
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/13] staging: rtl8712: changed typecast to __le
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (4 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 05/13] staging: rtl8712: changed GetFrameSubType macro Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 07/13] staging: rtl8712: changed u32 to __le32 Jannik Becher
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed sparse warning.
Changed uint to __le16 and __le32.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/hal_init.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 0dd458d..c83d7eb 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -117,16 +117,16 @@ static void fill_fwpriv(struct _adapter *padapter, struct fw_priv *pfwpriv)
 
 static void update_fwhdr(struct fw_hdr	*pfwhdr, const u8 *pmappedfw)
 {
-	pfwhdr->signature = le16_to_cpu(*(u16 *)pmappedfw);
-	pfwhdr->version = le16_to_cpu(*(u16 *)(pmappedfw + 2));
+	pfwhdr->signature = le16_to_cpu(*(__le16 *)pmappedfw);
+	pfwhdr->version = le16_to_cpu(*(__le16 *)(pmappedfw + 2));
 	/* define the size of boot loader */
-	pfwhdr->dmem_size = le32_to_cpu(*(uint *)(pmappedfw + 4));
+	pfwhdr->dmem_size = le32_to_cpu(*(__le32 *)(pmappedfw + 4));
 	/* define the size of FW in IMEM */
-	pfwhdr->img_IMEM_size = le32_to_cpu(*(uint *)(pmappedfw + 8));
+	pfwhdr->img_IMEM_size = le32_to_cpu(*(__le32 *)(pmappedfw + 8));
 	/* define the size of FW in SRAM */
-	pfwhdr->img_SRAM_size = le32_to_cpu(*(uint *)(pmappedfw + 12));
+	pfwhdr->img_SRAM_size = le32_to_cpu(*(__le32 *)(pmappedfw + 12));
 	/* define the size of DMEM variable */
-	pfwhdr->fw_priv_sz = le32_to_cpu(*(uint *)(pmappedfw + 16));
+	pfwhdr->fw_priv_sz = le32_to_cpu(*(__le32 *)(pmappedfw + 16));
 }
 
 static u8 chk_fwhdr(struct fw_hdr *pfwhdr, u32 ulfilelength)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/13] staging: rtl8712: changed u32 to __le32
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (5 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 06/13] staging: rtl8712: changed typecast to __le Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 08/13] staging: rtl8712: changed uint " Jannik Becher
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed sparse warning.
Just changed u32 to __le32.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/usb_ops.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8712/usb_ops.c b/drivers/staging/rtl8712/usb_ops.c
index 9172400..332e2e5 100644
--- a/drivers/staging/rtl8712/usb_ops.c
+++ b/drivers/staging/rtl8712/usb_ops.c
@@ -41,7 +41,7 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u32 data;
+	__le32 data;
 	struct intf_priv *pintfpriv = pintfhdl->pintfpriv;
 
 	request = 0x05;
@@ -61,7 +61,7 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u32 data;
+	__le32 data;
 	struct intf_priv *pintfpriv = pintfhdl->pintfpriv;
 
 	request = 0x05;
@@ -81,7 +81,7 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u32 data;
+	__le32 data;
 	struct intf_priv *pintfpriv = pintfhdl->pintfpriv;
 
 	request = 0x05;
@@ -101,7 +101,7 @@ static void usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u32 data;
+	__le32 data;
 	struct intf_priv *pintfpriv = pintfhdl->pintfpriv;
 
 	request = 0x05;
@@ -109,8 +109,7 @@ static void usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
 	index = 0;
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 1;
-	data = val;
-	data = cpu_to_le32(data & 0x000000ff);
+	data = cpu_to_le32((u32)val & 0x000000ff);
 	r8712_usbctrl_vendorreq(pintfpriv, request, wvalue, index, &data, len,
 			  requesttype);
 }
@@ -122,7 +121,7 @@ static void usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u32 data;
+	__le32 data;
 	struct intf_priv *pintfpriv = pintfhdl->pintfpriv;
 
 	request = 0x05;
@@ -130,8 +129,7 @@ static void usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
 	index = 0;
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 2;
-	data = val;
-	data = cpu_to_le32(data & 0x0000ffff);
+	data = cpu_to_le32((u32)val & 0x0000ffff);
 	r8712_usbctrl_vendorreq(pintfpriv, request, wvalue, index, &data, len,
 			  requesttype);
 }
@@ -143,7 +141,7 @@ static void usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
 	u16 wvalue;
 	u16 index;
 	u16 len;
-	u32 data;
+	__le32 data;
 	struct intf_priv *pintfpriv = pintfhdl->pintfpriv;
 
 	request = 0x05;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/13] staging: rtl8712: changed uint to __le32
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (6 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 07/13] staging: rtl8712: changed u32 to __le32 Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 09/13] staging: rtl8712: fixed little endian problem Jannik Becher
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed a sparse warning.
Just changed uint to __le32.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/usb_ops_linux.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c
index fc6bb0b..441e76b 100644
--- a/drivers/staging/rtl8712/usb_ops_linux.c
+++ b/drivers/staging/rtl8712/usb_ops_linux.c
@@ -192,7 +192,8 @@ void r8712_usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
 
 static void r8712_usb_read_port_complete(struct urb *purb)
 {
-	uint isevt, *pbuf;
+	uint isevt;
+	__le32 *pbuf;
 	struct recv_buf	*precvbuf = (struct recv_buf *)purb->context;
 	struct _adapter *padapter = (struct _adapter *)precvbuf->adapter;
 	struct recv_priv *precvpriv = &padapter->recvpriv;
@@ -208,7 +209,7 @@ static void r8712_usb_read_port_complete(struct urb *purb)
 			_pkt *pskb = precvbuf->pskb;
 
 			precvbuf->transfer_len = purb->actual_length;
-			pbuf = (uint *)precvbuf->pbuf;
+			pbuf = (__le32 *)precvbuf->pbuf;
 			isevt = le32_to_cpu(*(pbuf + 1)) & 0x1ff;
 			if ((isevt & 0x1ff) == 0x1ff) {
 				r8712_rxcmd_event_hdl(padapter, pbuf);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/13] staging: rtl8712: fixed little endian problem
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (7 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 08/13] staging: rtl8712: changed uint " Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 10/13] staging: rtl8712: changed u32 to __le32 Jannik Becher
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed a sparse warning.
Using function le16_to_cpus() to avoid double assignment.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 590acb5..3518f1f 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -199,7 +199,7 @@ static noinline_for_stack char *translate_scan(struct _adapter *padapter,
 	iwe.cmd = SIOCGIWMODE;
 	memcpy((u8 *)&cap, r8712_get_capability_from_ie(pnetwork->network.IEs),
 		2);
-	cap = le16_to_cpu(cap);
+	le16_to_cpus(&cap);
 	if (cap & (WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_BSS)) {
 		if (cap & WLAN_CAPABILITY_BSS)
 			iwe.u.mode = (u32)IW_MODE_MASTER;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/13] staging: rtl8712: changed u32 to __le32
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (8 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 09/13] staging: rtl8712: fixed little endian problem Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 11/13] staging: rtl8712: changed cast to __le16 Jannik Becher
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed sparse warnings.
Deleted cpu_to_le32() for enum. I'm not sure why it was there.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/rtl871x_event.h |  2 +-
 drivers/staging/rtl8712/rtl871x_mlme.c  | 15 +++++++--------
 drivers/staging/rtl8712/wlan_bssdef.h   |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_event.h b/drivers/staging/rtl8712/rtl871x_event.h
index 697c8d7..5db8620 100644
--- a/drivers/staging/rtl8712/rtl871x_event.h
+++ b/drivers/staging/rtl8712/rtl871x_event.h
@@ -66,7 +66,7 @@ struct joinbss_event {
 struct stassoc_event {
 	unsigned char macaddr[6];
 	unsigned char rsvd[2];
-	int    cam_id;
+	__le32    cam_id;
 };
 
 struct stadel_event {
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 35cbdc7..fd8d96d 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -257,10 +257,10 @@ int r8712_is_same_ibss(struct _adapter *adapter, struct wlan_network *pnetwork)
 	struct security_priv *psecuritypriv = &adapter->securitypriv;
 
 	if ((psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_) &&
-		    (pnetwork->network.Privacy == 0))
+		    (pnetwork->network.Privacy == cpu_to_le32(0)))
 		ret = false;
 	else if ((psecuritypriv->PrivacyAlgrthm == _NO_PRIVACY_) &&
-		 (pnetwork->network.Privacy == 1))
+		 (pnetwork->network.Privacy == cpu_to_le32(1)))
 		ret = false;
 	else
 		ret = true;
@@ -933,7 +933,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
 		return;
 	/* to do : init sta_info variable */
 	psta->qos_option = 0;
-	psta->mac_id = le32_to_cpu((uint)pstassoc->cam_id);
+	psta->mac_id = le32_to_cpu(pstassoc->cam_id);
 	/* psta->aid = (uint)pstassoc->cam_id; */
 
 	if (adapter->securitypriv.AuthAlgrthm == 2)
@@ -1637,14 +1637,14 @@ void r8712_update_registrypriv_dev_network(struct _adapter *adapter)
 	pdev_network->Rssi = 0;
 	switch (pregistrypriv->wireless_mode) {
 	case WIRELESS_11B:
-		pdev_network->NetworkTypeInUse = cpu_to_le32(Ndis802_11DS);
+		pdev_network->NetworkTypeInUse = Ndis802_11DS;
 		break;
 	case WIRELESS_11G:
 	case WIRELESS_11BG:
-		pdev_network->NetworkTypeInUse = cpu_to_le32(Ndis802_11OFDM24);
+		pdev_network->NetworkTypeInUse = Ndis802_11OFDM24;
 		break;
 	case WIRELESS_11A:
-		pdev_network->NetworkTypeInUse = cpu_to_le32(Ndis802_11OFDM5);
+		pdev_network->NetworkTypeInUse = Ndis802_11OFDM5;
 		break;
 	default:
 		/* TODO */
@@ -1654,8 +1654,7 @@ void r8712_update_registrypriv_dev_network(struct _adapter *adapter)
 					       pregistrypriv->channel);
 	if (cur_network->network.InfrastructureMode == Ndis802_11IBSS)
 		pdev_network->Configuration.ATIMWindow = cpu_to_le32(3);
-	pdev_network->InfrastructureMode = cpu_to_le32(
-				cur_network->network.InfrastructureMode);
+	pdev_network->InfrastructureMode = cur_network->network.InfrastructureMode;
 	/* 1. Supported rates
 	 * 2. IE
 	 */
diff --git a/drivers/staging/rtl8712/wlan_bssdef.h b/drivers/staging/rtl8712/wlan_bssdef.h
index 86a88b4..c0654ae 100644
--- a/drivers/staging/rtl8712/wlan_bssdef.h
+++ b/drivers/staging/rtl8712/wlan_bssdef.h
@@ -83,7 +83,7 @@ struct wlan_bssid_ex {
 	unsigned char  MacAddress[6];
 	u8  Reserved[2];
 	struct ndis_802_11_ssid  Ssid;
-	u32 Privacy;
+	__le32 Privacy;
 	s32 Rssi;
 	enum NDIS_802_11_NETWORK_TYPE  NetworkTypeInUse;
 	struct NDIS_802_11_CONFIGURATION  Configuration;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 11/13] staging: rtl8712: changed cast to __le16
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (9 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 10/13] staging: rtl8712: changed u32 to __le32 Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 12/13] staging: rtl8712: changed u16 to __be16 Jannik Becher
  2016-12-20 17:59 ` [PATCH 13/13] staging: rtl8712: used a better macro Jannik Becher
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed sparse warning.
Changed u16 to __le16

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/ieee80211.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c
index 5dc3b5b..ccf8ba6 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -174,16 +174,16 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
 	sz += 8;
 	ie += sz;
 	/*beacon interval : 2bytes*/
-	*(u16 *)ie = cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);
+	*(__le16 *)ie = cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);
 	sz += 2;
 	ie += 2;
 	/*capability info*/
 	*(u16 *)ie = 0;
-	*(u16 *)ie |= cpu_to_le16(cap_IBSS);
+	*(__le16 *)ie |= cpu_to_le16(cap_IBSS);
 	if (pregistrypriv->preamble == PREAMBLE_SHORT)
-		*(u16 *)ie |= cpu_to_le16(cap_ShortPremble);
+		*(__le16 *)ie |= cpu_to_le16(cap_ShortPremble);
 	if (pdev_network->Privacy)
-		*(u16 *)ie |= cpu_to_le16(cap_Privacy);
+		*(__le16 *)ie |= cpu_to_le16(cap_Privacy);
 	sz += 2;
 	ie += 2;
 	/*SSID*/
@@ -224,7 +224,7 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
 				goto check_next_ie;
 			/*check version...*/
 			memcpy((u8 *)&val16, (pbuf + 6), sizeof(val16));
-			val16 = le16_to_cpu(val16);
+			le16_to_cpus(&val16);
 			if (val16 != 0x0001)
 				goto check_next_ie;
 			*wpa_ie_len = *(pbuf + 1);
@@ -304,7 +304,7 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
 	}
 	/*pairwise_cipher*/
 	if (left >= 2) {
-		count = le16_to_cpu(*(u16 *)pos);
+		count = le16_to_cpu(*(__le16 *)pos);
 		pos += 2;
 		left -= 2;
 		if (count == 0 || left < count * WPA_SELECTOR_LEN)
@@ -347,7 +347,7 @@ int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
 	}
 	/*pairwise_cipher*/
 	if (left >= 2) {
-		count = le16_to_cpu(*(u16 *)pos);
+		count = le16_to_cpu(*(__le16 *)pos);
 		pos += 2;
 		left -= 2;
 		if (count == 0 || left < count * RSN_SELECTOR_LEN)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 12/13] staging: rtl8712: changed u16 to __be16
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (10 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 11/13] staging: rtl8712: changed cast to __le16 Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  2016-12-20 17:59 ` [PATCH 13/13] staging: rtl8712: used a better macro Jannik Becher
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed sparse warning.
Just changed u16 to __be16 and typecasts.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/rtl8712_recv.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 66f0e0a..1332b46 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -408,7 +408,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
 			memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst,
 				ETH_ALEN);
 		} else {
-			u16 len;
+			__be16 len;
 			/* Leave Ethernet header part of hdr and full payload */
 			len = htons(sub_skb->len);
 			memcpy(skb_push(sub_skb, 2), &len, 2);
@@ -439,21 +439,21 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
 
 void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf)
 {
-	uint voffset;
+	__le32 voffset;
 	u8 *poffset;
 	u16 cmd_len, drvinfo_sz;
 	struct recv_stat *prxstat;
 
 	poffset = (u8 *)prxcmdbuf;
-	voffset = *(uint *)poffset;
+	voffset = *(__le32 *)poffset;
 	prxstat = (struct recv_stat *)prxcmdbuf;
 	drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16;
 	drvinfo_sz <<= 3;
 	poffset += RXDESC_SIZE + drvinfo_sz;
 	do {
-		voffset  = *(uint *)poffset;
+		voffset  = *(__le32 *)poffset;
 		cmd_len = (u16)(le32_to_cpu(voffset) & 0xffff);
-		r8712_event_handle(padapter, (uint *)poffset);
+		r8712_event_handle(padapter, (__le32 *)poffset);
 		poffset += (cmd_len + 8);/*8 bytes alignment*/
 	} while (le32_to_cpu(voffset) & BIT(31));
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 13/13] staging: rtl8712: used a better macro
  2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
                   ` (11 preceding siblings ...)
  2016-12-20 17:59 ` [PATCH 12/13] staging: rtl8712: changed u16 to __be16 Jannik Becher
@ 2016-12-20 17:59 ` Jannik Becher
  12 siblings, 0 replies; 14+ messages in thread
From: Jannik Becher @ 2016-12-20 17:59 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Jannik Becher

Fixed a sparse warning.
Using be16_to_cpus() to avoid double assignment.

Signed-off-by: Jannik Becher <becher.jannik@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/staging/rtl8712/rtl871x_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
index 35c721a..4388ddf 100644
--- a/drivers/staging/rtl8712/rtl871x_recv.c
+++ b/drivers/staging/rtl8712/rtl871x_recv.c
@@ -258,7 +258,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
 		/* get ether_type */
 		ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE;
 		memcpy(&ether_type, ptr, 2);
-		ether_type = ntohs((unsigned short)ether_type);
+		be16_to_cpus(&ether_type);
 
 		if ((psta != NULL) && (psta->ieee8021x_blocked)) {
 			/* blocked
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-12-20 18:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20 17:59 [PATCH 00/13] staging: rtl8712: Fixed sparse warnings Jannik Becher
2016-12-20 17:59 ` [PATCH 01/13] staging: rtl8712: changed struct members to __le32 Jannik Becher
2016-12-20 17:59 ` [PATCH 02/13] staging: rtl8712: changed variables " Jannik Becher
2016-12-20 17:59 ` [PATCH 03/13] staging: rtl8712: changed function argument " Jannik Becher
2016-12-20 17:59 ` [PATCH 04/13] staging: rtl8712: casted variables " Jannik Becher
2016-12-20 17:59 ` [PATCH 05/13] staging: rtl8712: changed GetFrameSubType macro Jannik Becher
2016-12-20 17:59 ` [PATCH 06/13] staging: rtl8712: changed typecast to __le Jannik Becher
2016-12-20 17:59 ` [PATCH 07/13] staging: rtl8712: changed u32 to __le32 Jannik Becher
2016-12-20 17:59 ` [PATCH 08/13] staging: rtl8712: changed uint " Jannik Becher
2016-12-20 17:59 ` [PATCH 09/13] staging: rtl8712: fixed little endian problem Jannik Becher
2016-12-20 17:59 ` [PATCH 10/13] staging: rtl8712: changed u32 to __le32 Jannik Becher
2016-12-20 17:59 ` [PATCH 11/13] staging: rtl8712: changed cast to __le16 Jannik Becher
2016-12-20 17:59 ` [PATCH 12/13] staging: rtl8712: changed u16 to __be16 Jannik Becher
2016-12-20 17:59 ` [PATCH 13/13] staging: rtl8712: used a better macro Jannik Becher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.