* [PATCH] ath9k_hw: use swap() to make code cleaner
@ 2021-10-28 1:04 Yang Guang
2021-11-01 14:20 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Yang Guang @ 2021-10-28 1:04 UTC (permalink / raw)
To: ath9k-devel, Kalle Valo, David S. Miller, Jakub Kicinski
Cc: Yang Guang, Zeal Robot, linux-wireless, netdev, linux-kernel
Using swap() make it more readable.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
drivers/net/wireless/ath/ath9k/ar9003_calib.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 7e27a06e5df1..dc24da1ff00b 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -1005,24 +1005,20 @@ static void __ar955x_tx_iq_cal_sort(struct ath_hw *ah,
int i, int nmeasurement)
{
struct ath_common *common = ath9k_hw_common(ah);
- int im, ix, iy, temp;
+ int im, ix, iy;
for (im = 0; im < nmeasurement; im++) {
for (ix = 0; ix < MAXIQCAL - 1; ix++) {
for (iy = ix + 1; iy <= MAXIQCAL - 1; iy++) {
if (coeff->mag_coeff[i][im][iy] <
coeff->mag_coeff[i][im][ix]) {
- temp = coeff->mag_coeff[i][im][ix];
- coeff->mag_coeff[i][im][ix] =
- coeff->mag_coeff[i][im][iy];
- coeff->mag_coeff[i][im][iy] = temp;
+ swap(coeff->mag_coeff[i][im][ix],
+ coeff->mag_coeff[i][im][iy]);
}
if (coeff->phs_coeff[i][im][iy] <
coeff->phs_coeff[i][im][ix]) {
- temp = coeff->phs_coeff[i][im][ix];
- coeff->phs_coeff[i][im][ix] =
- coeff->phs_coeff[i][im][iy];
- coeff->phs_coeff[i][im][iy] = temp;
+ swap(coeff->phs_coeff[i][im][ix],
+ coeff->phs_coeff[i][im][iy]);
}
}
}
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ath9k_hw: use swap() to make code cleaner
2021-10-28 1:04 [PATCH] ath9k_hw: use swap() to make code cleaner Yang Guang
@ 2021-11-01 14:20 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2021-11-01 14:20 UTC (permalink / raw)
To: Yang Guang
Cc: ath9k-devel, David S. Miller, Jakub Kicinski, Yang Guang,
Zeal Robot, linux-wireless, netdev, linux-kernel
Yang Guang <cgel.zte@gmail.com> wrote:
> Using swap() make it more readable.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
22f9ba7fee10 ath9k: use swap() to make code cleaner
--
https://patchwork.kernel.org/project/linux-wireless/patch/20211028010451.7754-1-yang.guang5@zte.com.cn/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-01 14:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 1:04 [PATCH] ath9k_hw: use swap() to make code cleaner Yang Guang
2021-11-01 14: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
all inboxes | Powered by JetHome®