Re: [PATCH v10 4/6] mmc: core: Split sdio_set_host_pm_flags()
From: Ulf Hansson
Date: Tue Oct 27 2026 - 15:43:37 EST
On Tue, Oct 27, 2026 at 4:13 PM Shawn Lin <shawn.lin@xxxxxxxxx> wrote:
>
> Hi Ulf,
>
> 在 2026/10/27 星期二 22:40, Ulf Hansson 写道:
> > To prepare for a subsequent change, let's split up sdio_set_host_pm_flags()
> > allowing the second part of it to be used as an internal function for the
> > core.
> >
> > Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxxxxxxxx>
> > ---
> > drivers/mmc/core/core.c | 9 +++++++++
> > drivers/mmc/core/core.h | 1 +
> > drivers/mmc/core/sdio_io.c | 7 +------
> > 3 files changed, 11 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> > index 677e445dc48c..49c0494932cc 100644
> > --- a/drivers/mmc/core/core.c
> > +++ b/drivers/mmc/core/core.c
> > @@ -1422,6 +1422,15 @@ int mmc_handle_undervoltage(struct mmc_host *host)
> > return host->bus_ops->handle_undervoltage(host);
> > }
> >
> > +int mmc_set_host_pm_flags(struct mmc_host *host, mmc_pm_flag_t flags)
> > +{
> > + if (flags & ~host->pm_caps)
> > + return -EINVAL;
> > +
> > + host->pm_flags |= flags;
> > + return 0;
> > +}
> > +
> > /*
> > * Assign a mmc bus handler to a host. Only one bus handler may control a
> > * host at any given time.
> > diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
> > index 9be2875608ce..d3a2ff00b18f 100644
> > --- a/drivers/mmc/core/core.h
> > +++ b/drivers/mmc/core/core.h
> > @@ -64,6 +64,7 @@ int mmc_handle_undervoltage(struct mmc_host *host);
> > void mmc_regulator_register_undervoltage_notifier(struct mmc_host *host);
> > void mmc_regulator_unregister_undervoltage_notifier(struct mmc_host *host);
> > void mmc_undervoltage_workfn(struct work_struct *work);
> > +int mmc_set_host_pm_flags(struct mmc_host *host, mmc_pm_flag_t flags);
> >
> > static inline void mmc_delay(unsigned int ms)
> > {
> > diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
> > index 12716ec0e35d..99f857514b63 100644
> > --- a/drivers/mmc/core/sdio_io.c
> > +++ b/drivers/mmc/core/sdio_io.c
> > @@ -726,12 +726,7 @@ int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags)
> >
> > host = func->card->host;
> >
> > - if (flags & ~host->pm_caps)
> > - return -EINVAL;
> > -
> > - /* function suspend methods are serialized, hence no lock needed */
>
> This is an API for sdio function driver, should we preserve this commet
> here?
Sure! But rather than preserve, we can move it to the new
mmc_set_host_pm_flags() function as it applies there too.
>
> > - host->pm_flags |= flags;
> > - return 0;
> > + return mmc_set_host_pm_flags(host, flags);
> > }
> > EXPORT_SYMBOL_GPL(sdio_set_host_pm_flags);
> >
>
Kind regards
Uffe