Skip to content

Commit 1d66430

Browse files
Li Zetaokvalo
Li Zetao
authored andcommitted
wifi: ath9k: use clamp() in ar9003_aic_cal_post_process()
When it needs to get a value within a certain interval, using clamp() makes the code easier to understand than min(max()). Signed-off-by: Li Zetao <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 34c44eb commit 1d66430

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/net/wireless/ath/ath9k/ar9003_aic.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,11 @@ static bool ar9003_aic_cal_post_process(struct ath_hw *ah)
409409
sram.valid = true;
410410

411411
sram.rot_dir_att_db =
412-
min(max(rot_dir_path_att_db,
413-
(int16_t)ATH_AIC_MIN_ROT_DIR_ATT_DB),
414-
ATH_AIC_MAX_ROT_DIR_ATT_DB);
412+
clamp(rot_dir_path_att_db, (int16_t)ATH_AIC_MIN_ROT_DIR_ATT_DB,
413+
ATH_AIC_MAX_ROT_DIR_ATT_DB);
415414
sram.rot_quad_att_db =
416-
min(max(rot_quad_path_att_db,
417-
(int16_t)ATH_AIC_MIN_ROT_QUAD_ATT_DB),
418-
ATH_AIC_MAX_ROT_QUAD_ATT_DB);
415+
clamp(rot_quad_path_att_db, (int16_t)ATH_AIC_MIN_ROT_QUAD_ATT_DB,
416+
ATH_AIC_MAX_ROT_QUAD_ATT_DB);
419417

420418
aic->aic_sram[i] = (SM(sram.vga_dir_sign,
421419
AR_PHY_AIC_SRAM_VGA_DIR_SIGN) |

0 commit comments

Comments
 (0)