[PATCH 2/2] mmc: core: Turn mmc_alloc|free_host() into static functions
From: Ulf Hansson
Date: Tue Sep 15 2026 - 09:44:10 EST
From: Ulf Hansson <ulfh@xxxxxxxxxx>
As there are no longer any users of these functions, let's make them
internal to the mmc core. While at it, let's also flip the order of the
in-parameters to mmc_alloc_host() to be consistent with devm_alloc_host().
Signed-off-by: Ulf Hansson <ulfh@xxxxxxxxxx>
---
drivers/mmc/core/host.c | 35 +++++++++--------------------------
include/linux/mmc/host.h | 2 --
2 files changed, 9 insertions(+), 28 deletions(-)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 1bcf0e917b59..8e9e61839198 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -505,14 +505,7 @@ static int mmc_first_nonreserved_index(void)
return max + 1;
}
-/**
- * mmc_alloc_host - initialise the per-host structure.
- * @extra: sizeof private data structure
- * @dev: pointer to host device model structure
- *
- * Initialise the per-host structure.
- */
-struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
+static struct mmc_host *mmc_alloc_host(struct device *dev, int extra)
{
int index;
struct mmc_host *host;
@@ -583,7 +576,13 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
return host;
}
-EXPORT_SYMBOL(mmc_alloc_host);
+static void mmc_free_host(struct mmc_host *host)
+{
+ cancel_delayed_work_sync(&host->detect);
+ cancel_work_sync(&host->sdio_irq_work);
+ mmc_pwrseq_free(host);
+ put_device(&host->class_dev);
+}
static void devm_mmc_host_release(struct device *dev, void *res)
{
@@ -598,7 +597,7 @@ struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra)
if (!dr)
return NULL;
- host = mmc_alloc_host(extra, dev);
+ host = mmc_alloc_host(dev, extra);
if (!host) {
devres_free(dr);
return NULL;
@@ -692,19 +691,3 @@ void mmc_remove_host(struct mmc_host *host)
}
EXPORT_SYMBOL(mmc_remove_host);
-
-/**
- * mmc_free_host - free the host structure
- * @host: mmc host
- *
- * Free the host once all references to it have been dropped.
- */
-void mmc_free_host(struct mmc_host *host)
-{
- cancel_delayed_work_sync(&host->detect);
- cancel_work_sync(&host->sdio_irq_work);
- mmc_pwrseq_free(host);
- put_device(&host->class_dev);
-}
-
-EXPORT_SYMBOL(mmc_free_host);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index ddb32bc2946f..198554e48346 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -585,11 +585,9 @@ struct mmc_host {
struct device_node;
-struct mmc_host *mmc_alloc_host(int extra, struct device *);
struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra);
int mmc_add_host(struct mmc_host *);
void mmc_remove_host(struct mmc_host *);
-void mmc_free_host(struct mmc_host *);
void mmc_of_parse_clk_phase(struct device *dev,
struct mmc_clk_phase_map *map);
int mmc_of_parse(struct mmc_host *host);
--
2.43.0