[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250818073827.474226-1-zhao.xichao@vivo.com>
Date: Mon, 18 Aug 2025 15:38:27 +0800
From: Xichao Zhao <zhao.xichao@...o.com>
To: ulf.hansson@...aro.org
Cc: linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Xichao Zhao <zhao.xichao@...o.com>
Subject: [PATCH] mmc: core: replace min/max nesting with clamp()
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@...o.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
Powered by blists - more mailing lists