Skip to contentSkip to conversation

ath9k: dfs: use swap macro in ath9k_check_chirping

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Nov 3, 2017 – Dec 2, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: dfs: use swap macro in ath9k_check_chirping

Make use of the swap macro and remove unnecessary variable temp. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

---
 drivers/net/wireless/ath/ath9k/dfs.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/dfs.c +3 -5
index 40a397f..6fee9a4 100644
@@ -123,11 +123,9 @@ static bool ath9k_check_chirping(struct ath_softc *sc, u8 *data,
 			fft = (struct ath9k_dfs_fft_40 *) (data + 2);
 			ath_dbg(common, DFS, "fixing datalen by 2\n");
 		}
-		if (IS_CHAN_HT40MINUS(ah->curchan)) {
-			int temp = is_ctl;
-			is_ctl = is_ext;
-			is_ext = temp;
-		}
+		if (IS_CHAN_HT40MINUS(ah->curchan))
+			swap(is_ctl, is_ext);
+
 		for (i = 0; i < FFT_NUM_SAMPLES; i++)
 			max_bin[i] = ath9k_get_max_index_ht40(fft + i, is_ctl,
 							      is_ext);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 7 lines · Gustavo A. R. Silva

Make use of the swap macro and remove unnecessary variable temp. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

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

626ab6707abe ath9k: dfs: use swap macro in ath9k_check_chirping

Signature · 3 lines
https://patchwork.kernel.org/patch/10041197/

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