mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] staging: rtl8723bs: fix uint types in hal_intf and rtw_security
@ 2026-10-06 20:07 Pranav Desai
  2026-10-06 20:07 ` [PATCH v2 1/2] staging: rtl8723bs: replace uint with u32 in hal_intf.[ch] Pranav Desai
  2026-10-06 20:07 ` [PATCH v2 2/2] staging: rtl8723bs: replace uint with explicit types in rtw_security.c Pranav Desai
  0 siblings, 2 replies; 5+ messages in thread
From: Pranav Desai @ 2026-10-06 20:07 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Pranav Desai

Per Greg's feedback on v1, I went through the variables to pick
types based on how each is used, rather than doing a blind replace.

I am sending this as a smaller 2-patch series to ensure I am on the
right track before tackling the rest of the driver. If this approach
looks good, I will do the same for the remaining files.

Changes in v2:
- Replaced the driver-wide `uint` to `unsigned int` conversion with
  explicit sizing (u8, u16, u32, bool) based on actual variable usage.
- Scoped down from the entire driver to just hal_intf and rtw_security
  to keep review easy.

Link: https://lore.kernel.org/linux-staging/20261006102846.170825-1-contact.pranavdesai@gmail.com/


Pranav Desai (2):
  staging: rtl8723bs: replace uint with u32 in hal_intf.[ch]
  staging: rtl8723bs: replace uint with explicit types in rtw_security.c

 drivers/staging/rtl8723bs/core/rtw_security.c | 51 +++++++++++--------
 drivers/staging/rtl8723bs/hal/hal_intf.c      |  8 +--
 drivers/staging/rtl8723bs/include/hal_intf.h  |  4 +-
 3 files changed, 36 insertions(+), 27 deletions(-)

-- 
2.55.0


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

* [PATCH v2 1/2] staging: rtl8723bs: replace uint with u32 in hal_intf.[ch]
  2026-10-06 20:07 [PATCH v2 0/2] staging: rtl8723bs: fix uint types in hal_intf and rtw_security Pranav Desai
@ 2026-10-06 20:07 ` Pranav Desai
  2026-10-06 21:07   ` Greg KH
  2026-10-06 20:07 ` [PATCH v2 2/2] staging: rtl8723bs: replace uint with explicit types in rtw_security.c Pranav Desai
  1 sibling, 1 reply; 5+ messages in thread
From: Pranav Desai @ 2026-10-06 20:07 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Pranav Desai

The non-standard 'uint' type was used for the return values of
rtw_hal_init() and rtw_hal_deinit(), as well as their internal
'status' variables.

Since the underlying hardware-specific functions
(rtl8723bs_hal_init() and rtl8723bs_hal_deinit()) explicitly
return u32, replace these 'uint' occurrences with 'u32' to match
the underlying types and conform to the kernel coding style.

Signed-off-by: Pranav Desai <contact.pranavdesai@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_intf.c     | 8 ++++----
 drivers/staging/rtl8723bs/include/hal_intf.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 1443875d1369..1290631a2158 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -27,9 +27,9 @@ static void rtw_hal_init_opmode(struct adapter *padapter)
 	rtw_setopmode_cmd(padapter, networkType, false);
 }
 
-uint rtw_hal_init(struct adapter *padapter)
+u32 rtw_hal_init(struct adapter *padapter)
 {
-	uint status;
+	u32 status;
 	struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
 
 	status = rtl8723bs_hal_init(padapter);
@@ -54,9 +54,9 @@ uint rtw_hal_init(struct adapter *padapter)
 	return status;
 }
 
-uint rtw_hal_deinit(struct adapter *padapter)
+u32 rtw_hal_deinit(struct adapter *padapter)
 {
-	uint status = _SUCCESS;
+	u32 status = _SUCCESS;
 	struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
 
 	status = rtl8723bs_hal_deinit(padapter);
diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h
index 7b63116525ca..ff2a9982a102 100644
--- a/drivers/staging/rtl8723bs/include/hal_intf.h
+++ b/drivers/staging/rtl8723bs/include/hal_intf.h
@@ -175,8 +175,8 @@ typedef s32 (*c2h_id_filter)(u8 *c2h_evt);
 #define	RX_PNOWakeUp			0x55
 #define	AP_WakeUp			0x66
 
-uint rtw_hal_init(struct adapter *padapter);
-uint rtw_hal_deinit(struct adapter *padapter);
+u32 rtw_hal_init(struct adapter *padapter);
+u32 rtw_hal_deinit(struct adapter *padapter);
 void rtw_hal_stop(struct adapter *padapter);
 void rtw_hal_set_hwreg(struct adapter *padapter, u8 variable, u8 *val);
 void rtw_hal_get_hwreg(struct adapter *padapter, u8 variable, u8 *val);
-- 
2.55.0


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

* [PATCH v2 2/2] staging: rtl8723bs: replace uint with explicit types in rtw_security.c
  2026-10-06 20:07 [PATCH v2 0/2] staging: rtl8723bs: fix uint types in hal_intf and rtw_security Pranav Desai
  2026-10-06 20:07 ` [PATCH v2 1/2] staging: rtl8723bs: replace uint with u32 in hal_intf.[ch] Pranav Desai
@ 2026-10-06 20:07 ` Pranav Desai
  2026-10-06 21:06   ` Greg KH
  1 sibling, 1 reply; 5+ messages in thread
From: Pranav Desai @ 2026-10-06 20:07 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Pranav Desai

The non-standard 'uint' type was being used inconsistently for
lengths, boolean flags, and computed values.

Replace 'uint' with explicit types based on their usage:
- Change 'plen' to u32 in both aes_cipher and aes_decipher.
- Change 'hdrlen' to u16 in aes_cipher to match struct pkt_attrib.
- Change 'hdrlen' to u8 in aes_decipher to match struct rx_pkt_attrib.
- Change 'qc_exists' and 'a4_exists' to bool as they are flags.
- Change 'frtype' and 'frsubtype' to u8 because they are masked
  down from 16-bit values and cannot exceed 8-bit values.
- Change 'payload_remainder' to u8 because it is calculated as
  (plen % 16), which guarantees a range of 0-15.
- Change 'payload_index' to u32 because it indexes into the payload,
  which is bounded by plen (u32).
- Change 'num_blocks' to u32 since it is derived from 'plen' (u32).
- Change 'len' and 'ori_len' in rtw_BIP_verify to u32 since they are
  compute values derived from pattrib->pkt_len.
- Change generic loop iterators (i, j) to unsigned int.
- Update helper functions (construct_mic_iv, construct_mic_header1,
  etc.) to match these new explicit parameter types.

No functional change intended.

Signed-off-by: Pranav Desai <contact.pranavdesai@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_security.c | 51 +++++++++++--------
 1 file changed, 30 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 72af46391e23..aeccf89d37b4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -628,12 +628,12 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext)
 /* nonce                                        */
 /************************************************/
 static void construct_mic_iv(u8 *mic_iv,
-			     signed int qc_exists,
-			     signed int a4_exists,
+			     bool qc_exists,
+			     bool a4_exists,
 			     u8 *mpdu,
-			     uint payload_length,
+			     u32 payload_length,
 			     u8 *pn_vector,
-			     uint frtype)
+			     u8 frtype)
 {
 		signed int i;
 
@@ -669,7 +669,7 @@ static void construct_mic_iv(u8 *mic_iv,
 static void construct_mic_header1(u8 *mic_header1,
 				  signed int header_length,
 				  u8 *mpdu,
-				  uint frtype)
+				  u8 frtype)
 {
 		mic_header1[0] = (u8)((header_length - 2) / 256);
 		mic_header1[1] = (u8)((header_length - 2) % 256);
@@ -702,8 +702,8 @@ static void construct_mic_header1(u8 *mic_header1,
 /************************************************/
 static void construct_mic_header2(u8 *mic_header2,
 				  u8 *mpdu,
-				  signed int a4_exists,
-				  signed int qc_exists)
+				  bool a4_exists,
+				  bool qc_exists)
 {
 		signed int i;
 
@@ -752,7 +752,7 @@ static void construct_ctr_preload(u8 *ctr_preload,
 				  u8 *mpdu,
 				  u8 *pn_vector,
 				  signed int c,
-				  uint frtype)
+				  u8 frtype)
 {
 	signed int i = 0;
 
@@ -780,11 +780,14 @@ static void construct_ctr_preload(u8 *ctr_preload,
 	ctr_preload[15] = (unsigned char)(c % 256);
 }
 
-static signed int aes_cipher(u8 *key, uint hdrlen,
-			     u8 *pframe, uint plen)
+static signed int aes_cipher(u8 *key, u16 hdrlen,
+			     u8 *pframe, u32 plen)
 {
-	uint	qc_exists, a4_exists, i, j, payload_remainder,
-		num_blocks, payload_index;
+	unsigned int i, j;
+	bool qc_exists, a4_exists;
+	u8 payload_remainder;
+	u32 payload_index;
+	u32 num_blocks;
 
 	u8 pn_vector[6];
 	u8 mic_iv[16] = {};
@@ -797,8 +800,8 @@ static signed int 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);
+	u8 frtype  = GetFrameType(pframe);
+	u8 frsubtype  = GetFrameSubType(pframe);
 
 	frsubtype = frsubtype >> 4;
 
@@ -980,12 +983,18 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
 	return res;
 }
 
-static signed int aes_decipher(u8 *key, uint hdrlen,
-			       u8 *pframe, uint plen)
+static signed int aes_decipher(u8 *key, u16 hdrlen,
+			       u8 *pframe, u32 plen)
 {
 	static u8 message[MAX_MSG_SIZE];
-	uint qc_exists, a4_exists, i, j, payload_remainder,
-			num_blocks, payload_index;
+
+	unsigned int i, j;
+	u8 payload_remainder;
+	u32 payload_index;
+	u32 num_blocks;
+
+	bool qc_exists, a4_exists;
+
 	signed int res = _SUCCESS;
 	u8 pn_vector[6];
 	u8 mic_iv[16] = {};
@@ -999,8 +1008,8 @@ static signed int aes_decipher(u8 *key, uint hdrlen,
 	u8 padded_buffer[16] = {};
 	u8 mic[8];
 
-	uint frtype  = GetFrameType(pframe);
-	uint frsubtype  = GetFrameSubType(pframe);
+	u8 frtype  = GetFrameType(pframe);
+	u8 frsubtype  = GetFrameSubType(pframe);
 
 	frsubtype = frsubtype >> 4;
 
@@ -1266,7 +1275,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
 	u8 *pframe;
 	u8 *BIP_AAD, *p;
 	u32 res = _FAIL;
-	uint len, ori_len;
+	u32 len, ori_len;
 	struct ieee80211_hdr *pwlanhdr;
 	u8 mic[16];
 	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-- 
2.55.0


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

* Re: [PATCH v2 2/2] staging: rtl8723bs: replace uint with explicit types in rtw_security.c
  2026-10-06 20:07 ` [PATCH v2 2/2] staging: rtl8723bs: replace uint with explicit types in rtw_security.c Pranav Desai
@ 2026-10-06 21:06   ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2026-10-06 21:06 UTC (permalink / raw)
  To: Pranav Desai; +Cc: linux-staging, linux-kernel

On Wed, Oct 07, 2026 at 01:37:51AM +0530, Pranav Desai wrote:
> The non-standard 'uint' type was being used inconsistently for
> lengths, boolean flags, and computed values.
> 
> Replace 'uint' with explicit types based on their usage:
> - Change 'plen' to u32 in both aes_cipher and aes_decipher.
> - Change 'hdrlen' to u16 in aes_cipher to match struct pkt_attrib.
> - Change 'hdrlen' to u8 in aes_decipher to match struct rx_pkt_attrib.
> - Change 'qc_exists' and 'a4_exists' to bool as they are flags.
> - Change 'frtype' and 'frsubtype' to u8 because they are masked
>   down from 16-bit values and cannot exceed 8-bit values.
> - Change 'payload_remainder' to u8 because it is calculated as
>   (plen % 16), which guarantees a range of 0-15.
> - Change 'payload_index' to u32 because it indexes into the payload,
>   which is bounded by plen (u32).
> - Change 'num_blocks' to u32 since it is derived from 'plen' (u32).
> - Change 'len' and 'ori_len' in rtw_BIP_verify to u32 since they are
>   compute values derived from pattrib->pkt_len.
> - Change generic loop iterators (i, j) to unsigned int.
> - Update helper functions (construct_mic_iv, construct_mic_header1,
>   etc.) to match these new explicit parameter types.

Each one of these should be an individual patch, right?

thanks,

greg k-h

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

* Re: [PATCH v2 1/2] staging: rtl8723bs: replace uint with u32 in hal_intf.[ch]
  2026-10-06 20:07 ` [PATCH v2 1/2] staging: rtl8723bs: replace uint with u32 in hal_intf.[ch] Pranav Desai
@ 2026-10-06 21:07   ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2026-10-06 21:07 UTC (permalink / raw)
  To: Pranav Desai; +Cc: linux-staging, linux-kernel

On Wed, Oct 07, 2026 at 01:37:50AM +0530, Pranav Desai wrote:
> The non-standard 'uint' type was used for the return values of
> rtw_hal_init() and rtw_hal_deinit(), as well as their internal
> 'status' variables.
> 
> Since the underlying hardware-specific functions
> (rtl8723bs_hal_init() and rtl8723bs_hal_deinit()) explicitly
> return u32, replace these 'uint' occurrences with 'u32' to match
> the underlying types and conform to the kernel coding style.
> 
> Signed-off-by: Pranav Desai <contact.pranavdesai@gmail.com>
> ---
>  drivers/staging/rtl8723bs/hal/hal_intf.c     | 8 ++++----
>  drivers/staging/rtl8723bs/include/hal_intf.h | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
> index 1443875d1369..1290631a2158 100644
> --- a/drivers/staging/rtl8723bs/hal/hal_intf.c
> +++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
> @@ -27,9 +27,9 @@ static void rtw_hal_init_opmode(struct adapter *padapter)
>  	rtw_setopmode_cmd(padapter, networkType, false);
>  }
>  
> -uint rtw_hal_init(struct adapter *padapter)
> +u32 rtw_hal_init(struct adapter *padapter)

That's very odd, shouldn't this be 'int' and return either 0 for
success, or -ERROR value for an error?

thanks,

greg k-h

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

end of thread, other threads:[~2026-10-06 21:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 20:07 [PATCH v2 0/2] staging: rtl8723bs: fix uint types in hal_intf and rtw_security Pranav Desai
2026-10-06 20:07 ` [PATCH v2 1/2] staging: rtl8723bs: replace uint with u32 in hal_intf.[ch] Pranav Desai
2026-10-06 21:07   ` Greg KH
2026-10-06 20:07 ` [PATCH v2 2/2] staging: rtl8723bs: replace uint with explicit types in rtw_security.c Pranav Desai
2026-10-06 21:06   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®