From: Thorsten Blum <thorsten.blum@linux.dev>
To: Robert Richter <rric@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
Huacai Chen <chenhuacai@kernel.org>,
Binbin Zhou <zhoubinbin@loongson.cn>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mmc: cavium: Use clamp to simplify cvm_mmc_set_clock
Date: Mon, 22 Dec 2025 11:03:33 +0100 [thread overview]
Message-ID: <20251222100338.634144-1-thorsten.blum@linux.dev> (raw)
Use clamp() to simplify cvm_mmc_set_clock() and improve its readability.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/mmc/host/cavium.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
index 9a55db0e657c..37a88f2a0c86 100644
--- a/drivers/mmc/host/cavium.c
+++ b/drivers/mmc/host/cavium.c
@@ -905,9 +905,7 @@ static void cvm_mmc_set_clock(struct cvm_mmc_slot *slot, unsigned int clock)
{
struct mmc_host *mmc = slot->mmc;
- clock = min(clock, mmc->f_max);
- clock = max(clock, mmc->f_min);
- slot->clock = clock;
+ slot->clock = clamp(clock, mmc->f_min, mmc->f_max);
}
static int cvm_mmc_init_lowlevel(struct cvm_mmc_slot *slot)
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
next reply other threads:[~2025-12-22 10:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-22 10:03 Thorsten Blum [this message]
2025-12-30 15:33 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251222100338.634144-1-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=chenhuacai@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=rric@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=zhoubinbin@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®