diff options
| author | Qianfeng Rong <rongqianfeng@vivo.com> | 2025-07-15 20:16:48 +0800 |
|---|---|---|
| committer | Jeff Johnson <jeff.johnson@oss.qualcomm.com> | 2025-07-15 09:17:15 -0700 |
| commit | 5dceb7dc745c755d61e01ae4d214a800025044fd (patch) | |
| tree | 2250e92d02bd7348accca04bb9d036b4590ff00a | |
| parent | 8ac2a383d4ce9e6229494c2a36df876800e6750e (diff) | |
| download | linux-5dceb7dc745c755d61e01ae4d214a800025044fd.tar.gz linux-5dceb7dc745c755d61e01ae4d214a800025044fd.zip | |
wifi: ath5k: Use max() to improve code
Use max() to reduce the code and improve its readability.
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://patch.msgid.link/20250715121721.266713-3-rongqianfeng@vivo.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
| -rw-r--r-- | drivers/net/wireless/ath/ath5k/phy.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 4825f9cb9cb8..66b2dee39155 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c @@ -3116,10 +3116,7 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah, pd_gain_overlap; /* Force each power step to be at least 0.5 dB */ - if ((pdadc_tmp[1] - pdadc_tmp[0]) > 1) - pwr_step = pdadc_tmp[1] - pdadc_tmp[0]; - else - pwr_step = 1; + pwr_step = max(pdadc_tmp[1] - pdadc_tmp[0], 1); /* If pdadc_0 is negative, we need to extrapolate * below this pdgain by a number of pwr_steps */ @@ -3144,11 +3141,8 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah, continue; /* Force each power step to be at least 0.5 dB */ - if ((pdadc_tmp[table_size - 1] - pdadc_tmp[table_size - 2]) > 1) - pwr_step = pdadc_tmp[table_size - 1] - - pdadc_tmp[table_size - 2]; - else - pwr_step = 1; + pwr_step = max(pdadc_tmp[table_size - 1] - + pdadc_tmp[table_size - 2], 1); /* Extrapolate above */ while ((pdadc_0 < (s16) pdadc_n) && |
