mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wifi: rtl8xxxu: Use swap() to improve rtl8xxxu_switch_ports()
@ 2024-07-10 19:00 Thorsten Blum
  2024-07-11  0:20 ` Ping-Ke Shih
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-07-10 19:00 UTC (permalink / raw)
  To: Jes.Sorensen, kvalo; +Cc: linux-wireless, linux-kernel, Thorsten Blum

Use the swap() macro to simplify the rtl8xxxu_switch_ports() function
and improve its readability. Remove the local variable vif.

Fixes the following Coccinelle/coccicheck warning reported by
swap.cocci:

  WARNING opportunity for swap()

Compile-tested only.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 drivers/net/wireless/realtek/rtl8xxxu/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 89a841b4e8d5..489574668772 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -6679,7 +6679,6 @@ static void rtl8xxxu_switch_ports(struct rtl8xxxu_priv *priv)
 	u8 macid[ETH_ALEN], bssid[ETH_ALEN], macid_1[ETH_ALEN], bssid_1[ETH_ALEN];
 	u8 msr, bcn_ctrl, bcn_ctrl_1, atimwnd[2], atimwnd_1[2];
 	struct rtl8xxxu_vif *rtlvif;
-	struct ieee80211_vif *vif;
 	u8 tsftr[8], tsftr_1[8];
 	int i;
 
@@ -6745,9 +6744,7 @@ static void rtl8xxxu_switch_ports(struct rtl8xxxu_priv *priv)
 	rtl8xxxu_write8(priv, REG_BEACON_CTRL, bcn_ctrl_1);
 	rtl8xxxu_write8(priv, REG_BEACON_CTRL_1, bcn_ctrl);
 
-	vif = priv->vifs[0];
-	priv->vifs[0] = priv->vifs[1];
-	priv->vifs[1] = vif;
+	swap(priv->vifs[0], priv->vifs[1]);
 
 	/* priv->vifs[0] is NULL here, based on how this function is currently
 	 * called from rtl8xxxu_add_interface().
-- 
2.45.2


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

* RE: [PATCH] wifi: rtl8xxxu: Use swap() to improve rtl8xxxu_switch_ports()
  2024-07-10 19:00 [PATCH] wifi: rtl8xxxu: Use swap() to improve rtl8xxxu_switch_ports() Thorsten Blum
@ 2024-07-11  0:20 ` Ping-Ke Shih
  0 siblings, 0 replies; 2+ messages in thread
From: Ping-Ke Shih @ 2024-07-11  0:20 UTC (permalink / raw)
  To: Thorsten Blum, Jes.Sorensen, kvalo; +Cc: linux-wireless, linux-kernel

Thorsten Blum <thorsten.blum@toblux.com> wrote:
> Use the swap() macro to simplify the rtl8xxxu_switch_ports() function
> and improve its readability. Remove the local variable vif.
> 
> Fixes the following Coccinelle/coccicheck warning reported by
> swap.cocci:
> 
>   WARNING opportunity for swap()
> 
> Compile-tested only.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>

The same patch [1] has been applied. 

[1] https://patch.msgid.link/20240619024017.53246-1-jiapeng.chong@linux.alibaba.com


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

end of thread, other threads:[~2024-07-11  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-10 19:00 [PATCH] wifi: rtl8xxxu: Use swap() to improve rtl8xxxu_switch_ports() Thorsten Blum
2024-07-11  0:20 ` Ping-Ke Shih

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®