public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: ath9k: Use swap() to improve ath9k_hw_get_nf_hist_mid()
@ 2024-07-10 18:57 Thorsten Blum
  2024-07-10 21:33 ` Toke Høiland-Jørgensen
  2024-08-01 14:59 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2024-07-10 18:57 UTC (permalink / raw)
  To: toke, kvalo; +Cc: linux-wireless, linux-kernel, Thorsten Blum

Use the swap() macro to simplify the ath9k_hw_get_nf_hist_mid() function
and improve its readability.

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/ath/ath9k/calib.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index fb270df75eb2..4b331c85509c 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -32,11 +32,8 @@ static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer)
 
 	for (i = 0; i < ATH9K_NF_CAL_HIST_MAX - 1; i++) {
 		for (j = 1; j < ATH9K_NF_CAL_HIST_MAX - i; j++) {
-			if (sort[j] > sort[j - 1]) {
-				nfval = sort[j];
-				sort[j] = sort[j - 1];
-				sort[j - 1] = nfval;
-			}
+			if (sort[j] > sort[j - 1])
+				swap(sort[j], sort[j - 1]);
 		}
 	}
 	nfval = sort[(ATH9K_NF_CAL_HIST_MAX - 1) >> 1];
-- 
2.45.2


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

* Re: [PATCH] wifi: ath9k: Use swap() to improve ath9k_hw_get_nf_hist_mid()
  2024-07-10 18:57 [PATCH] wifi: ath9k: Use swap() to improve ath9k_hw_get_nf_hist_mid() Thorsten Blum
@ 2024-07-10 21:33 ` Toke Høiland-Jørgensen
  2024-08-01 14:59 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-07-10 21:33 UTC (permalink / raw)
  To: Thorsten Blum, kvalo; +Cc: linux-wireless, linux-kernel, Thorsten Blum

Thorsten Blum <thorsten.blum@toblux.com> writes:

> Use the swap() macro to simplify the ath9k_hw_get_nf_hist_mid() function
> and improve its readability.
>
> 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>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>

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

* Re: [PATCH] wifi: ath9k: Use swap() to improve ath9k_hw_get_nf_hist_mid()
  2024-07-10 18:57 [PATCH] wifi: ath9k: Use swap() to improve ath9k_hw_get_nf_hist_mid() Thorsten Blum
  2024-07-10 21:33 ` Toke Høiland-Jørgensen
@ 2024-08-01 14:59 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2024-08-01 14:59 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: toke, linux-wireless, linux-kernel, Thorsten Blum

Thorsten Blum <thorsten.blum@toblux.com> wrote:

> Use the swap() macro to simplify the ath9k_hw_get_nf_hist_mid() function
> and improve its readability.
> 
> 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>
> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

215a19631d11 wifi: ath9k: Use swap() to improve ath9k_hw_get_nf_hist_mid()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20240710185743.709742-2-thorsten.blum@toblux.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2024-08-01 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10 18:57 [PATCH] wifi: ath9k: Use swap() to improve ath9k_hw_get_nf_hist_mid() Thorsten Blum
2024-07-10 21:33 ` Toke Høiland-Jørgensen
2024-08-01 14:59 ` Kalle Valo

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