Re: [PATCH v2 2/3] mmc: core: Add mmc_delay_us() for microsecond precision delays
From: Sebastian Reichel
Date: Fri Jul 24 2026 - 18:17:31 EST
Hi,
On Wed, Jul 22, 2026 at 03:57:00PM -0500, Judith Mendez wrote:
> Add mmc_delay_us() to support microsecond-granularity delays needed
> in MMC framework. It uses 25% margin consistent with mmc_delay() for
> timing flexibility.
>
> Signed-off-by: Judith Mendez <jm@xxxxxx>
> ---
> Changes since v1:
> - add patch 2/3
> ---
Looks like you should just use fsleep() from <linux/delay.h>.
Greetings,
-- Sebastian
> drivers/mmc/core/core.h | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
> index a028b48be1644..55e9fb3bab9f7 100644
> --- a/drivers/mmc/core/core.h
> +++ b/drivers/mmc/core/core.h
> @@ -73,6 +73,19 @@ static inline void mmc_delay(unsigned int ms)
> msleep(ms);
> }
>
> +static inline void mmc_delay_us(unsigned int us)
> +{
> + if (us < 1000) {
> + usleep_range(us, us + (us >> 2));
> + } else {
> + unsigned int rem_us = us % 1000;
> +
> + msleep(us / 1000);
> + if (rem_us)
> + usleep_range(rem_us, rem_us + (rem_us >> 2));
> + }
> +}
> +
> void mmc_rescan(struct work_struct *work);
> void mmc_start_host(struct mmc_host *host);
> void __mmc_stop_host(struct mmc_host *host);
> --
> 2.54.0
>
>
Attachment:
signature.asc
Description: PGP signature