The clamp() macro explicitly expresses the intent of constraining a value
within bounds. Therefore, replacing max(min(a,b),c) with clamp(val, lo, hi)
can improve code readability.
Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
drivers/mmc/core/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 874c6fe92855..31691ba5abe6 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2308,7 +2308,7 @@ void mmc_start_host(struct mmc_host *host)
bool power_up = !(host->caps2 &
(MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_SD_UHS2));
- host->f_init = max(min(freqs[0], host->f_max), host->f_min);
+ host->f_init = clamp(freqs[0], host->f_min, host->f_max);
host->rescan_disable = 0;
if (power_up) {
--
2.34.1