]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: dw_mmc: Introduce dw_mci_alloc_host()
authorShawn Lin <shawn.lin@rock-chips.com>
Sat, 20 Dec 2025 05:22:05 +0000 (13:22 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 23 Feb 2026 11:06:53 +0000 (12:06 +0100)
This helper is used for variant drivers to allocate struct dw_mci
and set struct dw_mci as private data of struct mmc_host.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/dw_mmc.h

index 4ec60740b0b45d37d6d82b0991dbbc5546b3442b..ecb32dc2a8f04f770b5e03a3ab9d08b2e7bc22e7 100644 (file)
@@ -3258,6 +3258,23 @@ static void dw_mci_enable_cd(struct dw_mci *host)
        }
 }
 
+struct dw_mci *dw_mci_alloc_host(struct device *dev)
+{
+       struct mmc_host *mmc;
+       struct dw_mci *host;
+
+       mmc = devm_mmc_alloc_host(dev, sizeof(struct dw_mci));
+       if (!mmc)
+               return ERR_PTR(-ENOMEM);
+
+       host = mmc_priv(mmc);
+       host->mmc = mmc;
+       host->dev = dev;
+
+       return host;
+}
+EXPORT_SYMBOL(dw_mci_alloc_host);
+
 int dw_mci_probe(struct dw_mci *host)
 {
        const struct dw_mci_drv_data *drv_data = host->drv_data;
index d5e4e6d678121bea50e8595b7d86c44da4e1a0b1..892b5451eb69b2e13e172afac14c5e1336db166f 100644 (file)
@@ -544,6 +544,7 @@ static inline void mci_fifo_l_writeq(void __iomem *addr, u64 value)
 #define __raw_readq(__reg) (*(volatile u64 __force *)(__reg))
 #endif
 
+extern struct dw_mci *dw_mci_alloc_host(struct device *device);
 extern int dw_mci_probe(struct dw_mci *host);
 extern void dw_mci_remove(struct dw_mci *host);
 #ifdef CONFIG_PM