* [PATCH -next] ath9k: use clamp() in ar9003_aic_cal_post_process()
@ 2024-08-30 1:18 Li Zetao
2024-09-05 16:21 ` Toke Høiland-Jørgensen
2024-09-14 11:46 ` Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Li Zetao @ 2024-08-30 1:18 UTC (permalink / raw)
To: toke, kvalo; +Cc: lizetao1, linux-wireless
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 <lizetao1@huawei.com>
---
drivers/net/wireless/ath/ath9k/ar9003_aic.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_aic.c b/drivers/net/wireless/ath/ath9k/ar9003_aic.c
index d0f1e8bcc846..45a7ca660f47 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_aic.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_aic.c
@@ -409,13 +409,11 @@ static bool ar9003_aic_cal_post_process(struct ath_hw *ah)
sram.valid = true;
sram.rot_dir_att_db =
- min(max(rot_dir_path_att_db,
- (int16_t)ATH_AIC_MIN_ROT_DIR_ATT_DB),
- ATH_AIC_MAX_ROT_DIR_ATT_DB);
+ clamp(rot_dir_path_att_db, (int16_t)ATH_AIC_MIN_ROT_DIR_ATT_DB,
+ ATH_AIC_MAX_ROT_DIR_ATT_DB);
sram.rot_quad_att_db =
- min(max(rot_quad_path_att_db,
- (int16_t)ATH_AIC_MIN_ROT_QUAD_ATT_DB),
- ATH_AIC_MAX_ROT_QUAD_ATT_DB);
+ clamp(rot_quad_path_att_db, (int16_t)ATH_AIC_MIN_ROT_QUAD_ATT_DB,
+ ATH_AIC_MAX_ROT_QUAD_ATT_DB);
aic->aic_sram[i] = (SM(sram.vga_dir_sign,
AR_PHY_AIC_SRAM_VGA_DIR_SIGN) |
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] ath9k: use clamp() in ar9003_aic_cal_post_process()
2024-08-30 1:18 [PATCH -next] ath9k: use clamp() in ar9003_aic_cal_post_process() Li Zetao
@ 2024-09-05 16:21 ` Toke Høiland-Jørgensen
2024-09-14 11:46 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-09-05 16:21 UTC (permalink / raw)
To: Li Zetao, kvalo; +Cc: lizetao1, linux-wireless
Li Zetao <lizetao1@huawei.com> writes:
> 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 <lizetao1@huawei.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] ath9k: use clamp() in ar9003_aic_cal_post_process()
2024-08-30 1:18 [PATCH -next] ath9k: use clamp() in ar9003_aic_cal_post_process() Li Zetao
2024-09-05 16:21 ` Toke Høiland-Jørgensen
@ 2024-09-14 11:46 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2024-09-14 11:46 UTC (permalink / raw)
To: Li Zetao; +Cc: toke, lizetao1, linux-wireless
Li Zetao <lizetao1@huawei.com> wrote:
> 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 <lizetao1@huawei.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.
1d66430cc9af wifi: ath9k: use clamp() in ar9003_aic_cal_post_process()
--
https://patchwork.kernel.org/project/linux-wireless/patch/20240830011858.603514-1-lizetao1@huawei.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
https://docs.kernel.org/process/submitting-patches.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-14 11:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-30 1:18 [PATCH -next] ath9k: use clamp() in ar9003_aic_cal_post_process() Li Zetao
2024-09-05 16:21 ` Toke Høiland-Jørgensen
2024-09-14 11:46 ` Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.