linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k: use swap() to make code cleaner
@ 2022-02-15  0:52 davidcomponentone
  2022-02-15  6:20 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: davidcomponentone @ 2022-02-15  0:52 UTC (permalink / raw)
  To: toke
  Cc: davidcomponentone, kvalo, davem, kuba, linux-wireless, netdev,
	linux-kernel, Yang Guang, Zeal Robot

From: Yang Guang <yang.guang5@zte.com.cn>

Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
 drivers/net/wireless/ath/ath9k/calib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index 0422a33395b7..daf88330e13b 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -33,9 +33,7 @@ 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;
+				swap(sort[j], sort[j - 1]);
 			}
 		}
 	}
-- 
2.30.2


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

* Re: [PATCH] ath9k: use swap() to make code cleaner
  2022-02-15  0:52 [PATCH] ath9k: use swap() to make code cleaner davidcomponentone
@ 2022-02-15  6:20 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2022-02-15  6:20 UTC (permalink / raw)
  To: davidcomponentone
  Cc: toke, davem, kuba, linux-wireless, netdev, linux-kernel,
	Yang Guang, Zeal Robot

davidcomponentone@gmail.com writes:

> From: Yang Guang <yang.guang5@zte.com.cn>
>
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.

Liki Jiri mentioned in the ath5k patch, shouldn't you include that file?

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

end of thread, other threads:[~2022-02-15  6:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15  0:52 [PATCH] ath9k: use swap() to make code cleaner davidcomponentone
2022-02-15  6:20 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).