mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wifi: rtw89: 8852bt: Simplify unnecessary if-else conditions
@ 2025-08-18  6:42 Liao Yuanhong
  2025-08-19  1:30 ` Ping-Ke Shih
  2025-08-24  0:39 ` Julian Calaby
  0 siblings, 2 replies; 3+ messages in thread
From: Liao Yuanhong @ 2025-08-18  6:42 UTC (permalink / raw)
  To: Ping-Ke Shih, open list:REALTEK WIRELESS DRIVER (rtw89), open list
  Cc: Liao Yuanhong

Some simple if-else logic can be simplified using the ! operator to improve
code readability.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c
index d0e299803225..164ee0fde03b 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c
@@ -1803,10 +1803,7 @@ static void _dpk_onoff(struct rtw89_dev *rtwdev, enum rtw89_rf_path path, bool o
 
 	val = dpk->is_dpk_enable && !off && dpk->bp[path][kidx].path_ok;
 
-	if (off)
-		off_reverse = false;
-	else
-		off_reverse = true;
+	off_reverse = !off;
 
 	val = dpk->is_dpk_enable & off_reverse & dpk->bp[path][kidx].path_ok;
 
-- 
2.34.1


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

* Re: [PATCH] wifi: rtw89: 8852bt: Simplify unnecessary if-else conditions
  2025-08-18  6:42 [PATCH] wifi: rtw89: 8852bt: Simplify unnecessary if-else conditions Liao Yuanhong
@ 2025-08-19  1:30 ` Ping-Ke Shih
  2025-08-24  0:39 ` Julian Calaby
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2025-08-19  1:30 UTC (permalink / raw)
  To: Liao Yuanhong, Ping-Ke Shih,
	open list:REALTEK WIRELESS DRIVER (rtw89),
	open list
  Cc: Liao Yuanhong

Liao Yuanhong <liaoyuanhong@vivo.com> wrote:

> Some simple if-else logic can be simplified using the ! operator to improve
> code readability.
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

33319e8fd7ac wifi: rtw89: 8852bt: Simplify unnecessary if-else conditions in _dpk_onoff()

---
https://github.com/pkshih/rtw.git


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

* Re: [PATCH] wifi: rtw89: 8852bt: Simplify unnecessary if-else conditions
  2025-08-18  6:42 [PATCH] wifi: rtw89: 8852bt: Simplify unnecessary if-else conditions Liao Yuanhong
  2025-08-19  1:30 ` Ping-Ke Shih
@ 2025-08-24  0:39 ` Julian Calaby
  1 sibling, 0 replies; 3+ messages in thread
From: Julian Calaby @ 2025-08-24  0:39 UTC (permalink / raw)
  To: Liao Yuanhong
  Cc: Ping-Ke Shih, open list:REALTEK WIRELESS DRIVER (rtw89), open list

Hi Liao,

On Mon, Aug 18, 2025 at 4:44 PM Liao Yuanhong <liaoyuanhong@vivo.com> wrote:
>
> Some simple if-else logic can be simplified using the ! operator to improve
> code readability.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
>  drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c
> index d0e299803225..164ee0fde03b 100644
> --- a/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c
> +++ b/drivers/net/wireless/realtek/rtw89/rtw8852bt_rfk.c
> @@ -1803,10 +1803,7 @@ static void _dpk_onoff(struct rtw89_dev *rtwdev, enum rtw89_rf_path path, bool o
>
>         val = dpk->is_dpk_enable && !off && dpk->bp[path][kidx].path_ok;

Is this line ^^^

>
> -       if (off)
> -               off_reverse = false;
> -       else
> -               off_reverse = true;
> +       off_reverse = !off;
>
>         val = dpk->is_dpk_enable & off_reverse & dpk->bp[path][kidx].path_ok;

The same as this line ^^^

and if so, can we just delete the second one? Also, can we also then
delete the "off_reverse" variable?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

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

end of thread, other threads:[~2025-08-24  0:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-18  6:42 [PATCH] wifi: rtw89: 8852bt: Simplify unnecessary if-else conditions Liao Yuanhong
2025-08-19  1:30 ` Ping-Ke Shih
2025-08-24  0:39 ` Julian Calaby

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®