Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage
@ 2025-06-03 12:25 Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 01/36] mmc: alcor: Use devm_mmc_alloc_host() helper Binbin Zhou
                   ` (36 more replies)
  0 siblings, 37 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Hi all:

Since the devm_mmc_alloc_host() helper was already available, I tried to
start cleaning up the use of mmc_alloc_host().

To make it easier to review the patchset, I decided to split it into two parts.
As the first part, this patchset contains cleanup for drivers other than sdhci.

Of course, the sdhci part I have ready in my repository.

Thanks.

-----
V3:
- Collect Reviewed-by and Acked-by tags.
Patch-18
  - Fix build warning by lkp:
	https://lore.kernel.org/all/202505230421.P12fqPfB-lkp@intel.com/

Link to V2:
https://lore.kernel.org/all/cover.1747877175.git.zhoubinbin@loongson.cn/

V2:
- Collect Reviewed-by and Acked-by tags.
Patch-24
  - Correct subject title: ish_mmicf -> sh_mmicf.
Patch-34
  - Fix cheap build error.

Link to V1:
https://lore.kernel.org/all/cover.1747739323.git.zhoubinbin@loongson.cn/

Binbin Zhou (36):
  mmc: alcor: Use devm_mmc_alloc_host() helper
  mmc: atmel: Use devm_mmc_alloc_host() helper
  mmc: au1xmmc: Use devm_mmc_alloc_host() helper
  mmc: bcm2835: Use devm_mmc_alloc_host() helper
  mmc: cavium: Use devm_mmc_alloc_host() helper
  mmc: cb710: Use devm_mmc_alloc_host() helper
  mmc: davinci_mmc: Use devm_mmc_alloc_host() helper
  mmc: dw_mmc: Use devm_mmc_alloc_host() helper
  mmc: jz4740: Use devm_mmc_alloc_host() helper
  mmc: litex_mmc: Use devm_mmc_alloc_host() helper
  mmc: meson-mx-sdhc: Use devm_mmc_alloc_host() helper
  mmc: mmci: Use devm_mmc_alloc_host() helper
  mmc: moxart-mmc: Use devm_mmc_alloc_host() helper
  mmc: mvsdio: Use devm_mmc_alloc_host() helper
  mmc: mxcmmc: Use devm_mmc_alloc_host() helper
  mmc: mxs-mmc: Use devm_mmc_alloc_host() helper
  mmc: omap: Use devm_mmc_alloc_host() helper
  mmc: omap_hsmmc: Use devm_mmc_alloc_host() helper
  mmc: owl-mmc: Use devm_mmc_alloc_host() helper
  mmc: pxamci: Use devm_mmc_alloc_host() helper
  mmc: rtsx_pci: Use devm_mmc_alloc_host() helper
  mmc: rtsx_usb_sdmmc: Use devm_mmc_alloc_host() helper
  mmc: sdricoh_cs: Use devm_mmc_alloc_host() helper
  mmc: sh_mmicf: Use devm_mmc_alloc_host() helper
  mmc: tifm_sd: Use devm_mmc_alloc_host() helper
  mmc: toshsd: Use devm_mmc_alloc_host() helper
  mmc: usdhi6ro10: Use devm_mmc_alloc_host() helper
  mmc: ushc: Use devm_mmc_alloc_host() helper
  mmc: via-sdmmc: Use devm_mmc_alloc_host() helper
  mmc: vub300: Use devm_mmc_alloc_host() helper
  mmc: wbsd: Use devm_mmc_alloc_host() helper
  mmc: wmt-sdmmc: Use devm_mmc_alloc_host() helper
  mmc: tmio: Use devm_mmc_alloc_host() helper
  mmc: sunxi: Use devm_mmc_alloc_host() helper
  mmc: mmc_spi: Use devm_mmc_alloc_host() helper
  mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper

 drivers/mmc/host/alcor.c             | 20 ++++---------
 drivers/mmc/host/atmel-mci.c         |  7 ++---
 drivers/mmc/host/au1xmmc.c           | 14 +++-------
 drivers/mmc/host/bcm2835.c           |  5 +---
 drivers/mmc/host/cavium.c            | 10 ++-----
 drivers/mmc/host/cb710-mmc.c         |  5 +---
 drivers/mmc/host/davinci_mmc.c       | 22 +++++----------
 drivers/mmc/host/dw_mmc.c            | 15 ++++------
 drivers/mmc/host/jz4740_mmc.c        | 40 +++++++++-----------------
 drivers/mmc/host/litex_mmc.c         | 12 +-------
 drivers/mmc/host/meson-mx-sdhc-mmc.c | 13 +--------
 drivers/mmc/host/meson-mx-sdio.c     | 20 ++++++-------
 drivers/mmc/host/mmc_spi.c           |  4 +--
 drivers/mmc/host/mmci.c              | 31 ++++++++------------
 drivers/mmc/host/moxart-mmc.c        | 40 ++++++++++----------------
 drivers/mmc/host/mvsdio.c            | 24 +++++-----------
 drivers/mmc/host/mxcmmc.c            | 31 +++++++-------------
 drivers/mmc/host/mxs-mmc.c           | 31 ++++++++------------
 drivers/mmc/host/omap.c              | 25 ++++++-----------
 drivers/mmc/host/omap_hsmmc.c        | 17 ++++-------
 drivers/mmc/host/owl-mmc.c           | 37 +++++++++---------------
 drivers/mmc/host/pxamci.c            | 42 ++++++++++------------------
 drivers/mmc/host/renesas_sdhi_core.c |  6 +---
 drivers/mmc/host/rtsx_pci_sdmmc.c    |  5 +---
 drivers/mmc/host/rtsx_usb_sdmmc.c    |  4 +--
 drivers/mmc/host/sdricoh_cs.c        | 10 ++-----
 drivers/mmc/host/sh_mmcif.c          | 17 ++++-------
 drivers/mmc/host/sunxi-mmc.c         | 22 ++++++---------
 drivers/mmc/host/tifm_sd.c           |  7 +----
 drivers/mmc/host/tmio_mmc.h          |  1 -
 drivers/mmc/host/tmio_mmc_core.c     | 18 ++----------
 drivers/mmc/host/toshsd.c            |  4 +--
 drivers/mmc/host/uniphier-sd.c       |  8 ++----
 drivers/mmc/host/usdhi6rol0.c        | 30 +++++++-------------
 drivers/mmc/host/ushc.c              |  4 +--
 drivers/mmc/host/via-sdmmc.c         |  7 ++---
 drivers/mmc/host/vub300.c            | 16 ++++-------
 drivers/mmc/host/wbsd.c              |  4 +--
 drivers/mmc/host/wmt-sdmmc.c         |  8 ++----
 39 files changed, 195 insertions(+), 441 deletions(-)


base-commit: d2c6acff6386f43ed307822454b970c831c48f1b
-- 
2.47.1


^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v3 01/36] mmc: alcor: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
@ 2025-06-03 12:25 ` Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 02/36] mmc: atmel: " Binbin Zhou
                   ` (35 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Feng Wei, Shao Mingyin

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Feng Wei <feng.wei8@zte.com.cn>
Cc: Shao Mingyin <shao.mingyin@zte.com.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/alcor.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/alcor.c b/drivers/mmc/host/alcor.c
index 24abd3a93da9..288c3a91a0af 100644
--- a/drivers/mmc/host/alcor.c
+++ b/drivers/mmc/host/alcor.c
@@ -1084,7 +1084,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
 	struct alcor_sdmmc_host *host;
 	int ret;
 
-	mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc) {
 		dev_err(&pdev->dev, "Can't allocate MMC\n");
 		return -ENOMEM;
@@ -1102,11 +1102,9 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
 	ret = devm_request_threaded_irq(&pdev->dev, priv->irq,
 			alcor_irq, alcor_irq_thread, IRQF_SHARED,
 			DRV_NAME_ALCOR_PCI_SDMMC, host);
-
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to get irq for data line\n");
-		goto free_host;
-	}
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "Failed to get irq for data line\n");
 
 	mutex_init(&host->cmd_mutex);
 	INIT_DELAYED_WORK(&host->timeout_work, alcor_timeout_timer);
@@ -1115,15 +1113,8 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
 	alcor_hw_init(host);
 
 	dev_set_drvdata(&pdev->dev, host);
-	ret = mmc_add_host(mmc);
-	if (ret)
-		goto free_host;
 
-	return 0;
-
-free_host:
-	mmc_free_host(mmc);
-	return ret;
+	return mmc_add_host(mmc);
 }
 
 static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
@@ -1136,7 +1127,6 @@ static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
 
 	alcor_hw_uninit(host);
 	mmc_remove_host(mmc);
-	mmc_free_host(mmc);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 02/36] mmc: atmel: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 01/36] mmc: alcor: Use devm_mmc_alloc_host() helper Binbin Zhou
@ 2025-06-03 12:25 ` Binbin Zhou
  2025-06-10  9:21   ` Aubin Constans
  2025-06-03 12:25 ` [PATCH v3 03/36] mmc: au1xmmc: " Binbin Zhou
                   ` (34 subsequent siblings)
  36 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Aubin Constans,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Aubin Constans <aubin.constans@microchip.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/atmel-mci.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 14e981b834b6..f72fe4b805f6 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2247,7 +2247,7 @@ static int atmci_init_slot(struct atmel_mci *host,
 	struct atmel_mci_slot		*slot;
 	int ret;
 
-	mmc = mmc_alloc_host(sizeof(struct atmel_mci_slot), dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(*slot));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -2320,10 +2320,8 @@ static int atmci_init_slot(struct atmel_mci *host,
 	host->slot[id] = slot;
 	mmc_regulator_get_supply(mmc);
 	ret = mmc_add_host(mmc);
-	if (ret) {
-		mmc_free_host(mmc);
+	if (ret)
 		return ret;
-	}
 
 	if (slot->detect_pin) {
 		timer_setup(&slot->detect_timer, atmci_detect_change, 0);
@@ -2361,7 +2359,6 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
 	}
 
 	slot->host->slot[id] = NULL;
-	mmc_free_host(slot->mmc);
 }
 
 static int atmci_configure_dma(struct atmel_mci *host)
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 03/36] mmc: au1xmmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 01/36] mmc: alcor: Use devm_mmc_alloc_host() helper Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 02/36] mmc: atmel: " Binbin Zhou
@ 2025-06-03 12:25 ` Binbin Zhou
  2025-06-03 13:34   ` Manuel Lauss
  2025-06-03 12:25 ` [PATCH v3 04/36] mmc: bcm2835: " Binbin Zhou
                   ` (33 subsequent siblings)
  36 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Manuel Lauss

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Manuel Lauss <manuel.lauss@gmail.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/au1xmmc.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index 057d42307832..85470773650d 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -937,11 +937,10 @@ static int au1xmmc_probe(struct platform_device *pdev)
 	struct resource *r;
 	int ret, iflag;
 
-	mmc = mmc_alloc_host(sizeof(struct au1xmmc_host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc) {
 		dev_err(&pdev->dev, "no memory for mmc_host\n");
-		ret = -ENOMEM;
-		goto out0;
+		return -ENOMEM;
 	}
 
 	host = mmc_priv(mmc);
@@ -953,14 +952,14 @@ static int au1xmmc_probe(struct platform_device *pdev)
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!r) {
 		dev_err(&pdev->dev, "no mmio defined\n");
-		goto out1;
+		return ret;
 	}
 
 	host->ioarea = request_mem_region(r->start, resource_size(r),
 					   pdev->name);
 	if (!host->ioarea) {
 		dev_err(&pdev->dev, "mmio already in use\n");
-		goto out1;
+		return ret;
 	}
 
 	host->iobase = ioremap(r->start, 0x3c);
@@ -1109,9 +1108,6 @@ static int au1xmmc_probe(struct platform_device *pdev)
 out2:
 	release_resource(host->ioarea);
 	kfree(host->ioarea);
-out1:
-	mmc_free_host(mmc);
-out0:
 	return ret;
 }
 
@@ -1151,8 +1147,6 @@ static void au1xmmc_remove(struct platform_device *pdev)
 		iounmap((void *)host->iobase);
 		release_resource(host->ioarea);
 		kfree(host->ioarea);
-
-		mmc_free_host(host->mmc);
 	}
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 04/36] mmc: bcm2835: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (2 preceding siblings ...)
  2025-06-03 12:25 ` [PATCH v3 03/36] mmc: au1xmmc: " Binbin Zhou
@ 2025-06-03 12:25 ` Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 05/36] mmc: cavium: " Binbin Zhou
                   ` (32 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Florian Fainelli, Ray Jui,
	Scott Branden

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/bcm2835.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index def054ddd256..3dde5c367ddc 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -1371,7 +1371,7 @@ static int bcm2835_probe(struct platform_device *pdev)
 	int ret;
 
 	dev_dbg(dev, "%s\n", __func__);
-	mmc = mmc_alloc_host(sizeof(*host), dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -1450,7 +1450,6 @@ static int bcm2835_probe(struct platform_device *pdev)
 	dev_dbg(dev, "%s -> err %d\n", __func__, ret);
 	if (host->dma_chan_rxtx)
 		dma_release_channel(host->dma_chan_rxtx);
-	mmc_free_host(mmc);
 
 	return ret;
 }
@@ -1473,8 +1472,6 @@ static void bcm2835_remove(struct platform_device *pdev)
 
 	if (host->dma_chan_rxtx)
 		dma_release_channel(host->dma_chan_rxtx);
-
-	mmc_free_host(mmc);
 }
 
 static const struct of_device_id bcm2835_match[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 05/36] mmc: cavium: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (3 preceding siblings ...)
  2025-06-03 12:25 ` [PATCH v3 04/36] mmc: bcm2835: " Binbin Zhou
@ 2025-06-03 12:25 ` Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 06/36] mmc: cb710: " Binbin Zhou
                   ` (31 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Robert Richter

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Robert Richter <rric@kernel.org>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/cavium.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
index 95a41983c6c0..9a55db0e657c 100644
--- a/drivers/mmc/host/cavium.c
+++ b/drivers/mmc/host/cavium.c
@@ -1012,7 +1012,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
 	struct mmc_host *mmc;
 	int ret, id;
 
-	mmc = mmc_alloc_host(sizeof(struct cvm_mmc_slot), dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(*slot));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -1022,7 +1022,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
 
 	ret = cvm_mmc_of_parse(dev, slot);
 	if (ret < 0)
-		goto error;
+		return ret;
 	id = ret;
 
 	/* Set up host parameters */
@@ -1066,12 +1066,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
 	if (ret) {
 		dev_err(dev, "mmc_add_host() returned %d\n", ret);
 		slot->host->slot[id] = NULL;
-		goto error;
 	}
-	return 0;
-
-error:
-	mmc_free_host(slot->mmc);
 	return ret;
 }
 
@@ -1079,6 +1074,5 @@ int cvm_mmc_of_slot_remove(struct cvm_mmc_slot *slot)
 {
 	mmc_remove_host(slot->mmc);
 	slot->host->slot[slot->bus_id] = NULL;
-	mmc_free_host(slot->mmc);
 	return 0;
 }
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 06/36] mmc: cb710: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (4 preceding siblings ...)
  2025-06-03 12:25 ` [PATCH v3 05/36] mmc: cavium: " Binbin Zhou
@ 2025-06-03 12:25 ` Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 07/36] mmc: davinci_mmc: " Binbin Zhou
                   ` (30 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Michał Mirosław

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/cb710-mmc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index d741c1f9cf87..8787e7f49e94 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -692,7 +692,7 @@ static int cb710_mmc_init(struct platform_device *pdev)
 	int err;
 	u32 val;
 
-	mmc = mmc_alloc_host(sizeof(*reader), cb710_slot_dev(slot));
+	mmc = devm_mmc_alloc_host(cb710_slot_dev(slot), sizeof(*reader));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -741,7 +741,6 @@ static int cb710_mmc_init(struct platform_device *pdev)
 	dev_dbg(cb710_slot_dev(slot), "mmc_add_host() failed: %d\n", err);
 
 	cb710_set_irq_handler(slot, NULL);
-	mmc_free_host(mmc);
 	return err;
 }
 
@@ -764,8 +763,6 @@ static void cb710_mmc_exit(struct platform_device *pdev)
 	cb710_write_port_16(slot, CB710_MMC_CONFIGB_PORT, 0);
 
 	cancel_work_sync(&reader->finish_req_bh_work);
-
-	mmc_free_host(mmc);
 }
 
 static struct platform_driver cb710_mmc_driver = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 07/36] mmc: davinci_mmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (5 preceding siblings ...)
  2025-06-03 12:25 ` [PATCH v3 06/36] mmc: cb710: " Binbin Zhou
@ 2025-06-03 12:25 ` Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 08/36] mmc: dw_mmc: " Binbin Zhou
                   ` (29 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Bastien Curutchet,
	Bartosz Golaszewski

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Bastien Curutchet <bastien.curutchet@bootlin.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/davinci_mmc.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index cde4c4339ab7..c691f1b60395 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1203,7 +1203,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
 	if (!mem)
 		return -EBUSY;
 
-	mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -1212,19 +1212,16 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
 
 	host->mem_res = mem;
 	host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
-	if (!host->base) {
-		ret = -ENOMEM;
-		goto ioremap_fail;
-	}
+	if (!host->base)
+		return -ENOMEM;
 
 	host->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(host->clk)) {
-		ret = PTR_ERR(host->clk);
-		goto clk_get_fail;
-	}
+	if (IS_ERR(host->clk))
+		return PTR_ERR(host->clk);
+
 	ret = clk_prepare_enable(host->clk);
 	if (ret)
-		goto clk_prepare_enable_fail;
+		return ret;
 
 	host->mmc_input_clk = clk_get_rate(host->clk);
 
@@ -1336,10 +1333,6 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
 parse_fail:
 dma_probe_defer:
 	clk_disable_unprepare(host->clk);
-clk_prepare_enable_fail:
-clk_get_fail:
-ioremap_fail:
-	mmc_free_host(mmc);
 
 	return ret;
 }
@@ -1352,7 +1345,6 @@ static void davinci_mmcsd_remove(struct platform_device *pdev)
 	mmc_davinci_cpufreq_deregister(host);
 	davinci_release_dma_channels(host);
 	clk_disable_unprepare(host->clk);
-	mmc_free_host(host->mmc);
 }
 
 #ifdef CONFIG_PM
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 08/36] mmc: dw_mmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (6 preceding siblings ...)
  2025-06-03 12:25 ` [PATCH v3 07/36] mmc: davinci_mmc: " Binbin Zhou
@ 2025-06-03 12:25 ` Binbin Zhou
  2025-06-03 12:25 ` [PATCH v3 09/36] mmc: jz4740: " Binbin Zhou
                   ` (28 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Jaehoon Chung

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/dw_mmc.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 2bfcc47dcf3e..06ffa65df181 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -3008,7 +3008,7 @@ static int dw_mci_init_slot(struct dw_mci *host)
 	struct dw_mci_slot *slot;
 	int ret;
 
-	mmc = mmc_alloc_host(sizeof(struct dw_mci_slot), host->dev);
+	mmc = devm_mmc_alloc_host(host->dev, sizeof(*slot));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -3024,18 +3024,18 @@ static int dw_mci_init_slot(struct dw_mci *host)
 	/*if there are external regulators, get them*/
 	ret = mmc_regulator_get_supply(mmc);
 	if (ret)
-		goto err_host_allocated;
+		return ret;
 
 	if (!mmc->ocr_avail)
 		mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
 
 	ret = mmc_of_parse(mmc);
 	if (ret)
-		goto err_host_allocated;
+		return ret;
 
 	ret = dw_mci_init_slot_caps(slot);
 	if (ret)
-		goto err_host_allocated;
+		return ret;
 
 	/* Useful defaults if platform data is unset. */
 	if (host->use_dma == TRANS_MODE_IDMAC) {
@@ -3065,17 +3065,13 @@ static int dw_mci_init_slot(struct dw_mci *host)
 
 	ret = mmc_add_host(mmc);
 	if (ret)
-		goto err_host_allocated;
+		return ret;
 
 #if defined(CONFIG_DEBUG_FS)
 	dw_mci_init_debugfs(slot);
 #endif
 
 	return 0;
-
-err_host_allocated:
-	mmc_free_host(mmc);
-	return ret;
 }
 
 static void dw_mci_cleanup_slot(struct dw_mci_slot *slot)
@@ -3083,7 +3079,6 @@ static void dw_mci_cleanup_slot(struct dw_mci_slot *slot)
 	/* Debugfs stuff is cleaned up by mmc core */
 	mmc_remove_host(slot->mmc);
 	slot->host->slot = NULL;
-	mmc_free_host(slot->mmc);
 }
 
 static void dw_mci_init_dma(struct dw_mci *host)
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 09/36] mmc: jz4740: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (7 preceding siblings ...)
  2025-06-03 12:25 ` [PATCH v3 08/36] mmc: dw_mmc: " Binbin Zhou
@ 2025-06-03 12:25 ` Binbin Zhou
  2025-06-03 12:26 ` [PATCH v3 10/36] mmc: litex_mmc: " Binbin Zhou
                   ` (27 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:25 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Paul Cercueil

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/jz4740_mmc.c | 40 ++++++++++++-----------------------
 1 file changed, 13 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
index bd1662e275d4..3a623323aef3 100644
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -1042,7 +1042,7 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
 	struct mmc_host *mmc;
 	struct jz4740_mmc_host *host;
 
-	mmc = mmc_alloc_host(sizeof(struct jz4740_mmc_host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc) {
 		dev_err(&pdev->dev, "Failed to alloc mmc host structure\n");
 		return -ENOMEM;
@@ -1054,31 +1054,24 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
 	host->version = (enum jz4740_mmc_version)device_get_match_data(&pdev->dev);
 
 	ret = mmc_of_parse(mmc);
-	if (ret) {
-		dev_err_probe(&pdev->dev, ret, "could not parse device properties\n");
-		goto err_free_host;
-	}
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "could not parse device properties\n");
 
 	mmc_regulator_get_supply(mmc);
 
 	host->irq = platform_get_irq(pdev, 0);
-	if (host->irq < 0) {
-		ret = host->irq;
-		goto err_free_host;
-	}
+	if (host->irq < 0)
+		return host->irq;
 
 	host->clk = devm_clk_get(&pdev->dev, "mmc");
-	if (IS_ERR(host->clk)) {
-		ret = PTR_ERR(host->clk);
-		dev_err(&pdev->dev, "Failed to get mmc clock\n");
-		goto err_free_host;
-	}
+	if (IS_ERR(host->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(host->clk),
+				     "Failed to get mmc clock\n");
 
 	host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &host->mem_res);
-	if (IS_ERR(host->base)) {
-		ret = PTR_ERR(host->base);
-		goto err_free_host;
-	}
+	if (IS_ERR(host->base))
+		return PTR_ERR(host->base);
 
 	mmc->ops = &jz4740_mmc_ops;
 	if (!mmc->f_max)
@@ -1118,10 +1111,8 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
 
 	ret = request_threaded_irq(host->irq, jz_mmc_irq, jz_mmc_irq_worker, 0,
 			dev_name(&pdev->dev), host);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to request irq: %d\n", ret);
-		goto err_free_host;
-	}
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret, "Failed to request irq\n");
 
 	jz4740_mmc_clock_disable(host);
 	timer_setup(&host->timeout_timer, jz4740_mmc_timeout, 0);
@@ -1152,9 +1143,6 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
 		jz4740_mmc_release_dma_channels(host);
 err_free_irq:
 	free_irq(host->irq, host);
-err_free_host:
-	mmc_free_host(mmc);
-
 	return ret;
 }
 
@@ -1172,8 +1160,6 @@ static void jz4740_mmc_remove(struct platform_device *pdev)
 
 	if (host->use_dma)
 		jz4740_mmc_release_dma_channels(host);
-
-	mmc_free_host(host->mmc);
 }
 
 static int jz4740_mmc_suspend(struct device *dev)
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 10/36] mmc: litex_mmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (8 preceding siblings ...)
  2025-06-03 12:25 ` [PATCH v3 09/36] mmc: jz4740: " Binbin Zhou
@ 2025-06-03 12:26 ` Binbin Zhou
  2025-06-03 12:26 ` [PATCH v3 11/36] mmc: meson-mx-sdhc: " Binbin Zhou
                   ` (26 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Karol Gugala,
	Mateusz Holenko, Gabriel Somlo, Joel Stanley

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Karol Gugala <kgugala@antmicro.com>
Cc: Mateusz Holenko <mholenko@antmicro.com>
Cc: Gabriel Somlo <gsomlo@gmail.com>
Cc: Joel Stanley <joel@jms.id.au>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Acked-by: Gabriel Somlo <gsomlo@gmail.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/litex_mmc.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/mmc/host/litex_mmc.c b/drivers/mmc/host/litex_mmc.c
index b338ccfa8f33..d2f19c2dc673 100644
--- a/drivers/mmc/host/litex_mmc.c
+++ b/drivers/mmc/host/litex_mmc.c
@@ -506,11 +506,6 @@ static int litex_mmc_irq_init(struct platform_device *pdev,
 	return 0;
 }
 
-static void litex_mmc_free_host_wrapper(void *mmc)
-{
-	mmc_free_host(mmc);
-}
-
 static int litex_mmc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -525,15 +520,10 @@ static int litex_mmc_probe(struct platform_device *pdev)
 	 * If for some reason we need to modify max_blk_count, we must also
 	 * re-calculate `max_[req,seg]_size = max_blk_size * max_blk_count;`
 	 */
-	mmc = mmc_alloc_host(sizeof(struct litex_mmc_host), dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
-	ret = devm_add_action_or_reset(dev, litex_mmc_free_host_wrapper, mmc);
-	if (ret)
-		return dev_err_probe(dev, ret,
-				     "Can't register mmc_free_host action\n");
-
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 11/36] mmc: meson-mx-sdhc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (9 preceding siblings ...)
  2025-06-03 12:26 ` [PATCH v3 10/36] mmc: litex_mmc: " Binbin Zhou
@ 2025-06-03 12:26 ` Binbin Zhou
  2025-06-03 20:02   ` Martin Blumenstingl
  2025-06-03 12:26 ` [PATCH v3 12/36] mmc: mmci: " Binbin Zhou
                   ` (25 subsequent siblings)
  36 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, linux-amlogic

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-amlogic@lists.infradead.org
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/meson-mx-sdhc-mmc.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
index b4e56ccffca2..fb49ea71289e 100644
--- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
@@ -757,11 +757,6 @@ static void meson_mx_sdhc_init_hw(struct mmc_host *mmc)
 	regmap_write(host->regmap, MESON_SDHC_ISTA, MESON_SDHC_ISTA_ALL_IRQS);
 }
 
-static void meason_mx_mmc_free_host(void *data)
-{
-       mmc_free_host(data);
-}
-
 static int meson_mx_sdhc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -770,16 +765,10 @@ static int meson_mx_sdhc_probe(struct platform_device *pdev)
 	void __iomem *base;
 	int ret, irq;
 
-	mmc = mmc_alloc_host(sizeof(*host), dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
-	ret = devm_add_action_or_reset(dev, meason_mx_mmc_free_host, mmc);
-	if (ret) {
-		dev_err(dev, "Failed to register mmc_free_host action\n");
-		return ret;
-	}
-
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 12/36] mmc: mmci: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (10 preceding siblings ...)
  2025-06-03 12:26 ` [PATCH v3 11/36] mmc: meson-mx-sdhc: " Binbin Zhou
@ 2025-06-03 12:26 ` Binbin Zhou
  2025-06-03 12:26 ` [PATCH v3 13/36] mmc: moxart-mmc: " Binbin Zhou
                   ` (24 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Russell King

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Russell King <linux@armlinux.org.uk>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/mmci.c | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index b790c3c3c8f9..c70c64f8adc4 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -2223,7 +2223,7 @@ static int mmci_probe(struct amba_device *dev,
 			return -ENOMEM;
 	}
 
-	mmc = mmc_alloc_host(sizeof(struct mmci_host), &dev->dev);
+	mmc = devm_mmc_alloc_host(&dev->dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -2234,7 +2234,7 @@ static int mmci_probe(struct amba_device *dev,
 
 	ret = mmci_of_parse(np, mmc);
 	if (ret)
-		goto host_free;
+		return ret;
 
 	/*
 	 * Some variant (STM32) doesn't have opendrain bit, nevertheless
@@ -2242,19 +2242,15 @@ static int mmci_probe(struct amba_device *dev,
 	 */
 	if (!variant->opendrain) {
 		host->pinctrl = devm_pinctrl_get(&dev->dev);
-		if (IS_ERR(host->pinctrl)) {
-			dev_err(&dev->dev, "failed to get pinctrl");
-			ret = PTR_ERR(host->pinctrl);
-			goto host_free;
-		}
+		if (IS_ERR(host->pinctrl))
+			return dev_err_probe(&dev->dev, PTR_ERR(host->pinctrl),
+					     "failed to get pinctrl\n");
 
 		host->pins_opendrain = pinctrl_lookup_state(host->pinctrl,
 							    MMCI_PINCTRL_STATE_OPENDRAIN);
-		if (IS_ERR(host->pins_opendrain)) {
-			dev_err(mmc_dev(mmc), "Can't select opendrain pins\n");
-			ret = PTR_ERR(host->pins_opendrain);
-			goto host_free;
-		}
+		if (IS_ERR(host->pins_opendrain))
+			return dev_err_probe(&dev->dev, PTR_ERR(host->pins_opendrain),
+					     "Can't select opendrain pins\n");
 	}
 
 	host->hw_designer = amba_manf(dev);
@@ -2263,14 +2259,12 @@ static int mmci_probe(struct amba_device *dev,
 	dev_dbg(mmc_dev(mmc), "revision = 0x%01x\n", host->hw_revision);
 
 	host->clk = devm_clk_get(&dev->dev, NULL);
-	if (IS_ERR(host->clk)) {
-		ret = PTR_ERR(host->clk);
-		goto host_free;
-	}
+	if (IS_ERR(host->clk))
+		return PTR_ERR(host->clk);
 
 	ret = clk_prepare_enable(host->clk);
 	if (ret)
-		goto host_free;
+		return ret;
 
 	if (variant->qcom_fifo)
 		host->get_rx_fifocnt = mmci_qcom_get_rx_fifocnt;
@@ -2491,8 +2485,6 @@ static int mmci_probe(struct amba_device *dev,
 
  clk_disable:
 	clk_disable_unprepare(host->clk);
- host_free:
-	mmc_free_host(mmc);
 	return ret;
 }
 
@@ -2522,7 +2514,6 @@ static void mmci_remove(struct amba_device *dev)
 
 		mmci_dma_release(host);
 		clk_disable_unprepare(host->clk);
-		mmc_free_host(mmc);
 	}
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 13/36] mmc: moxart-mmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (11 preceding siblings ...)
  2025-06-03 12:26 ` [PATCH v3 12/36] mmc: mmci: " Binbin Zhou
@ 2025-06-03 12:26 ` Binbin Zhou
  2025-06-03 12:26 ` [PATCH v3 14/36] mmc: mvsdio: " Binbin Zhou
                   ` (23 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/moxart-mmc.c | 40 ++++++++++++-----------------------
 1 file changed, 14 insertions(+), 26 deletions(-)

diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
index a12048e5de63..3dd8f232052f 100644
--- a/drivers/mmc/host/moxart-mmc.c
+++ b/drivers/mmc/host/moxart-mmc.c
@@ -558,41 +558,33 @@ static int moxart_probe(struct platform_device *pdev)
 	int irq, ret;
 	u32 i;
 
-	mmc = mmc_alloc_host(sizeof(struct moxart_host), dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(*host));
 	if (!mmc) {
-		dev_err(dev, "mmc_alloc_host failed\n");
-		ret = -ENOMEM;
-		goto out_mmc;
+		dev_err(dev, "devm_mmc_alloc_host failed\n");
+		return -ENOMEM;
 	}
 
 	ret = of_address_to_resource(node, 0, &res_mmc);
-	if (ret) {
-		dev_err(dev, "of_address_to_resource failed\n");
-		goto out_mmc;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret,
+				     "of_address_to_resource failed\n");
 
 	irq = irq_of_parse_and_map(node, 0);
-	if (irq <= 0) {
-		dev_err(dev, "irq_of_parse_and_map failed\n");
-		ret = -EINVAL;
-		goto out_mmc;
-	}
+	if (irq <= 0)
+		return dev_err_probe(dev, -EINVAL,
+				     "irq_of_parse_and_map failed\n");
 
 	clk = devm_clk_get(dev, NULL);
-	if (IS_ERR(clk)) {
-		ret = PTR_ERR(clk);
-		goto out_mmc;
-	}
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
 
 	reg_mmc = devm_ioremap_resource(dev, &res_mmc);
-	if (IS_ERR(reg_mmc)) {
-		ret = PTR_ERR(reg_mmc);
-		goto out_mmc;
-	}
+	if (IS_ERR(reg_mmc))
+		return PTR_ERR(reg_mmc);
 
 	ret = mmc_of_parse(mmc);
 	if (ret)
-		goto out_mmc;
+		return ret;
 
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
@@ -686,9 +678,6 @@ static int moxart_probe(struct platform_device *pdev)
 		dma_release_channel(host->dma_chan_tx);
 	if (!IS_ERR_OR_NULL(host->dma_chan_rx))
 		dma_release_channel(host->dma_chan_rx);
-out_mmc:
-	if (mmc)
-		mmc_free_host(mmc);
 	return ret;
 }
 
@@ -707,7 +696,6 @@ static void moxart_remove(struct platform_device *pdev)
 	writel(0, host->base + REG_POWER_CONTROL);
 	writel(readl(host->base + REG_CLOCK_CONTROL) | CLK_OFF,
 	       host->base + REG_CLOCK_CONTROL);
-	mmc_free_host(mmc);
 }
 
 static const struct of_device_id moxart_mmc_match[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 14/36] mmc: mvsdio: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (12 preceding siblings ...)
  2025-06-03 12:26 ` [PATCH v3 13/36] mmc: moxart-mmc: " Binbin Zhou
@ 2025-06-03 12:26 ` Binbin Zhou
  2025-06-03 12:26 ` [PATCH v3 15/36] mmc: mxcmmc: " Binbin Zhou
                   ` (22 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Nicolas Pitre

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Nicolas Pitre <nico@fluxnic.net>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/mvsdio.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index 912ffacbad88..5c738862054b 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -706,11 +706,9 @@ static int mvsd_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev);
-	if (!mmc) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
+	if (!mmc)
+		return -ENOMEM;
 
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
@@ -724,11 +722,9 @@ static int mvsd_probe(struct platform_device *pdev)
 	 * fixed rate clock).
 	 */
 	host->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(host->clk)) {
-		dev_err(&pdev->dev, "no clock associated\n");
-		ret = -EINVAL;
-		goto out;
-	}
+	if (IS_ERR(host->clk))
+		return dev_err_probe(&pdev->dev, -EINVAL, "no clock associated\n");
+
 	clk_prepare_enable(host->clk);
 
 	mmc->ops = &mvsd_ops;
@@ -787,12 +783,7 @@ static int mvsd_probe(struct platform_device *pdev)
 	return 0;
 
 out:
-	if (mmc) {
-		if (!IS_ERR(host->clk))
-			clk_disable_unprepare(host->clk);
-		mmc_free_host(mmc);
-	}
-
+	clk_disable_unprepare(host->clk);
 	return ret;
 }
 
@@ -808,7 +799,6 @@ static void mvsd_remove(struct platform_device *pdev)
 
 	if (!IS_ERR(host->clk))
 		clk_disable_unprepare(host->clk);
-	mmc_free_host(mmc);
 }
 
 static const struct of_device_id mvsdio_dt_ids[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 15/36] mmc: mxcmmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (13 preceding siblings ...)
  2025-06-03 12:26 ` [PATCH v3 14/36] mmc: mvsdio: " Binbin Zhou
@ 2025-06-03 12:26 ` Binbin Zhou
  2025-06-03 12:26 ` [PATCH v3 16/36] mmc: mxs-mmc: " Binbin Zhou
                   ` (21 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Shawn Guo, Sascha Hauer,
	Fabio Estevam

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/mxcmmc.c | 31 ++++++++++---------------------
 1 file changed, 10 insertions(+), 21 deletions(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 95d8d40a06a8..adde0e3cb9f9 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -1005,23 +1005,21 @@ static int mxcmci_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
 	host = mmc_priv(mmc);
 
 	host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
-	if (IS_ERR(host->base)) {
-		ret = PTR_ERR(host->base);
-		goto out_free;
-	}
+	if (IS_ERR(host->base))
+		return PTR_ERR(host->base);
 
 	host->phys_base = res->start;
 
 	ret = mmc_of_parse(mmc);
 	if (ret)
-		goto out_free;
+		return ret;
 	mmc->ops = &mxcmci_ops;
 
 	/* For devicetree parsing, the bus width is read from devicetree */
@@ -1054,7 +1052,7 @@ static int mxcmci_probe(struct platform_device *pdev)
 
 	ret = mmc_regulator_get_supply(mmc);
 	if (ret)
-		goto out_free;
+		return ret;
 
 	if (!mmc->ocr_avail) {
 		if (pdata && pdata->ocr_avail)
@@ -1070,20 +1068,16 @@ static int mxcmci_probe(struct platform_device *pdev)
 		host->default_irq_mask = 0;
 
 	host->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
-	if (IS_ERR(host->clk_ipg)) {
-		ret = PTR_ERR(host->clk_ipg);
-		goto out_free;
-	}
+	if (IS_ERR(host->clk_ipg))
+		return PTR_ERR(host->clk_ipg);
 
 	host->clk_per = devm_clk_get(&pdev->dev, "per");
-	if (IS_ERR(host->clk_per)) {
-		ret = PTR_ERR(host->clk_per);
-		goto out_free;
-	}
+	if (IS_ERR(host->clk_per))
+		return PTR_ERR(host->clk_per);
 
 	ret = clk_prepare_enable(host->clk_per);
 	if (ret)
-		goto out_free;
+		return ret;
 
 	ret = clk_prepare_enable(host->clk_ipg);
 	if (ret)
@@ -1169,9 +1163,6 @@ static int mxcmci_probe(struct platform_device *pdev)
 out_clk_per_put:
 	clk_disable_unprepare(host->clk_per);
 
-out_free:
-	mmc_free_host(mmc);
-
 	return ret;
 }
 
@@ -1190,8 +1181,6 @@ static void mxcmci_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(host->clk_per);
 	clk_disable_unprepare(host->clk_ipg);
-
-	mmc_free_host(mmc);
 }
 
 static int mxcmci_suspend(struct device *dev)
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 16/36] mmc: mxs-mmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (14 preceding siblings ...)
  2025-06-03 12:26 ` [PATCH v3 15/36] mmc: mxcmmc: " Binbin Zhou
@ 2025-06-03 12:26 ` Binbin Zhou
  2025-06-03 12:26 ` [PATCH v3 17/36] mmc: omap: " Binbin Zhou
                   ` (20 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Shawn Guo, Sascha Hauer,
	Fabio Estevam

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/mxs-mmc.c | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 80e6f48c83aa..a6e44e406106 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -569,7 +569,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 	if (irq_err < 0)
 		return irq_err;
 
-	mmc = mmc_alloc_host(sizeof(struct mxs_mmc_host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -577,10 +577,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 	ssp = &host->ssp;
 	ssp->dev = &pdev->dev;
 	ssp->base = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(ssp->base)) {
-		ret = PTR_ERR(ssp->base);
-		goto out_mmc_free;
-	}
+	if (IS_ERR(ssp->base))
+		return PTR_ERR(ssp->base);
 
 	ssp->devid = (enum mxs_ssp_id)of_device_get_match_data(&pdev->dev);
 
@@ -590,26 +588,23 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 	reg_vmmc = devm_regulator_get(&pdev->dev, "vmmc");
 	if (!IS_ERR(reg_vmmc)) {
 		ret = regulator_enable(reg_vmmc);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"Failed to enable vmmc regulator: %d\n", ret);
-			goto out_mmc_free;
-		}
+		if (ret)
+			return dev_err_probe(&pdev->dev, ret,
+					     "Failed to enable vmmc regulator\n");
 
 		ret = devm_add_action_or_reset(&pdev->dev, mxs_mmc_regulator_disable,
 					       reg_vmmc);
 		if (ret)
-			goto out_mmc_free;
+			return ret;
 	}
 
 	ssp->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(ssp->clk)) {
-		ret = PTR_ERR(ssp->clk);
-		goto out_mmc_free;
-	}
+	if (IS_ERR(ssp->clk))
+		return PTR_ERR(ssp->clk);
+
 	ret = clk_prepare_enable(ssp->clk);
 	if (ret)
-		goto out_mmc_free;
+		return ret;
 
 	ret = mxs_mmc_reset(host);
 	if (ret) {
@@ -668,8 +663,6 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 	dma_release_channel(ssp->dmach);
 out_clk_disable:
 	clk_disable_unprepare(ssp->clk);
-out_mmc_free:
-	mmc_free_host(mmc);
 	return ret;
 }
 
@@ -685,8 +678,6 @@ static void mxs_mmc_remove(struct platform_device *pdev)
 		dma_release_channel(ssp->dmach);
 
 	clk_disable_unprepare(ssp->clk);
-
-	mmc_free_host(mmc);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 17/36] mmc: omap: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (15 preceding siblings ...)
  2025-06-03 12:26 ` [PATCH v3 16/36] mmc: mxs-mmc: " Binbin Zhou
@ 2025-06-03 12:26 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 18/36] mmc: omap_hsmmc: " Binbin Zhou
                   ` (19 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:26 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Aaro Koskinen, Allen Pais

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Allen Pais <allen.lkml@gmail.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/omap.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index c50617d03709..57699095ae68 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1258,7 +1258,7 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
 	struct mmc_host *mmc;
 	int r;
 
-	mmc = mmc_alloc_host(sizeof(struct mmc_omap_slot), host->dev);
+	mmc = devm_mmc_alloc_host(host->dev, sizeof(*slot));
 	if (mmc == NULL)
 		return -ENOMEM;
 
@@ -1272,25 +1272,21 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
 	/* Check for some optional GPIO controls */
 	slot->vsd = devm_gpiod_get_index_optional(host->dev, "vsd",
 						  id, GPIOD_OUT_LOW);
-	if (IS_ERR(slot->vsd)) {
-		r = dev_err_probe(host->dev, PTR_ERR(slot->vsd),
+	if (IS_ERR(slot->vsd))
+		return dev_err_probe(host->dev, PTR_ERR(slot->vsd),
 				     "error looking up VSD GPIO\n");
-		goto err_free_host;
-	}
+
 	slot->vio = devm_gpiod_get_index_optional(host->dev, "vio",
 						  id, GPIOD_OUT_LOW);
-	if (IS_ERR(slot->vio)) {
-		r = dev_err_probe(host->dev, PTR_ERR(slot->vio),
+	if (IS_ERR(slot->vio))
+		return dev_err_probe(host->dev, PTR_ERR(slot->vio),
 				     "error looking up VIO GPIO\n");
-		goto err_free_host;
-	}
+
 	slot->cover = devm_gpiod_get_index_optional(host->dev, "cover",
 						    id, GPIOD_IN);
-	if (IS_ERR(slot->cover)) {
-		r = dev_err_probe(host->dev, PTR_ERR(slot->cover),
+	if (IS_ERR(slot->cover))
+		return dev_err_probe(host->dev, PTR_ERR(slot->cover),
 				     "error looking up cover switch GPIO\n");
-		goto err_free_host;
-	}
 
 	host->slots[id] = slot;
 
@@ -1350,8 +1346,6 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
 		device_remove_file(&mmc->class_dev, &dev_attr_slot_name);
 err_remove_host:
 	mmc_remove_host(mmc);
-err_free_host:
-	mmc_free_host(mmc);
 	return r;
 }
 
@@ -1369,7 +1363,6 @@ static void mmc_omap_remove_slot(struct mmc_omap_slot *slot)
 	flush_workqueue(slot->host->mmc_omap_wq);
 
 	mmc_remove_host(mmc);
-	mmc_free_host(mmc);
 }
 
 static int mmc_omap_probe(struct platform_device *pdev)
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 18/36] mmc: omap_hsmmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (16 preceding siblings ...)
  2025-06-03 12:26 ` [PATCH v3 17/36] mmc: omap: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 19/36] mmc: owl-mmc: " Binbin Zhou
                   ` (18 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/omap_hsmmc.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 59e36e0ebbbf..bf3b9f5b067c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1798,15 +1798,13 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 
-	mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev);
-	if (!mmc) {
-		ret = -ENOMEM;
-		goto err;
-	}
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
+	if (!mmc)
+		return -ENOMEM;
 
 	ret = mmc_of_parse(mmc);
 	if (ret)
-		goto err1;
+		return ret;
 
 	host		= mmc_priv(mmc);
 	host->mmc	= mmc;
@@ -1842,7 +1840,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	if (IS_ERR(host->fclk)) {
 		ret = PTR_ERR(host->fclk);
 		host->fclk = NULL;
-		goto err1;
+		return ret;
 	}
 
 	if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) {
@@ -1973,9 +1971,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	pm_runtime_put_sync(host->dev);
 	pm_runtime_disable(host->dev);
 	clk_disable_unprepare(host->dbclk);
-err1:
-	mmc_free_host(mmc);
-err:
 	return ret;
 }
 
@@ -1995,8 +1990,6 @@ static void omap_hsmmc_remove(struct platform_device *pdev)
 	pm_runtime_disable(host->dev);
 	device_init_wakeup(&pdev->dev, false);
 	clk_disable_unprepare(host->dbclk);
-
-	mmc_free_host(host->mmc);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 19/36] mmc: owl-mmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (17 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 18/36] mmc: omap_hsmmc: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 20/36] mmc: pxamci: " Binbin Zhou
                   ` (17 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Andreas Färber,
	Manivannan Sadhasivam

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Andreas Färber <afaerber@suse.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/owl-mmc.c | 37 +++++++++++++------------------------
 1 file changed, 13 insertions(+), 24 deletions(-)

diff --git a/drivers/mmc/host/owl-mmc.c b/drivers/mmc/host/owl-mmc.c
index 797ef48d9204..dc585726b66e 100644
--- a/drivers/mmc/host/owl-mmc.c
+++ b/drivers/mmc/host/owl-mmc.c
@@ -567,7 +567,7 @@ static int owl_mmc_probe(struct platform_device *pdev)
 	struct resource *res;
 	int ret;
 
-	mmc = mmc_alloc_host(sizeof(struct owl_mmc_host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*owl_host));
 	if (!mmc) {
 		dev_err(&pdev->dev, "mmc alloc host failed\n");
 		return -ENOMEM;
@@ -580,24 +580,18 @@ static int owl_mmc_probe(struct platform_device *pdev)
 	spin_lock_init(&owl_host->lock);
 
 	owl_host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
-	if (IS_ERR(owl_host->base)) {
-		ret = PTR_ERR(owl_host->base);
-		goto err_free_host;
-	}
+	if (IS_ERR(owl_host->base))
+		return PTR_ERR(owl_host->base);
 
 	owl_host->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(owl_host->clk)) {
-		dev_err(&pdev->dev, "No clock defined\n");
-		ret = PTR_ERR(owl_host->clk);
-		goto err_free_host;
-	}
+	if (IS_ERR(owl_host->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(owl_host->clk),
+				     "No clock defined\n");
 
 	owl_host->reset = devm_reset_control_get_exclusive(&pdev->dev, NULL);
-	if (IS_ERR(owl_host->reset)) {
-		dev_err(&pdev->dev, "Could not get reset control\n");
-		ret = PTR_ERR(owl_host->reset);
-		goto err_free_host;
-	}
+	if (IS_ERR(owl_host->reset))
+		return dev_err_probe(&pdev->dev, PTR_ERR(owl_host->reset),
+				     "Could not get reset control\n");
 
 	mmc->ops		= &owl_mmc_ops;
 	mmc->max_blk_count	= 512;
@@ -616,16 +610,14 @@ static int owl_mmc_probe(struct platform_device *pdev)
 
 	ret = mmc_of_parse(mmc);
 	if (ret)
-		goto err_free_host;
+		return ret;
 
 	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 	pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
 	owl_host->dma = dma_request_chan(&pdev->dev, "mmc");
-	if (IS_ERR(owl_host->dma)) {
-		dev_err(owl_host->dev, "Failed to get external DMA channel.\n");
-		ret = PTR_ERR(owl_host->dma);
-		goto err_free_host;
-	}
+	if (IS_ERR(owl_host->dma))
+		return dev_err_probe(&pdev->dev, PTR_ERR(owl_host->dma),
+				     "Failed to get external DMA channel.\n");
 
 	dev_info(&pdev->dev, "Using %s for DMA transfers\n",
 		 dma_chan_name(owl_host->dma));
@@ -662,8 +654,6 @@ static int owl_mmc_probe(struct platform_device *pdev)
 
 err_release_channel:
 	dma_release_channel(owl_host->dma);
-err_free_host:
-	mmc_free_host(mmc);
 
 	return ret;
 }
@@ -676,7 +666,6 @@ static void owl_mmc_remove(struct platform_device *pdev)
 	mmc_remove_host(mmc);
 	disable_irq(owl_host->irq);
 	dma_release_channel(owl_host->dma);
-	mmc_free_host(mmc);
 }
 
 static const struct of_device_id owl_mmc_of_match[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 20/36] mmc: pxamci: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (18 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 19/36] mmc: owl-mmc: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 21/36] mmc: rtsx_pci: " Binbin Zhou
                   ` (16 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/pxamci.c | 42 ++++++++++++++-------------------------
 1 file changed, 15 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 2d0ad006913d..26d03352af63 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -615,11 +615,9 @@ static int pxamci_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	mmc = mmc_alloc_host(sizeof(struct pxamci_host), dev);
-	if (!mmc) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	mmc = devm_mmc_alloc_host(dev, sizeof(*host));
+	if (!mmc)
+		return -ENOMEM;
 
 	mmc->ops = &pxamci_ops;
 
@@ -646,7 +644,7 @@ static int pxamci_probe(struct platform_device *pdev)
 
 	ret = pxamci_of_init(pdev, mmc);
 	if (ret)
-		goto out;
+		return ret;
 
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
@@ -655,9 +653,8 @@ static int pxamci_probe(struct platform_device *pdev)
 
 	host->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(host->clk)) {
-		ret = PTR_ERR(host->clk);
 		host->clk = NULL;
-		goto out;
+		return PTR_ERR(host->clk);
 	}
 
 	host->clkrate = clk_get_rate(host->clk);
@@ -670,7 +667,7 @@ static int pxamci_probe(struct platform_device *pdev)
 
 	ret = pxamci_init_ocr(host);
 	if (ret < 0)
-		goto out;
+		return ret;
 
 	mmc->caps = 0;
 	host->cmdat = 0;
@@ -686,10 +683,8 @@ static int pxamci_probe(struct platform_device *pdev)
 	host->imask = MMC_I_MASK_ALL;
 
 	host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
-	if (IS_ERR(host->base)) {
-		ret = PTR_ERR(host->base);
-		goto out;
-	}
+	if (IS_ERR(host->base))
+		return PTR_ERR(host->base);
 	host->res = r;
 
 	/*
@@ -704,16 +699,15 @@ static int pxamci_probe(struct platform_device *pdev)
 	ret = devm_request_irq(dev, irq, pxamci_irq, 0,
 			       DRIVER_NAME, host);
 	if (ret)
-		goto out;
+		return ret;
 
 	platform_set_drvdata(pdev, mmc);
 
 	host->dma_chan_rx = dma_request_chan(dev, "rx");
 	if (IS_ERR(host->dma_chan_rx)) {
-		dev_err(dev, "unable to request rx dma channel\n");
-		ret = PTR_ERR(host->dma_chan_rx);
 		host->dma_chan_rx = NULL;
-		goto out;
+		return dev_err_probe(dev, PTR_ERR(host->dma_chan_rx),
+				     "unable to request rx dma channel\n");
 	}
 
 	host->dma_chan_tx = dma_request_chan(dev, "tx");
@@ -771,14 +765,10 @@ static int pxamci_probe(struct platform_device *pdev)
 	return 0;
 
 out:
-	if (host) {
-		if (host->dma_chan_rx)
-			dma_release_channel(host->dma_chan_rx);
-		if (host->dma_chan_tx)
-			dma_release_channel(host->dma_chan_tx);
-	}
-	if (mmc)
-		mmc_free_host(mmc);
+	if (host->dma_chan_rx)
+		dma_release_channel(host->dma_chan_rx);
+	if (host->dma_chan_tx)
+		dma_release_channel(host->dma_chan_tx);
 	return ret;
 }
 
@@ -803,8 +793,6 @@ static void pxamci_remove(struct platform_device *pdev)
 		dmaengine_terminate_all(host->dma_chan_tx);
 		dma_release_channel(host->dma_chan_rx);
 		dma_release_channel(host->dma_chan_tx);
-
-		mmc_free_host(mmc);
 	}
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 21/36] mmc: rtsx_pci: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (19 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 20/36] mmc: pxamci: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 22/36] mmc: rtsx_usb_sdmmc: " Binbin Zhou
                   ` (15 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 0c6eb60a95fd..dc2587ff8519 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -1498,7 +1498,7 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)
 
 	dev_dbg(&(pdev->dev), ": Realtek PCI-E SDMMC controller found\n");
 
-	mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -1529,7 +1529,6 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)
 	if (ret) {
 		pm_runtime_dont_use_autosuspend(&pdev->dev);
 		pm_runtime_disable(&pdev->dev);
-		mmc_free_host(mmc);
 		return ret;
 	}
 
@@ -1572,8 +1571,6 @@ static void rtsx_pci_sdmmc_drv_remove(struct platform_device *pdev)
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
-	mmc_free_host(mmc);
-
 	dev_dbg(&(pdev->dev),
 		": Realtek PCI-E SDMMC controller has been removed\n");
 }
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 22/36] mmc: rtsx_usb_sdmmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (20 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 21/36] mmc: rtsx_pci: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 23/36] mmc: sdricoh_cs: " Binbin Zhou
                   ` (14 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
index d229c2b83ea9..9c5d695d04b1 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -1334,7 +1334,7 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
 
 	dev_dbg(&(pdev->dev), ": Realtek USB SD/MMC controller found\n");
 
-	mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -1368,7 +1368,6 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
 #ifdef RTSX_USB_USE_LEDS_CLASS
 		led_classdev_unregister(&host->led);
 #endif
-		mmc_free_host(mmc);
 		pm_runtime_disable(&pdev->dev);
 		return ret;
 	}
@@ -1406,7 +1405,6 @@ static void rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev)
 	led_classdev_unregister(&host->led);
 #endif
 
-	mmc_free_host(mmc);
 	pm_runtime_disable(&pdev->dev);
 	platform_set_drvdata(pdev, NULL);
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 23/36] mmc: sdricoh_cs: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (21 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 22/36] mmc: rtsx_usb_sdmmc: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 24/36] mmc: sh_mmicf: " Binbin Zhou
                   ` (13 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sdricoh_cs.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c
index 57b8c1a96756..481cb552c2b4 100644
--- a/drivers/mmc/host/sdricoh_cs.c
+++ b/drivers/mmc/host/sdricoh_cs.c
@@ -403,9 +403,9 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
 	}
 	/* allocate privdata */
 	mmc = pcmcia_dev->priv =
-	    mmc_alloc_host(sizeof(struct sdricoh_host), &pcmcia_dev->dev);
+	    devm_mmc_alloc_host(&pcmcia_dev->dev, sizeof(*host));
 	if (!mmc) {
-		dev_err(dev, "mmc_alloc_host failed\n");
+		dev_err(dev, "devm_mmc_alloc_host failed\n");
 		result = -ENOMEM;
 		goto unmap_io;
 	}
@@ -431,7 +431,7 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
 	if (sdricoh_reset(host)) {
 		dev_dbg(dev, "could not reset\n");
 		result = -EIO;
-		goto free_host;
+		goto unmap_io;
 	}
 
 	result = mmc_add_host(mmc);
@@ -440,8 +440,6 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
 		dev_dbg(dev, "mmc host registered\n");
 		return 0;
 	}
-free_host:
-	mmc_free_host(mmc);
 unmap_io:
 	pci_iounmap(pci_dev, iobase);
 	return result;
@@ -483,10 +481,8 @@ static void sdricoh_pcmcia_detach(struct pcmcia_device *link)
 		mmc_remove_host(mmc);
 		pci_iounmap(host->pci_dev, host->iobase);
 		pci_dev_put(host->pci_dev);
-		mmc_free_host(mmc);
 	}
 	pcmcia_disable_device(link);
-
 }
 
 #ifdef CONFIG_PM
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 24/36] mmc: sh_mmicf: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (22 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 23/36] mmc: sdricoh_cs: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 25/36] mmc: tifm_sd: " Binbin Zhou
                   ` (12 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sh_mmcif.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index ce60cec26b98..19f84584ecfa 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1444,13 +1444,13 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	if (IS_ERR(reg))
 		return PTR_ERR(reg);
 
-	mmc = mmc_alloc_host(sizeof(struct sh_mmcif_host), dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
 	ret = mmc_of_parse(mmc);
 	if (ret < 0)
-		goto err_host;
+		return ret;
 
 	host		= mmc_priv(mmc);
 	host->mmc	= mmc;
@@ -1481,15 +1481,13 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, host);
 
 	host->clk = devm_clk_get(dev, NULL);
-	if (IS_ERR(host->clk)) {
-		ret = PTR_ERR(host->clk);
-		dev_err(dev, "cannot get clock: %d\n", ret);
-		goto err_host;
-	}
+	if (IS_ERR(host->clk))
+		return dev_err_probe(dev, PTR_ERR(host->clk),
+				     "cannot get clock\n");
 
 	ret = clk_prepare_enable(host->clk);
 	if (ret < 0)
-		goto err_host;
+		return ret;
 
 	sh_mmcif_clk_setup(host);
 
@@ -1542,8 +1540,6 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	clk_disable_unprepare(host->clk);
 	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
-err_host:
-	mmc_free_host(mmc);
 	return ret;
 }
 
@@ -1568,7 +1564,6 @@ static void sh_mmcif_remove(struct platform_device *pdev)
 	cancel_delayed_work_sync(&host->timeout_work);
 
 	clk_disable_unprepare(host->clk);
-	mmc_free_host(host->mmc);
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 }
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 25/36] mmc: tifm_sd: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (23 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 24/36] mmc: sh_mmicf: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 26/36] mmc: toshsd: " Binbin Zhou
                   ` (11 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Alex Dubov

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Alex Dubov <oakad@yahoo.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/tifm_sd.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
index 713223f2d377..92b438003576 100644
--- a/drivers/mmc/host/tifm_sd.c
+++ b/drivers/mmc/host/tifm_sd.c
@@ -947,7 +947,7 @@ static int tifm_sd_probe(struct tifm_dev *sock)
 		return rc;
 	}
 
-	mmc = mmc_alloc_host(sizeof(struct tifm_sd), &sock->dev);
+	mmc = devm_mmc_alloc_host(&sock->dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -982,10 +982,7 @@ static int tifm_sd_probe(struct tifm_dev *sock)
 
 	if (!rc)
 		rc = mmc_add_host(mmc);
-	if (!rc)
-		return 0;
 
-	mmc_free_host(mmc);
 	return rc;
 }
 
@@ -1015,8 +1012,6 @@ static void tifm_sd_remove(struct tifm_dev *sock)
 	spin_unlock_irqrestore(&sock->lock, flags);
 	mmc_remove_host(mmc);
 	dev_dbg(&sock->dev, "after remove\n");
-
-	mmc_free_host(mmc);
 }
 
 #ifdef CONFIG_PM
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 26/36] mmc: toshsd: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (24 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 25/36] mmc: tifm_sd: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 27/36] mmc: usdhi6ro10: " Binbin Zhou
                   ` (10 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/toshsd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/toshsd.c b/drivers/mmc/host/toshsd.c
index 497791ffada6..e5f7f8abafc0 100644
--- a/drivers/mmc/host/toshsd.c
+++ b/drivers/mmc/host/toshsd.c
@@ -612,7 +612,7 @@ static int toshsd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		return ret;
 
-	mmc = mmc_alloc_host(sizeof(struct toshsd_host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc) {
 		ret = -ENOMEM;
 		goto err;
@@ -669,7 +669,6 @@ static int toshsd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 release:
 	pci_release_regions(pdev);
 free:
-	mmc_free_host(mmc);
 	pci_set_drvdata(pdev, NULL);
 err:
 	pci_disable_device(pdev);
@@ -685,7 +684,6 @@ static void toshsd_remove(struct pci_dev *pdev)
 	free_irq(pdev->irq, host);
 	pci_iounmap(pdev, host->ioaddr);
 	pci_release_regions(pdev);
-	mmc_free_host(host->mmc);
 	pci_set_drvdata(pdev, NULL);
 	pci_disable_device(pdev);
 }
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 27/36] mmc: usdhi6ro10: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (25 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 26/36] mmc: toshsd: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 28/36] mmc: ushc: " Binbin Zhou
                   ` (9 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Jesper Nilsson, Lars Persson

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Lars Persson <lars.persson@axis.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/usdhi6rol0.c | 30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
index 49efb960a052..85b49c07918b 100644
--- a/drivers/mmc/host/usdhi6rol0.c
+++ b/drivers/mmc/host/usdhi6rol0.c
@@ -1762,17 +1762,17 @@ static int usdhi6_probe(struct platform_device *pdev)
 	if (irq_sdio < 0)
 		return irq_sdio;
 
-	mmc = mmc_alloc_host(sizeof(struct usdhi6_host), dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
 	ret = mmc_regulator_get_supply(mmc);
 	if (ret)
-		goto e_free_mmc;
+		return ret;
 
 	ret = mmc_of_parse(mmc);
 	if (ret < 0)
-		goto e_free_mmc;
+		return ret;
 
 	host		= mmc_priv(mmc);
 	host->mmc	= mmc;
@@ -1785,30 +1785,24 @@ static int usdhi6_probe(struct platform_device *pdev)
 	mmc->max_busy_timeout = USDHI6_REQ_TIMEOUT_MS;
 
 	host->pinctrl = devm_pinctrl_get(&pdev->dev);
-	if (IS_ERR(host->pinctrl)) {
-		ret = PTR_ERR(host->pinctrl);
-		goto e_free_mmc;
-	}
+	if (IS_ERR(host->pinctrl))
+		return PTR_ERR(host->pinctrl);
 
 	host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs");
 
 	host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
-	if (IS_ERR(host->base)) {
-		ret = PTR_ERR(host->base);
-		goto e_free_mmc;
-	}
+	if (IS_ERR(host->base))
+		return PTR_ERR(host->base);
 
 	host->clk = devm_clk_get(dev, NULL);
-	if (IS_ERR(host->clk)) {
-		ret = PTR_ERR(host->clk);
-		goto e_free_mmc;
-	}
+	if (IS_ERR(host->clk))
+		return PTR_ERR(host->clk);
 
 	host->imclk = clk_get_rate(host->clk);
 
 	ret = clk_prepare_enable(host->clk);
 	if (ret < 0)
-		goto e_free_mmc;
+		return ret;
 
 	version = usdhi6_read(host, USDHI6_VERSION);
 	if ((version & 0xfff) != 0xa0d) {
@@ -1878,9 +1872,6 @@ static int usdhi6_probe(struct platform_device *pdev)
 	usdhi6_dma_release(host);
 e_clk_off:
 	clk_disable_unprepare(host->clk);
-e_free_mmc:
-	mmc_free_host(mmc);
-
 	return ret;
 }
 
@@ -1894,7 +1885,6 @@ static void usdhi6_remove(struct platform_device *pdev)
 	cancel_delayed_work_sync(&host->timeout_work);
 	usdhi6_dma_release(host);
 	clk_disable_unprepare(host->clk);
-	mmc_free_host(host->mmc);
 }
 
 static struct platform_driver usdhi6_driver = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 28/36] mmc: ushc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (26 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 27/36] mmc: usdhi6ro10: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:27 ` [PATCH v3 29/36] mmc: via-sdmmc: " Binbin Zhou
                   ` (8 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/ushc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c
index 9a6358fd9512..2b7456e942f7 100644
--- a/drivers/mmc/host/ushc.c
+++ b/drivers/mmc/host/ushc.c
@@ -404,8 +404,6 @@ static void ushc_clean_up(struct ushc_data *ushc)
 	kfree(ushc->int_data);
 	kfree(ushc->cbw);
 	kfree(ushc->csw);
-
-	mmc_free_host(ushc->mmc);
 }
 
 static const struct mmc_host_ops ushc_ops = {
@@ -425,7 +423,7 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	if (intf->cur_altsetting->desc.bNumEndpoints < 1)
 		return -ENODEV;
 
-	mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev);
+	mmc = devm_mmc_alloc_host(&intf->dev, sizeof(*ushc));
 	if (mmc == NULL)
 		return -ENOMEM;
 	ushc = mmc_priv(mmc);
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 29/36] mmc: via-sdmmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (27 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 28/36] mmc: ushc: " Binbin Zhou
@ 2025-06-03 12:27 ` Binbin Zhou
  2025-06-03 12:28 ` [PATCH v3 30/36] mmc: vub300: " Binbin Zhou
                   ` (7 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:27 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/via-sdmmc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/via-sdmmc.c b/drivers/mmc/host/via-sdmmc.c
index 909d80a02824..083ab9836311 100644
--- a/drivers/mmc/host/via-sdmmc.c
+++ b/drivers/mmc/host/via-sdmmc.c
@@ -1100,7 +1100,7 @@ static int via_sd_probe(struct pci_dev *pcidev,
 	pci_write_config_byte(pcidev, VIA_CRDR_PCI_WORK_MODE, 0);
 	pci_write_config_byte(pcidev, VIA_CRDR_PCI_DBG_MODE, 0);
 
-	mmc = mmc_alloc_host(sizeof(struct via_crdr_mmc_host), &pcidev->dev);
+	mmc = devm_mmc_alloc_host(&pcidev->dev, sizeof(*sdhost));
 	if (!mmc) {
 		ret = -ENOMEM;
 		goto release;
@@ -1115,7 +1115,7 @@ static int via_sd_probe(struct pci_dev *pcidev,
 	sdhost->mmiobase = ioremap(base, len);
 	if (!sdhost->mmiobase) {
 		ret = -ENOMEM;
-		goto free_mmc_host;
+		goto release;
 	}
 
 	sdhost->sdhc_mmiobase =
@@ -1160,8 +1160,6 @@ static int via_sd_probe(struct pci_dev *pcidev,
 
 unmap:
 	iounmap(sdhost->mmiobase);
-free_mmc_host:
-	mmc_free_host(mmc);
 release:
 	pci_release_regions(pcidev);
 disable:
@@ -1212,7 +1210,6 @@ static void via_sd_remove(struct pci_dev *pcidev)
 	writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);
 
 	iounmap(sdhost->mmiobase);
-	mmc_free_host(sdhost->mmc);
 	pci_release_regions(pcidev);
 	pci_disable_device(pcidev);
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 30/36] mmc: vub300: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (28 preceding siblings ...)
  2025-06-03 12:27 ` [PATCH v3 29/36] mmc: via-sdmmc: " Binbin Zhou
@ 2025-06-03 12:28 ` Binbin Zhou
  2025-06-03 12:28 ` [PATCH v3 31/36] mmc: wbsd: " Binbin Zhou
                   ` (6 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:28 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/vub300.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index dd71e5b8e1a5..5a5eeeaa4321 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -369,13 +369,11 @@ struct vub300_mmc_host {
 static void vub300_delete(struct kref *kref)
 {				/* kref callback - softirq */
 	struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
-	struct mmc_host *mmc = vub300->mmc;
 	usb_free_urb(vub300->command_out_urb);
 	vub300->command_out_urb = NULL;
 	usb_free_urb(vub300->command_res_urb);
 	vub300->command_res_urb = NULL;
 	usb_put_dev(vub300->udev);
-	mmc_free_host(mmc);
 	/*
 	 * and hence also frees vub300
 	 * which is contained at the end of struct mmc
@@ -2114,7 +2112,7 @@ static int vub300_probe(struct usb_interface *interface,
 		goto error1;
 	}
 	/* this also allocates memory for our VUB300 mmc host device */
-	mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), &udev->dev);
+	mmc = devm_mmc_alloc_host(&udev->dev, sizeof(*vub300));
 	if (!mmc) {
 		retval = -ENOMEM;
 		dev_err(&udev->dev, "not enough memory for the mmc_host\n");
@@ -2271,7 +2269,7 @@ static int vub300_probe(struct usb_interface *interface,
 		dev_err(&vub300->udev->dev,
 		    "Could not find two sets of bulk-in/out endpoint pairs\n");
 		retval = -EINVAL;
-		goto error5;
+		goto error4;
 	}
 	retval =
 		usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
@@ -2280,14 +2278,14 @@ static int vub300_probe(struct usb_interface *interface,
 				0x0000, 0x0000, &vub300->hc_info,
 				sizeof(vub300->hc_info), 1000);
 	if (retval < 0)
-		goto error5;
+		goto error4;
 	retval =
 		usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
 				SET_ROM_WAIT_STATES,
 				USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 				firmware_rom_wait_states, 0x0000, NULL, 0, 1000);
 	if (retval < 0)
-		goto error5;
+		goto error4;
 	dev_info(&vub300->udev->dev,
 		 "operating_mode = %s %s %d MHz %s %d byte USB packets\n",
 		 (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL",
@@ -2302,7 +2300,7 @@ static int vub300_probe(struct usb_interface *interface,
 				0x0000, 0x0000, &vub300->system_port_status,
 				sizeof(vub300->system_port_status), 1000);
 	if (retval < 0) {
-		goto error5;
+		goto error4;
 	} else if (sizeof(vub300->system_port_status) == retval) {
 		vub300->card_present =
 			(0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
@@ -2310,7 +2308,7 @@ static int vub300_probe(struct usb_interface *interface,
 			(0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
 	} else {
 		retval = -EINVAL;
-		goto error5;
+		goto error4;
 	}
 	usb_set_intfdata(interface, vub300);
 	INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread);
@@ -2340,8 +2338,6 @@ static int vub300_probe(struct usb_interface *interface,
 	return 0;
 error6:
 	timer_delete_sync(&vub300->inactivity_timer);
-error5:
-	mmc_free_host(mmc);
 	/*
 	 * and hence also frees vub300
 	 * which is contained at the end of struct mmc
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 31/36] mmc: wbsd: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (29 preceding siblings ...)
  2025-06-03 12:28 ` [PATCH v3 30/36] mmc: vub300: " Binbin Zhou
@ 2025-06-03 12:28 ` Binbin Zhou
  2025-06-03 12:28 ` [PATCH v3 32/36] mmc: wmt-sdmmc: " Binbin Zhou
                   ` (5 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:28 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Pierre Ossman

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Pierre Ossman <pierre@ossman.eu>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/wbsd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index d5974b355a5a..392522a29430 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -1190,7 +1190,7 @@ static int wbsd_alloc_mmc(struct device *dev)
 	/*
 	 * Allocate MMC structure.
 	 */
-	mmc = mmc_alloc_host(sizeof(struct wbsd_host), dev);
+	mmc = devm_mmc_alloc_host(dev, sizeof(*host));
 	if (!mmc)
 		return -ENOMEM;
 
@@ -1262,8 +1262,6 @@ static void wbsd_free_mmc(struct device *dev)
 	BUG_ON(host == NULL);
 
 	timer_delete_sync(&host->ignore_timer);
-
-	mmc_free_host(mmc);
 }
 
 /*
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 32/36] mmc: wmt-sdmmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (30 preceding siblings ...)
  2025-06-03 12:28 ` [PATCH v3 31/36] mmc: wbsd: " Binbin Zhou
@ 2025-06-03 12:28 ` Binbin Zhou
  2025-06-03 12:28 ` [PATCH v3 33/36] mmc: tmio: " Binbin Zhou
                   ` (4 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:28 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Alexey Charkov

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Alexey Charkov <alchark@gmail.com>
Acked-by: Alexey Charkov <alchark@gmail.com>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/wmt-sdmmc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
index cdb36a9f9e38..0d2929cfe397 100644
--- a/drivers/mmc/host/wmt-sdmmc.c
+++ b/drivers/mmc/host/wmt-sdmmc.c
@@ -774,7 +774,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
 		goto fail1;
 	}
 
-	mmc = mmc_alloc_host(sizeof(struct wmt_mci_priv), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*priv));
 	if (!mmc) {
 		dev_err(&pdev->dev, "Failed to allocate mmc_host\n");
 		ret = -ENOMEM;
@@ -808,7 +808,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
 	if (!priv->sdmmc_base) {
 		dev_err(&pdev->dev, "Failed to map IO space\n");
 		ret = -ENOMEM;
-		goto fail2;
+		goto fail1;
 	}
 
 	priv->irq_regular = regular_irq;
@@ -873,8 +873,6 @@ static int wmt_mci_probe(struct platform_device *pdev)
 	free_irq(regular_irq, priv);
 fail3:
 	iounmap(priv->sdmmc_base);
-fail2:
-	mmc_free_host(mmc);
 fail1:
 	return ret;
 }
@@ -910,8 +908,6 @@ static void wmt_mci_remove(struct platform_device *pdev)
 	clk_disable_unprepare(priv->clk_sdmmc);
 	clk_put(priv->clk_sdmmc);
 
-	mmc_free_host(mmc);
-
 	dev_info(&pdev->dev, "WMT MCI device removed\n");
 }
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 33/36] mmc: tmio: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (31 preceding siblings ...)
  2025-06-03 12:28 ` [PATCH v3 32/36] mmc: wmt-sdmmc: " Binbin Zhou
@ 2025-06-03 12:28 ` Binbin Zhou
  2025-06-03 12:28 ` [PATCH v3 34/36] mmc: sunxi: " Binbin Zhou
                   ` (3 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:28 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Wolfram Sang,
	Kunihiko Hayashi, Masami Hiramatsu

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/renesas_sdhi_core.c |  6 +-----
 drivers/mmc/host/tmio_mmc.h          |  1 -
 drivers/mmc/host/tmio_mmc_core.c     | 18 +++---------------
 drivers/mmc/host/uniphier-sd.c       |  8 ++------
 4 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index e6fa3ed42560..4647d86e145e 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -1164,7 +1164,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 
 	ret = renesas_sdhi_clk_enable(host);
 	if (ret)
-		goto efree;
+		return ret;
 
 	rcfg.of_node = of_get_available_child_by_name(dev->of_node, "vqmmc-regulator");
 	if (rcfg.of_node) {
@@ -1266,9 +1266,6 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 
 edisclk:
 	renesas_sdhi_clk_disable(host);
-efree:
-	tmio_mmc_host_free(host);
-
 	return ret;
 }
 EXPORT_SYMBOL_GPL(renesas_sdhi_probe);
@@ -1279,7 +1276,6 @@ void renesas_sdhi_remove(struct platform_device *pdev)
 
 	tmio_mmc_host_remove(host);
 	renesas_sdhi_clk_disable(host);
-	tmio_mmc_host_free(host);
 }
 EXPORT_SYMBOL_GPL(renesas_sdhi_remove);
 
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 41787ea77a13..23b0be8e6d7d 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -199,7 +199,6 @@ struct tmio_mmc_host {
 
 struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
 					  struct tmio_mmc_data *pdata);
-void tmio_mmc_host_free(struct tmio_mmc_host *host);
 int tmio_mmc_host_probe(struct tmio_mmc_host *host);
 void tmio_mmc_host_remove(struct tmio_mmc_host *host);
 void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index b71241f55df5..c25c5fec3d77 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1097,7 +1097,7 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
 	if (IS_ERR(ctl))
 		return ERR_CAST(ctl);
 
-	mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
 	if (!mmc)
 		return ERR_PTR(-ENOMEM);
 
@@ -1110,29 +1110,17 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
 	mmc->ops = &host->ops;
 
 	ret = mmc_of_parse(host->mmc);
-	if (ret) {
-		host = ERR_PTR(ret);
-		goto free;
-	}
+	if (ret)
+		return ERR_PTR(ret);
 
 	tmio_mmc_of_parse(pdev, mmc);
 
 	platform_set_drvdata(pdev, host);
 
-	return host;
-free:
-	mmc_free_host(mmc);
-
 	return host;
 }
 EXPORT_SYMBOL_GPL(tmio_mmc_host_alloc);
 
-void tmio_mmc_host_free(struct tmio_mmc_host *host)
-{
-	mmc_free_host(host->mmc);
-}
-EXPORT_SYMBOL_GPL(tmio_mmc_host_free);
-
 int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
 {
 	struct platform_device *pdev = _host->pdev;
diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c
index 4ad02cfdc238..1eae2f4b6c1f 100644
--- a/drivers/mmc/host/uniphier-sd.c
+++ b/drivers/mmc/host/uniphier-sd.c
@@ -663,8 +663,7 @@ static int uniphier_sd_probe(struct platform_device *pdev)
 		priv->rst_hw = devm_reset_control_get_exclusive(dev, "hw");
 		if (IS_ERR(priv->rst_hw)) {
 			dev_err(dev, "failed to get hw reset\n");
-			ret = PTR_ERR(priv->rst_hw);
-			goto free_host;
+			return PTR_ERR(priv->rst_hw);
 		}
 		host->ops.card_hw_reset = uniphier_sd_hw_reset;
 	}
@@ -694,7 +693,7 @@ static int uniphier_sd_probe(struct platform_device *pdev)
 
 	ret = uniphier_sd_clk_enable(host);
 	if (ret)
-		goto free_host;
+		return ret;
 
 	uniphier_sd_host_init(host);
 
@@ -720,8 +719,6 @@ static int uniphier_sd_probe(struct platform_device *pdev)
 
 disable_clk:
 	uniphier_sd_clk_disable(host);
-free_host:
-	tmio_mmc_host_free(host);
 
 	return ret;
 }
@@ -732,7 +729,6 @@ static void uniphier_sd_remove(struct platform_device *pdev)
 
 	tmio_mmc_host_remove(host);
 	uniphier_sd_clk_disable(host);
-	tmio_mmc_host_free(host);
 }
 
 static const struct of_device_id uniphier_sd_match[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 34/36] mmc: sunxi: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (32 preceding siblings ...)
  2025-06-03 12:28 ` [PATCH v3 33/36] mmc: tmio: " Binbin Zhou
@ 2025-06-03 12:28 ` Binbin Zhou
  2025-06-03 12:28 ` [PATCH v3 35/36] mmc: mmc_spi: " Binbin Zhou
                   ` (2 subsequent siblings)
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:28 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, linux-sunxi

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Samuel Holland <samuel@sholland.org>
Cc: linux-sunxi@lists.linux.dev
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/sunxi-mmc.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 1508eead5d01..ee4a65b0a22d 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1369,11 +1369,10 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
 	struct mmc_host *mmc;
 	int ret;
 
-	mmc = mmc_alloc_host(sizeof(struct sunxi_mmc_host), &pdev->dev);
-	if (!mmc) {
-		dev_err(&pdev->dev, "mmc alloc host failed\n");
-		return -ENOMEM;
-	}
+	mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
+	if (!mmc)
+		return dev_err_probe(&pdev->dev, -ENOMEM,
+				     "mmc alloc host failed\n");
 	platform_set_drvdata(pdev, mmc);
 
 	host = mmc_priv(mmc);
@@ -1383,15 +1382,13 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
 
 	ret = sunxi_mmc_resource_request(host, pdev);
 	if (ret)
-		goto error_free_host;
+		return ret;
 
 	host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
 					  &host->sg_dma, GFP_KERNEL);
-	if (!host->sg_cpu) {
-		dev_err(&pdev->dev, "Failed to allocate DMA descriptor mem\n");
-		ret = -ENOMEM;
-		goto error_free_host;
-	}
+	if (!host->sg_cpu)
+		return dev_err_probe(&pdev->dev, -ENOMEM,
+				     "Failed to allocate DMA descriptor mem\n");
 
 	if (host->cfg->ccu_has_timings_switch) {
 		/*
@@ -1481,8 +1478,6 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
 
 error_free_dma:
 	dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
-error_free_host:
-	mmc_free_host(mmc);
 	return ret;
 }
 
@@ -1498,7 +1493,6 @@ static void sunxi_mmc_remove(struct platform_device *pdev)
 		sunxi_mmc_disable(host);
 	}
 	dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
-	mmc_free_host(mmc);
 }
 
 #ifdef CONFIG_PM
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 35/36] mmc: mmc_spi: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (33 preceding siblings ...)
  2025-06-03 12:28 ` [PATCH v3 34/36] mmc: sunxi: " Binbin Zhou
@ 2025-06-03 12:28 ` Binbin Zhou
  2025-06-03 12:28 ` [PATCH v3 36/36] mmc: meson-mx-sdio: " Binbin Zhou
  2025-06-19 11:19 ` [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Ulf Hansson
  36 siblings, 0 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:28 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson; +Cc: Huacai Chen, linux-mmc, Binbin Zhou

Use new function devm_mmc_alloc_host() to simplify the code.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/mmc_spi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 47443fb5eb33..35b0ad273b4f 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1185,7 +1185,7 @@ static int mmc_spi_probe(struct spi_device *spi)
 		goto nomem;
 	memset(ones, 0xff, MMC_SPI_BLOCKSIZE);
 
-	mmc = mmc_alloc_host(sizeof(*host), &spi->dev);
+	mmc = devm_mmc_alloc_host(&spi->dev, sizeof(*host));
 	if (!mmc)
 		goto nomem;
 
@@ -1305,7 +1305,6 @@ static int mmc_spi_probe(struct spi_device *spi)
 	kfree(host->data);
 fail_nobuf1:
 	mmc_spi_put_pdata(spi);
-	mmc_free_host(mmc);
 nomem:
 	kfree(ones);
 	return status;
@@ -1328,7 +1327,6 @@ static void mmc_spi_remove(struct spi_device *spi)
 
 	spi->max_speed_hz = mmc->f_max;
 	mmc_spi_put_pdata(spi);
-	mmc_free_host(mmc);
 }
 
 static const struct spi_device_id mmc_spi_dev_ids[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3 36/36] mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (34 preceding siblings ...)
  2025-06-03 12:28 ` [PATCH v3 35/36] mmc: mmc_spi: " Binbin Zhou
@ 2025-06-03 12:28 ` Binbin Zhou
  2025-06-03 20:02   ` Martin Blumenstingl
  2025-06-03 20:49   ` Martin Blumenstingl
  2025-06-19 11:19 ` [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Ulf Hansson
  36 siblings, 2 replies; 45+ messages in thread
From: Binbin Zhou @ 2025-06-03 12:28 UTC (permalink / raw)
  To: Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Binbin Zhou, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, linux-amlogic

Use new function devm_mmc_alloc_host() to simplify the code.

Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-amlogic@lists.infradead.org
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 drivers/mmc/host/meson-mx-sdio.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c
index e0ae5a0c9670..b6cb475f1a5f 100644
--- a/drivers/mmc/host/meson-mx-sdio.c
+++ b/drivers/mmc/host/meson-mx-sdio.c
@@ -640,7 +640,7 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
 	else if (IS_ERR(slot_pdev))
 		return PTR_ERR(slot_pdev);
 
-	mmc = mmc_alloc_host(sizeof(*host), &slot_pdev->dev);
+	mmc = devm_mmc_alloc_host(&slot_pdev->dev, sizeof(*host));
 	if (!mmc) {
 		ret = -ENOMEM;
 		goto error_unregister_slot_pdev;
@@ -658,13 +658,13 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
 	host->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(host->base)) {
 		ret = PTR_ERR(host->base);
-		goto error_free_mmc;
+		goto error_unregister_slot_pdev;
 	}
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		ret = irq;
-		goto error_free_mmc;
+		goto error_unregister_slot_pdev;
 	}
 
 	ret = devm_request_threaded_irq(host->controller_dev, irq,
@@ -672,28 +672,28 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
 					meson_mx_mmc_irq_thread, IRQF_ONESHOT,
 					NULL, host);
 	if (ret)
-		goto error_free_mmc;
+		goto error_unregister_slot_pdev;
 
 	host->core_clk = devm_clk_get(host->controller_dev, "core");
 	if (IS_ERR(host->core_clk)) {
 		ret = PTR_ERR(host->core_clk);
-		goto error_free_mmc;
+		goto error_unregister_slot_pdev;
 	}
 
 	host->parent_clk = devm_clk_get(host->controller_dev, "clkin");
 	if (IS_ERR(host->parent_clk)) {
 		ret = PTR_ERR(host->parent_clk);
-		goto error_free_mmc;
+		goto error_unregister_slot_pdev;
 	}
 
 	ret = meson_mx_mmc_register_clks(host);
 	if (ret)
-		goto error_free_mmc;
+		goto error_unregister_slot_pdev;
 
 	ret = clk_prepare_enable(host->core_clk);
 	if (ret) {
 		dev_err(host->controller_dev, "Failed to enable core clock\n");
-		goto error_free_mmc;
+		goto error_unregister_slot_pdev;
 	}
 
 	ret = clk_prepare_enable(host->cfg_div_clk);
@@ -721,8 +721,6 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
 	clk_disable_unprepare(host->cfg_div_clk);
 error_disable_core_clk:
 	clk_disable_unprepare(host->core_clk);
-error_free_mmc:
-	mmc_free_host(mmc);
 error_unregister_slot_pdev:
 	of_platform_device_destroy(&slot_pdev->dev, NULL);
 	return ret;
@@ -741,8 +739,6 @@ static void meson_mx_mmc_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(host->cfg_div_clk);
 	clk_disable_unprepare(host->core_clk);
-
-	mmc_free_host(host->mmc);
 }
 
 static const struct of_device_id meson_mx_mmc_of_match[] = {
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH v3 03/36] mmc: au1xmmc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 ` [PATCH v3 03/36] mmc: au1xmmc: " Binbin Zhou
@ 2025-06-03 13:34   ` Manuel Lauss
  0 siblings, 0 replies; 45+ messages in thread
From: Manuel Lauss @ 2025-06-03 13:34 UTC (permalink / raw)
  To: Binbin Zhou; +Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Huacai Chen, linux-mmc

Hello,

On Tue, Jun 3, 2025 at 2:25 PM Binbin Zhou <zhoubinbin@loongson.cn> wrote:
>
> Use new function devm_mmc_alloc_host() to simplify the code.
>
> Cc: Manuel Lauss <manuel.lauss@gmail.com>
> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>  drivers/mmc/host/au1xmmc.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
> index 057d42307832..85470773650d 100644
> --- a/drivers/mmc/host/au1xmmc.c
> +++ b/drivers/mmc/host/au1xmmc.c
> @@ -937,11 +937,10 @@ static int au1xmmc_probe(struct platform_device *pdev)
>         struct resource *r;
>         int ret, iflag;
>
> -       mmc = mmc_alloc_host(sizeof(struct au1xmmc_host), &pdev->dev);
> +       mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
>         if (!mmc) {
>                 dev_err(&pdev->dev, "no memory for mmc_host\n");
> -               ret = -ENOMEM;
> -               goto out0;
> +               return -ENOMEM;
>         }
>
>         host = mmc_priv(mmc);
> @@ -953,14 +952,14 @@ static int au1xmmc_probe(struct platform_device *pdev)
>         r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         if (!r) {
>                 dev_err(&pdev->dev, "no mmio defined\n");
> -               goto out1;
> +               return ret;
>         }
>
>         host->ioarea = request_mem_region(r->start, resource_size(r),
>                                            pdev->name);
>         if (!host->ioarea) {
>                 dev_err(&pdev->dev, "mmio already in use\n");
> -               goto out1;
> +               return ret;
>         }
>
>         host->iobase = ioremap(r->start, 0x3c);
> @@ -1109,9 +1108,6 @@ static int au1xmmc_probe(struct platform_device *pdev)
>  out2:
>         release_resource(host->ioarea);
>         kfree(host->ioarea);
> -out1:
> -       mmc_free_host(mmc);
> -out0:
>         return ret;
>  }
>
> @@ -1151,8 +1147,6 @@ static void au1xmmc_remove(struct platform_device *pdev)
>                 iounmap((void *)host->iobase);
>                 release_resource(host->ioarea);
>                 kfree(host->ioarea);
> -
> -               mmc_free_host(host->mmc);
>         }
>  }

This is also fine with me.

Manuel

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v3 11/36] mmc: meson-mx-sdhc: Use devm_mmc_alloc_host() helper
  2025-06-03 12:26 ` [PATCH v3 11/36] mmc: meson-mx-sdhc: " Binbin Zhou
@ 2025-06-03 20:02   ` Martin Blumenstingl
  0 siblings, 0 replies; 45+ messages in thread
From: Martin Blumenstingl @ 2025-06-03 20:02 UTC (permalink / raw)
  To: Binbin Zhou
  Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Huacai Chen, linux-mmc,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, linux-amlogic

On Tue, Jun 3, 2025 at 2:26 PM Binbin Zhou <zhoubinbin@loongson.cn> wrote:
>
> Use new function devm_mmc_alloc_host() to simplify the code.
>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Cc: linux-amlogic@lists.infradead.org
> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v3 36/36] mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper
  2025-06-03 12:28 ` [PATCH v3 36/36] mmc: meson-mx-sdio: " Binbin Zhou
@ 2025-06-03 20:02   ` Martin Blumenstingl
  2025-06-03 20:49   ` Martin Blumenstingl
  1 sibling, 0 replies; 45+ messages in thread
From: Martin Blumenstingl @ 2025-06-03 20:02 UTC (permalink / raw)
  To: Binbin Zhou
  Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Huacai Chen, linux-mmc,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, linux-amlogic

On Tue, Jun 3, 2025 at 2:28 PM Binbin Zhou <zhoubinbin@loongson.cn> wrote:
>
> Use new function devm_mmc_alloc_host() to simplify the code.
>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Cc: linux-amlogic@lists.infradead.org
> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
successfully tested on my Meson8b Odroid-C1:
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v3 36/36] mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper
  2025-06-03 12:28 ` [PATCH v3 36/36] mmc: meson-mx-sdio: " Binbin Zhou
  2025-06-03 20:02   ` Martin Blumenstingl
@ 2025-06-03 20:49   ` Martin Blumenstingl
  2025-06-04  3:02     ` Binbin Zhou
  1 sibling, 1 reply; 45+ messages in thread
From: Martin Blumenstingl @ 2025-06-03 20:49 UTC (permalink / raw)
  To: Binbin Zhou
  Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Huacai Chen, linux-mmc,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, linux-amlogic

Hello,

On Tue, Jun 3, 2025 at 2:28 PM Binbin Zhou <zhoubinbin@loongson.cn> wrote:
>
> Use new function devm_mmc_alloc_host() to simplify the code.
>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Cc: linux-amlogic@lists.infradead.org
> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>  drivers/mmc/host/meson-mx-sdio.c | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c
> index e0ae5a0c9670..b6cb475f1a5f 100644
> --- a/drivers/mmc/host/meson-mx-sdio.c
> +++ b/drivers/mmc/host/meson-mx-sdio.c
> @@ -640,7 +640,7 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
>         else if (IS_ERR(slot_pdev))
>                 return PTR_ERR(slot_pdev);
>
> -       mmc = mmc_alloc_host(sizeof(*host), &slot_pdev->dev);
> +       mmc = devm_mmc_alloc_host(&slot_pdev->dev, sizeof(*host));
This change is fine at runtime (on my Odroid-C1 board) but it can lead
to a use-after-free issue.
meson_mx_mmc_register_clks() devm_ registers two clocks and uses
host->controller_dev as device.
This leads to the fact that during driver removal struct
meson_mx_mmc_host is free'd before host->controller_dev, which means
the clocks are also free'd after struct meson_mx_mmc_host is already
gone. The problem here: the clocks need the struct clk_divider and
struct clk_fixed_factor from struct meson_mx_mmc_host.

I don't understand why I'm not seeing any problems with this patch at
runtime - maybe what I'm describing is just a theoretical issue
(because it would only it if something would access the clocks between
freeing struct meson_mx_mmc_host and removal of the clocks a few
milliseconds later).

What are your thoughts on this?
If we're concerned about the potential UAF then I can refactor
meson_mx_mmc_register_clks() first and then apply this patch
afterwards.


Best regards,
Martin

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v3 36/36] mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper
  2025-06-03 20:49   ` Martin Blumenstingl
@ 2025-06-04  3:02     ` Binbin Zhou
  2025-06-04 19:37       ` Martin Blumenstingl
  0 siblings, 1 reply; 45+ messages in thread
From: Binbin Zhou @ 2025-06-04  3:02 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Huacai Chen, linux-mmc,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, linux-amlogic

Hi Martin:

Thanks for your testing and reply.

On Wed, Jun 4, 2025 at 4:49 AM Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hello,
>
> On Tue, Jun 3, 2025 at 2:28 PM Binbin Zhou <zhoubinbin@loongson.cn> wrote:
> >
> > Use new function devm_mmc_alloc_host() to simplify the code.
> >
> > Cc: Neil Armstrong <neil.armstrong@linaro.org>
> > Cc: Kevin Hilman <khilman@baylibre.com>
> > Cc: Jerome Brunet <jbrunet@baylibre.com>
> > Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > Cc: linux-amlogic@lists.infradead.org
> > Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > ---
> >  drivers/mmc/host/meson-mx-sdio.c | 20 ++++++++------------
> >  1 file changed, 8 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c
> > index e0ae5a0c9670..b6cb475f1a5f 100644
> > --- a/drivers/mmc/host/meson-mx-sdio.c
> > +++ b/drivers/mmc/host/meson-mx-sdio.c
> > @@ -640,7 +640,7 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
> >         else if (IS_ERR(slot_pdev))
> >                 return PTR_ERR(slot_pdev);
> >
> > -       mmc = mmc_alloc_host(sizeof(*host), &slot_pdev->dev);
> > +       mmc = devm_mmc_alloc_host(&slot_pdev->dev, sizeof(*host));
> This change is fine at runtime (on my Odroid-C1 board) but it can lead
> to a use-after-free issue.
> meson_mx_mmc_register_clks() devm_ registers two clocks and uses
> host->controller_dev as device.
> This leads to the fact that during driver removal struct
> meson_mx_mmc_host is free'd before host->controller_dev, which means
> the clocks are also free'd after struct meson_mx_mmc_host is already
> gone. The problem here: the clocks need the struct clk_divider and
> struct clk_fixed_factor from struct meson_mx_mmc_host.

Sorry, I have a slightly different opinion, which may not necessarily
be correct.

meson_mx_mmc_host is kzalloc as `extra` in mmc_alloc_host()[1], but in
fact, the entire host is released in mmc_host_classdev_release()[2],
so I don't think it will affect the use of host->controller_dev.

[1]: https://elixir.bootlin.com/linux/v6.15-rc1/source/drivers/mmc/core/host.c#L523
[2]: https://elixir.bootlin.com/linux/v6.15-rc1/source/drivers/mmc/core/host.c#L78
>
> I don't understand why I'm not seeing any problems with this patch at
> runtime - maybe what I'm describing is just a theoretical issue
> (because it would only it if something would access the clocks between
> freeing struct meson_mx_mmc_host and removal of the clocks a few
> milliseconds later).
>
> What are your thoughts on this?
> If we're concerned about the potential UAF then I can refactor
> meson_mx_mmc_register_clks() first and then apply this patch
> afterwards.
>
>
> Best regards,
> Martin


-- 
Thanks.
Binbin

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v3 36/36] mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper
  2025-06-04  3:02     ` Binbin Zhou
@ 2025-06-04 19:37       ` Martin Blumenstingl
  0 siblings, 0 replies; 45+ messages in thread
From: Martin Blumenstingl @ 2025-06-04 19:37 UTC (permalink / raw)
  To: Binbin Zhou
  Cc: Binbin Zhou, Huacai Chen, Ulf Hansson, Huacai Chen, linux-mmc,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, linux-amlogic

Hi Binbin,

On Wed, Jun 4, 2025 at 5:02 AM Binbin Zhou <zhoubb.aaron@gmail.com> wrote:
[...]
> > > -       mmc = mmc_alloc_host(sizeof(*host), &slot_pdev->dev);
> > > +       mmc = devm_mmc_alloc_host(&slot_pdev->dev, sizeof(*host));
> > This change is fine at runtime (on my Odroid-C1 board) but it can lead
> > to a use-after-free issue.
> > meson_mx_mmc_register_clks() devm_ registers two clocks and uses
> > host->controller_dev as device.
> > This leads to the fact that during driver removal struct
> > meson_mx_mmc_host is free'd before host->controller_dev, which means
> > the clocks are also free'd after struct meson_mx_mmc_host is already
> > gone. The problem here: the clocks need the struct clk_divider and
> > struct clk_fixed_factor from struct meson_mx_mmc_host.
>
> Sorry, I have a slightly different opinion, which may not necessarily
> be correct.
>
> meson_mx_mmc_host is kzalloc as `extra` in mmc_alloc_host()[1], but in
> fact, the entire host is released in mmc_host_classdev_release()[2],
> so I don't think it will affect the use of host->controller_dev.
It's well hidden, so it's tricky to spot: we have two "struct device"
in the meson-mx-sdio driver:
1. the "controller_dev" which is belongs to the struct platform_device
of the driver/device-tree node [0]
2. a second struct platform_device and thus a second struct device
whose of_node belongs to the "slot" (which is a child node of the
controller) [1]

Clock controller initialization is the same for all slots, so I chose
to link it with the controller_device.
We want to parse the mmc slot properties (bus-width, cd-gpios, cap-*,
...) from the slot node in device-tree, so we create a second
platform_device for the slot (child) node. This design was chosen
because the controller supports multiple (up to 3) slots while the mmc
core in Linux doesn't. However, it was important for me to at least be
prepared in terms of device-tree bindings in case Linux would ever
support controllers with multiple slots.

So the lifecycle during probe is:
a) controller_device is instantiated by device-tree node with
compatible = "amlogic,meson8-sdio"
b) slot device is instantiated using the "mmc-slot" compatible and
using controller_device as parent device
c) devm_mmc_alloc_host() is called
d) clock providers are devm_* registered and attached to controller_device
e) the meson-mx-sdio driver acts as clock consumer for the clock it's providing

However, if we want to remove the driver the order is:
- remove the device attached to the "mmc-slot" compatible - before
that happens struct mmc is freed (as it's parent is being removed)
which also frees struct meson_mx_mmc_host
- (struct clk_divider and struct clk_fixed_factor are linked with the
clocks which are still registered <- here we have a problem because
those two structs are part of struct meson_mx_mmc_host which has
already been freed)
- controller_device is freed - before that happens the provided clocks
are freed (as their parent is being removed)

I take your questions as feedback on how to make the code easier to
read/understand.
This is very welcome, because it's been 8 years since I introduced the
driver and I also have to think twice about some of its details.

Let me know if things are more clear now - or if you still have any
doubts/questions.


Best regards,
Martin


[0] https://elixir.bootlin.com/linux/v6.15-rc1/source/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml#L83
[1] https://elixir.bootlin.com/linux/v6.15-rc1/source/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml#L92

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v3 02/36] mmc: atmel: Use devm_mmc_alloc_host() helper
  2025-06-03 12:25 ` [PATCH v3 02/36] mmc: atmel: " Binbin Zhou
@ 2025-06-10  9:21   ` Aubin Constans
  0 siblings, 0 replies; 45+ messages in thread
From: Aubin Constans @ 2025-06-10  9:21 UTC (permalink / raw)
  To: Binbin Zhou, Binbin Zhou, Huacai Chen, Ulf Hansson
  Cc: Huacai Chen, linux-mmc, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea

On 03/06/2025 14:25, Binbin Zhou wrote:
> Use new function devm_mmc_alloc_host() to simplify the code.
> 
> Cc: Aubin Constans <aubin.constans@microchip.com>
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>

Acked-by: Aubin Constans <aubin.constans@microchip.com>

> ---
>   drivers/mmc/host/atmel-mci.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 14e981b834b6..f72fe4b805f6 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -2247,7 +2247,7 @@ static int atmci_init_slot(struct atmel_mci *host,
>          struct atmel_mci_slot           *slot;
>          int ret;
> 
> -       mmc = mmc_alloc_host(sizeof(struct atmel_mci_slot), dev);
> +       mmc = devm_mmc_alloc_host(dev, sizeof(*slot));
>          if (!mmc)
>                  return -ENOMEM;
> 
> @@ -2320,10 +2320,8 @@ static int atmci_init_slot(struct atmel_mci *host,
>          host->slot[id] = slot;
>          mmc_regulator_get_supply(mmc);
>          ret = mmc_add_host(mmc);
> -       if (ret) {
> -               mmc_free_host(mmc);
> +       if (ret)
>                  return ret;
> -       }
> 
>          if (slot->detect_pin) {
>                  timer_setup(&slot->detect_timer, atmci_detect_change, 0);
> @@ -2361,7 +2359,6 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
>          }
> 
>          slot->host->slot[id] = NULL;
> -       mmc_free_host(slot->mmc);
>   }
> 
>   static int atmci_configure_dma(struct atmel_mci *host)
> --
> 2.47.1
> 


^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage
  2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
                   ` (35 preceding siblings ...)
  2025-06-03 12:28 ` [PATCH v3 36/36] mmc: meson-mx-sdio: " Binbin Zhou
@ 2025-06-19 11:19 ` Ulf Hansson
  36 siblings, 0 replies; 45+ messages in thread
From: Ulf Hansson @ 2025-06-19 11:19 UTC (permalink / raw)
  To: Binbin Zhou; +Cc: Binbin Zhou, Huacai Chen, Huacai Chen, linux-mmc

On Tue, 3 Jun 2025 at 14:25, Binbin Zhou <zhoubinbin@loongson.cn> wrote:
>
> Hi all:
>
> Since the devm_mmc_alloc_host() helper was already available, I tried to
> start cleaning up the use of mmc_alloc_host().
>
> To make it easier to review the patchset, I decided to split it into two parts.
> As the first part, this patchset contains cleanup for drivers other than sdhci.
>
> Of course, the sdhci part I have ready in my repository.
>
> Thanks.
>
> -----
> V3:
> - Collect Reviewed-by and Acked-by tags.
> Patch-18
>   - Fix build warning by lkp:
>         https://lore.kernel.org/all/202505230421.P12fqPfB-lkp@intel.com/
>
> Link to V2:
> https://lore.kernel.org/all/cover.1747877175.git.zhoubinbin@loongson.cn/
>
> V2:
> - Collect Reviewed-by and Acked-by tags.
> Patch-24
>   - Correct subject title: ish_mmicf -> sh_mmicf.
> Patch-34
>   - Fix cheap build error.
>
> Link to V1:
> https://lore.kernel.org/all/cover.1747739323.git.zhoubinbin@loongson.cn/
>
> Binbin Zhou (36):
>   mmc: alcor: Use devm_mmc_alloc_host() helper
>   mmc: atmel: Use devm_mmc_alloc_host() helper
>   mmc: au1xmmc: Use devm_mmc_alloc_host() helper
>   mmc: bcm2835: Use devm_mmc_alloc_host() helper
>   mmc: cavium: Use devm_mmc_alloc_host() helper
>   mmc: cb710: Use devm_mmc_alloc_host() helper
>   mmc: davinci_mmc: Use devm_mmc_alloc_host() helper
>   mmc: dw_mmc: Use devm_mmc_alloc_host() helper
>   mmc: jz4740: Use devm_mmc_alloc_host() helper
>   mmc: litex_mmc: Use devm_mmc_alloc_host() helper
>   mmc: meson-mx-sdhc: Use devm_mmc_alloc_host() helper
>   mmc: mmci: Use devm_mmc_alloc_host() helper
>   mmc: moxart-mmc: Use devm_mmc_alloc_host() helper
>   mmc: mvsdio: Use devm_mmc_alloc_host() helper
>   mmc: mxcmmc: Use devm_mmc_alloc_host() helper
>   mmc: mxs-mmc: Use devm_mmc_alloc_host() helper
>   mmc: omap: Use devm_mmc_alloc_host() helper
>   mmc: omap_hsmmc: Use devm_mmc_alloc_host() helper
>   mmc: owl-mmc: Use devm_mmc_alloc_host() helper
>   mmc: pxamci: Use devm_mmc_alloc_host() helper
>   mmc: rtsx_pci: Use devm_mmc_alloc_host() helper
>   mmc: rtsx_usb_sdmmc: Use devm_mmc_alloc_host() helper
>   mmc: sdricoh_cs: Use devm_mmc_alloc_host() helper
>   mmc: sh_mmicf: Use devm_mmc_alloc_host() helper
>   mmc: tifm_sd: Use devm_mmc_alloc_host() helper
>   mmc: toshsd: Use devm_mmc_alloc_host() helper
>   mmc: usdhi6ro10: Use devm_mmc_alloc_host() helper
>   mmc: ushc: Use devm_mmc_alloc_host() helper
>   mmc: via-sdmmc: Use devm_mmc_alloc_host() helper
>   mmc: vub300: Use devm_mmc_alloc_host() helper
>   mmc: wbsd: Use devm_mmc_alloc_host() helper
>   mmc: wmt-sdmmc: Use devm_mmc_alloc_host() helper
>   mmc: tmio: Use devm_mmc_alloc_host() helper
>   mmc: sunxi: Use devm_mmc_alloc_host() helper
>   mmc: mmc_spi: Use devm_mmc_alloc_host() helper
>   mmc: meson-mx-sdio: Use devm_mmc_alloc_host() helper
>
>  drivers/mmc/host/alcor.c             | 20 ++++---------
>  drivers/mmc/host/atmel-mci.c         |  7 ++---
>  drivers/mmc/host/au1xmmc.c           | 14 +++-------
>  drivers/mmc/host/bcm2835.c           |  5 +---
>  drivers/mmc/host/cavium.c            | 10 ++-----
>  drivers/mmc/host/cb710-mmc.c         |  5 +---
>  drivers/mmc/host/davinci_mmc.c       | 22 +++++----------
>  drivers/mmc/host/dw_mmc.c            | 15 ++++------
>  drivers/mmc/host/jz4740_mmc.c        | 40 +++++++++-----------------
>  drivers/mmc/host/litex_mmc.c         | 12 +-------
>  drivers/mmc/host/meson-mx-sdhc-mmc.c | 13 +--------
>  drivers/mmc/host/meson-mx-sdio.c     | 20 ++++++-------
>  drivers/mmc/host/mmc_spi.c           |  4 +--
>  drivers/mmc/host/mmci.c              | 31 ++++++++------------
>  drivers/mmc/host/moxart-mmc.c        | 40 ++++++++++----------------
>  drivers/mmc/host/mvsdio.c            | 24 +++++-----------
>  drivers/mmc/host/mxcmmc.c            | 31 +++++++-------------
>  drivers/mmc/host/mxs-mmc.c           | 31 ++++++++------------
>  drivers/mmc/host/omap.c              | 25 ++++++-----------
>  drivers/mmc/host/omap_hsmmc.c        | 17 ++++-------
>  drivers/mmc/host/owl-mmc.c           | 37 +++++++++---------------
>  drivers/mmc/host/pxamci.c            | 42 ++++++++++------------------
>  drivers/mmc/host/renesas_sdhi_core.c |  6 +---
>  drivers/mmc/host/rtsx_pci_sdmmc.c    |  5 +---
>  drivers/mmc/host/rtsx_usb_sdmmc.c    |  4 +--
>  drivers/mmc/host/sdricoh_cs.c        | 10 ++-----
>  drivers/mmc/host/sh_mmcif.c          | 17 ++++-------
>  drivers/mmc/host/sunxi-mmc.c         | 22 ++++++---------
>  drivers/mmc/host/tifm_sd.c           |  7 +----
>  drivers/mmc/host/tmio_mmc.h          |  1 -
>  drivers/mmc/host/tmio_mmc_core.c     | 18 ++----------
>  drivers/mmc/host/toshsd.c            |  4 +--
>  drivers/mmc/host/uniphier-sd.c       |  8 ++----
>  drivers/mmc/host/usdhi6rol0.c        | 30 +++++++-------------
>  drivers/mmc/host/ushc.c              |  4 +--
>  drivers/mmc/host/via-sdmmc.c         |  7 ++---
>  drivers/mmc/host/vub300.c            | 16 ++++-------
>  drivers/mmc/host/wbsd.c              |  4 +--
>  drivers/mmc/host/wmt-sdmmc.c         |  8 ++----
>  39 files changed, 195 insertions(+), 441 deletions(-)
>
>

It seems like you didn't conclude around the discussion with Martin
around patch36, hence I am deferring that a bit.

That said, patch 1->35 applied for next, thanks!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2025-06-19 11:20 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 12:25 [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Binbin Zhou
2025-06-03 12:25 ` [PATCH v3 01/36] mmc: alcor: Use devm_mmc_alloc_host() helper Binbin Zhou
2025-06-03 12:25 ` [PATCH v3 02/36] mmc: atmel: " Binbin Zhou
2025-06-10  9:21   ` Aubin Constans
2025-06-03 12:25 ` [PATCH v3 03/36] mmc: au1xmmc: " Binbin Zhou
2025-06-03 13:34   ` Manuel Lauss
2025-06-03 12:25 ` [PATCH v3 04/36] mmc: bcm2835: " Binbin Zhou
2025-06-03 12:25 ` [PATCH v3 05/36] mmc: cavium: " Binbin Zhou
2025-06-03 12:25 ` [PATCH v3 06/36] mmc: cb710: " Binbin Zhou
2025-06-03 12:25 ` [PATCH v3 07/36] mmc: davinci_mmc: " Binbin Zhou
2025-06-03 12:25 ` [PATCH v3 08/36] mmc: dw_mmc: " Binbin Zhou
2025-06-03 12:25 ` [PATCH v3 09/36] mmc: jz4740: " Binbin Zhou
2025-06-03 12:26 ` [PATCH v3 10/36] mmc: litex_mmc: " Binbin Zhou
2025-06-03 12:26 ` [PATCH v3 11/36] mmc: meson-mx-sdhc: " Binbin Zhou
2025-06-03 20:02   ` Martin Blumenstingl
2025-06-03 12:26 ` [PATCH v3 12/36] mmc: mmci: " Binbin Zhou
2025-06-03 12:26 ` [PATCH v3 13/36] mmc: moxart-mmc: " Binbin Zhou
2025-06-03 12:26 ` [PATCH v3 14/36] mmc: mvsdio: " Binbin Zhou
2025-06-03 12:26 ` [PATCH v3 15/36] mmc: mxcmmc: " Binbin Zhou
2025-06-03 12:26 ` [PATCH v3 16/36] mmc: mxs-mmc: " Binbin Zhou
2025-06-03 12:26 ` [PATCH v3 17/36] mmc: omap: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 18/36] mmc: omap_hsmmc: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 19/36] mmc: owl-mmc: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 20/36] mmc: pxamci: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 21/36] mmc: rtsx_pci: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 22/36] mmc: rtsx_usb_sdmmc: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 23/36] mmc: sdricoh_cs: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 24/36] mmc: sh_mmicf: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 25/36] mmc: tifm_sd: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 26/36] mmc: toshsd: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 27/36] mmc: usdhi6ro10: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 28/36] mmc: ushc: " Binbin Zhou
2025-06-03 12:27 ` [PATCH v3 29/36] mmc: via-sdmmc: " Binbin Zhou
2025-06-03 12:28 ` [PATCH v3 30/36] mmc: vub300: " Binbin Zhou
2025-06-03 12:28 ` [PATCH v3 31/36] mmc: wbsd: " Binbin Zhou
2025-06-03 12:28 ` [PATCH v3 32/36] mmc: wmt-sdmmc: " Binbin Zhou
2025-06-03 12:28 ` [PATCH v3 33/36] mmc: tmio: " Binbin Zhou
2025-06-03 12:28 ` [PATCH v3 34/36] mmc: sunxi: " Binbin Zhou
2025-06-03 12:28 ` [PATCH v3 35/36] mmc: mmc_spi: " Binbin Zhou
2025-06-03 12:28 ` [PATCH v3 36/36] mmc: meson-mx-sdio: " Binbin Zhou
2025-06-03 20:02   ` Martin Blumenstingl
2025-06-03 20:49   ` Martin Blumenstingl
2025-06-04  3:02     ` Binbin Zhou
2025-06-04 19:37       ` Martin Blumenstingl
2025-06-19 11:19 ` [PATCH v3 00/36] mmc: Cleanup mmc_alloc_host() usage Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox