Re: [PATCH v11 4/6] mmc: core: Split sdio_set_host_pm_flags()
From: Shawn Lin
Date: Mon Nov 02 2026 - 01:56:51 EST
在 2026/10/31 星期六 2:10, Kamal Dasu 写道:
From: Ulf Hansson <ulf.hansson@xxxxxxxxxxxxxxxx>
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.
Reviewed-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxxxxxxxx>
Signed-off-by: Kamal Dasu <kamal.dasu@xxxxxxxxxxxx>
---
drivers/mmc/core/core.c | 10 ++++++++++
drivers/mmc/core/core.h | 1 +
drivers/mmc/core/sdio_io.c | 7 +------
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 677e445dc48c..6cbb5ee6200c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1422,6 +1422,16 @@ 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;
+
+ /* function suspend methods are serialized, hence no lock needed */
+ 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 */
- host->pm_flags |= flags;
- return 0;
+ return mmc_set_host_pm_flags(host, flags);
}
EXPORT_SYMBOL_GPL(sdio_set_host_pm_flags);