public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: rtl8723bs: Code cleanup patches
@ 2025-04-02 12:47 Erick Karanja
  2025-04-02 12:47 ` [PATCH 1/3] staging: rtl8723bs: Use true/false instead of 1/0 Erick Karanja
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Erick Karanja @ 2025-04-02 12:47 UTC (permalink / raw)
  To: gregkh, outreachy
  Cc: karanja99erick, philipp.g.hortmann, linux-staging, linux-kernel



This patchset refactors the rtl8723bs driver by replacing
integer literals (1 and 0) with true and false,
improving code readability and consistency with standard kernel practices.
The transformation was performed using Coccinelle.

below is the coccinelle script used:
@initialize:ocaml@
@@

let same_function p q =
  (List.hd p).Coccilib.current_element = (List.hd q).Coccilib.current_element

@r@
expression e;
position p;
symbol true,false;
@@

e =@p \(true\|false\)

@@
expression r.e;
position q : script:ocaml(r.p) { same_function p q };
@@

e =@q
(
- 1
+ true
|
- 0
+ false
)

@s@
type T;
T e;
identifier fld;
symbol true,false;
@@

e.fld = \(true\|false\)

@@
type s.T;
T e;
identifier s.fld;
@@

e.fld =
(
- 1
+ true
|
- 0
+ false
)

Erick Karanja (3):
  staging: rtl8723bs: Use true/false instead of 1/0
  staging: rtl8723bs: Use true/false instead of 1/0
  staging: rtl8723bs: Use true/false instead of 1/0

 drivers/staging/rtl8723bs/core/rtw_ap.c       | 12 ++++++------
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c |  4 ++--
 drivers/staging/rtl8723bs/core/rtw_recv.c     |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.43.0


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

* [PATCH 1/3] staging: rtl8723bs: Use true/false instead of 1/0
  2025-04-02 12:47 [PATCH 0/3] staging: rtl8723bs: Code cleanup patches Erick Karanja
@ 2025-04-02 12:47 ` Erick Karanja
  2025-04-02 12:54   ` Julia Lawall
  2025-04-02 12:47 ` [PATCH 2/3] " Erick Karanja
  2025-04-02 12:47 ` [PATCH 3/3] " Erick Karanja
  2 siblings, 1 reply; 7+ messages in thread
From: Erick Karanja @ 2025-04-02 12:47 UTC (permalink / raw)
  To: gregkh, outreachy
  Cc: karanja99erick, philipp.g.hortmann, linux-staging, linux-kernel

Standardize boolean representation by replacing 1/0
with true/false in cases where boolean logic is implied.
This improves code clarity and aligns with the kernel’s bool type usage.

Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index d46a04b9a05e..199727f04516 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -386,10 +386,10 @@ void update_bmc_sta(struct adapter *padapter)
 
 		pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
 
-		psta->qos_option = 0;
+		psta->qos_option = false;
 		psta->htpriv.ht_option = false;
 
-		psta->ieee8021x_blocked = 0;
+		psta->ieee8021x_blocked = false;
 
 		memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
 
@@ -1967,17 +1967,17 @@ void sta_info_update(struct adapter *padapter, struct sta_info *psta)
 
 	/* update wmm cap. */
 	if (WLAN_STA_WME & flags)
-		psta->qos_option = 1;
+		psta->qos_option = true;
 	else
-		psta->qos_option = 0;
+		psta->qos_option = false;
 
 	if (pmlmepriv->qospriv.qos_option == 0)
-		psta->qos_option = 0;
+		psta->qos_option = false;
 
 	/* update 802.11n ht cap. */
 	if (WLAN_STA_HT & flags) {
 		psta->htpriv.ht_option = true;
-		psta->qos_option = 1;
+		psta->qos_option = true;
 	} else {
 		psta->htpriv.ht_option = false;
 	}
-- 
2.43.0


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

* [PATCH 2/3] staging: rtl8723bs: Use true/false instead of 1/0
  2025-04-02 12:47 [PATCH 0/3] staging: rtl8723bs: Code cleanup patches Erick Karanja
  2025-04-02 12:47 ` [PATCH 1/3] staging: rtl8723bs: Use true/false instead of 1/0 Erick Karanja
@ 2025-04-02 12:47 ` Erick Karanja
  2025-04-02 12:54   ` Julia Lawall
  2025-04-02 12:47 ` [PATCH 3/3] " Erick Karanja
  2 siblings, 1 reply; 7+ messages in thread
From: Erick Karanja @ 2025-04-02 12:47 UTC (permalink / raw)
  To: gregkh, outreachy
  Cc: karanja99erick, philipp.g.hortmann, linux-staging, linux-kernel

Standardize boolean representation by replacing 1/0
with true/false in cases where boolean logic is implied.
This improves code clarity and aligns with the kernel’s bool type usage.

Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 952ce6dd5af9..8f2c9c3e853c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1173,7 +1173,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
 
 	/*  check if there is WMM IE & support WWM-PS */
 	pstat->flags &= ~WLAN_STA_WME;
-	pstat->qos_option = 0;
+	pstat->qos_option = false;
 	pstat->qos_info = 0;
 	pstat->has_legacy_ac = true;
 	pstat->uapsd_vo = 0;
@@ -1189,7 +1189,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
 
 					pstat->flags |= WLAN_STA_WME;
 
-					pstat->qos_option = 1;
+					pstat->qos_option = true;
 					pstat->qos_info = *(p+8);
 
 					pstat->max_sp_len = (pstat->qos_info>>5)&0x3;
-- 
2.43.0


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

* [PATCH 3/3] staging: rtl8723bs: Use true/false instead of 1/0
  2025-04-02 12:47 [PATCH 0/3] staging: rtl8723bs: Code cleanup patches Erick Karanja
  2025-04-02 12:47 ` [PATCH 1/3] staging: rtl8723bs: Use true/false instead of 1/0 Erick Karanja
  2025-04-02 12:47 ` [PATCH 2/3] " Erick Karanja
@ 2025-04-02 12:47 ` Erick Karanja
  2025-04-02 12:55   ` Julia Lawall
  2 siblings, 1 reply; 7+ messages in thread
From: Erick Karanja @ 2025-04-02 12:47 UTC (permalink / raw)
  To: gregkh, outreachy
  Cc: karanja99erick, philipp.g.hortmann, linux-staging, linux-kernel

    standardize boolean representation by replacing 1/0
    with true/false in cases where boolean logic is implied.
    This improves code clarity and aligns with the kernel’s bool type usage.

Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index a389ba5ecc6f..fd04dbacb50f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1358,7 +1358,7 @@ static signed int validate_80211w_mgmt(struct adapter *adapter, union recv_frame
 			u8 *mgmt_DATA;
 			u32 data_len = 0;
 
-			pattrib->bdecrypted = 0;
+			pattrib->bdecrypted = false;
 			pattrib->encrypt = _AES_;
 			pattrib->hdrlen = sizeof(struct ieee80211_hdr_3addr);
 			/* set iv and icv length */
-- 
2.43.0


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

* Re: [PATCH 1/3] staging: rtl8723bs: Use true/false instead of 1/0
  2025-04-02 12:47 ` [PATCH 1/3] staging: rtl8723bs: Use true/false instead of 1/0 Erick Karanja
@ 2025-04-02 12:54   ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2025-04-02 12:54 UTC (permalink / raw)
  To: Erick Karanja
  Cc: gregkh, outreachy, philipp.g.hortmann, linux-staging,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

You have three patches with the same subject line, which is not allowed.
You can be more specific about the files name or the structure name and
field.

julia

On Wed, 2 Apr 2025, Erick Karanja wrote:

> Standardize boolean representation by replacing 1/0
> with true/false in cases where boolean logic is implied.
> This improves code clarity and aligns with the kernel’s bool type usage.
>
> Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_ap.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
> index d46a04b9a05e..199727f04516 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_ap.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
> @@ -386,10 +386,10 @@ void update_bmc_sta(struct adapter *padapter)
>
>  		pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
>
> -		psta->qos_option = 0;
> +		psta->qos_option = false;
>  		psta->htpriv.ht_option = false;
>
> -		psta->ieee8021x_blocked = 0;
> +		psta->ieee8021x_blocked = false;
>
>  		memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
>
> @@ -1967,17 +1967,17 @@ void sta_info_update(struct adapter *padapter, struct sta_info *psta)
>
>  	/* update wmm cap. */
>  	if (WLAN_STA_WME & flags)
> -		psta->qos_option = 1;
> +		psta->qos_option = true;
>  	else
> -		psta->qos_option = 0;
> +		psta->qos_option = false;
>
>  	if (pmlmepriv->qospriv.qos_option == 0)
> -		psta->qos_option = 0;
> +		psta->qos_option = false;
>
>  	/* update 802.11n ht cap. */
>  	if (WLAN_STA_HT & flags) {
>  		psta->htpriv.ht_option = true;
> -		psta->qos_option = 1;
> +		psta->qos_option = true;
>  	} else {
>  		psta->htpriv.ht_option = false;
>  	}
> --
> 2.43.0
>
>
>

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

* Re: [PATCH 2/3] staging: rtl8723bs: Use true/false instead of 1/0
  2025-04-02 12:47 ` [PATCH 2/3] " Erick Karanja
@ 2025-04-02 12:54   ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2025-04-02 12:54 UTC (permalink / raw)
  To: Erick Karanja
  Cc: gregkh, outreachy, philipp.g.hortmann, linux-staging,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]



On Wed, 2 Apr 2025, Erick Karanja wrote:

> Standardize boolean representation by replacing 1/0
> with true/false in cases where boolean logic is implied.
> This improves code clarity and aligns with the kernel’s bool type usage.

It would be nice to point out that true/false is used elsewhere in this
file for this structure field.  We can't see this in the patch.

julia

>
> Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> index 952ce6dd5af9..8f2c9c3e853c 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> @@ -1173,7 +1173,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
>
>  	/*  check if there is WMM IE & support WWM-PS */
>  	pstat->flags &= ~WLAN_STA_WME;
> -	pstat->qos_option = 0;
> +	pstat->qos_option = false;
>  	pstat->qos_info = 0;
>  	pstat->has_legacy_ac = true;
>  	pstat->uapsd_vo = 0;
> @@ -1189,7 +1189,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
>
>  					pstat->flags |= WLAN_STA_WME;
>
> -					pstat->qos_option = 1;
> +					pstat->qos_option = true;
>  					pstat->qos_info = *(p+8);
>
>  					pstat->max_sp_len = (pstat->qos_info>>5)&0x3;
> --
> 2.43.0
>
>
>

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

* Re: [PATCH 3/3] staging: rtl8723bs: Use true/false instead of 1/0
  2025-04-02 12:47 ` [PATCH 3/3] " Erick Karanja
@ 2025-04-02 12:55   ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2025-04-02 12:55 UTC (permalink / raw)
  To: Erick Karanja
  Cc: gregkh, outreachy, philipp.g.hortmann, linux-staging,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]



On Wed, 2 Apr 2025, Erick Karanja wrote:

>     standardize boolean representation by replacing 1/0

Start with a capital letter.  And why is the message indented?

julia

>     with true/false in cases where boolean logic is implied.
>     This improves code clarity and aligns with the kernel’s bool type usage.
>
> Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_recv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
> index a389ba5ecc6f..fd04dbacb50f 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
> @@ -1358,7 +1358,7 @@ static signed int validate_80211w_mgmt(struct adapter *adapter, union recv_frame
>  			u8 *mgmt_DATA;
>  			u32 data_len = 0;
>
> -			pattrib->bdecrypted = 0;
> +			pattrib->bdecrypted = false;
>  			pattrib->encrypt = _AES_;
>  			pattrib->hdrlen = sizeof(struct ieee80211_hdr_3addr);
>  			/* set iv and icv length */
> --
> 2.43.0
>
>
>

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

end of thread, other threads:[~2025-04-02 12:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 12:47 [PATCH 0/3] staging: rtl8723bs: Code cleanup patches Erick Karanja
2025-04-02 12:47 ` [PATCH 1/3] staging: rtl8723bs: Use true/false instead of 1/0 Erick Karanja
2025-04-02 12:54   ` Julia Lawall
2025-04-02 12:47 ` [PATCH 2/3] " Erick Karanja
2025-04-02 12:54   ` Julia Lawall
2025-04-02 12:47 ` [PATCH 3/3] " Erick Karanja
2025-04-02 12:55   ` Julia Lawall

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