Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers
@ 2023-06-17 20:36 Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 01/12] mmc: bcm2835: fix deferred probing Sergey Shtylyov
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc

Here are 12 patches against the 'fixes' branch of Ulf Hansson's 'mmc.git' repo.

The affected MMC/SD drivers call platform_get_irq[_byname]() but override its
result in case of error which prevents the deferred probing from working. Some
of these patches logically depend on commit ce753ad1549c ("platform: finally
disallow IRQ0 in platform_get_irq() and its ilk")...

Sergey Shtylyov (12):
  mmc: bcm2835: fix deferred probing
  mmc: meson-gx: fix deferred probing
  mmc: mtk-sd: fix deferred probing
  mmc: mvsdio: fix deferred probing
  mmc: omap: fix deferred probing
  mmc: omap_hsmmc: fix deferred probing
  mmc: owl: fix deferred probing
  mmc: sdhci-acpi: fix deferred probing
  mmc: sdhci-spear: fix deferred probing
  mmc: sh_mmcif: fix deferred probing
  mmc: sunxi: fix deferred probing
  mmc: usdhi60rol0: fix deferred probing

 drivers/mmc/host/bcm2835.c      | 4 ++--
 drivers/mmc/host/meson-gx-mmc.c | 4 ++--
 drivers/mmc/host/mtk-sd.c       | 2 +-
 drivers/mmc/host/mvsdio.c       | 2 +-
 drivers/mmc/host/omap.c         | 2 +-
 drivers/mmc/host/omap_hsmmc.c   | 6 ++++--
 drivers/mmc/host/owl-mmc.c      | 2 +-
 drivers/mmc/host/sdhci-acpi.c   | 2 +-
 drivers/mmc/host/sdhci-spear.c  | 4 ++--
 drivers/mmc/host/sh_mmcif.c     | 2 +-
 drivers/mmc/host/sunxi-mmc.c    | 4 ++--
 drivers/mmc/host/usdhi6rol0.c   | 6 ++++--
 12 files changed, 22 insertions(+), 18 deletions(-)

-- 
2.26.3


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

* [PATCH v3 01/12] mmc: bcm2835: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 02/12] mmc: meson-gx: " Sergey Shtylyov
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc
  Cc: Florian Fainelli, Ray Jui, Scott Branden, Nicolas Saenz Julienne,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	stable

The driver overrides the error codes and IRQ0 returned by platform_get_irq()
to -EINVAL, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the error
codes upstream.  Since commit ce753ad1549c ("platform: finally disallow IRQ0
in platform_get_irq() and its ilk") IRQ0 is no longer returned by those APIs,
so we now can safely ignore it...

Fixes: 660fc733bd74 ("mmc: bcm2835: Add new driver for the sdhost controller.")
Cc: stable@vger.kernel.org # v5.19+
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
Changes in version 3:
- added the platform_get_irq() commit reference to the  patch description and
  the Cc: tag marking the 1st kernel version containing it.

Changes in version 2:
- refreshed the patch;
- slightly reformatted the patch description.

 drivers/mmc/host/bcm2835.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 8648f7e63ca1..eea208856ce0 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -1403,8 +1403,8 @@ static int bcm2835_probe(struct platform_device *pdev)
 	host->max_clk = clk_get_rate(clk);
 
 	host->irq = platform_get_irq(pdev, 0);
-	if (host->irq <= 0) {
-		ret = -EINVAL;
+	if (host->irq < 0) {
+		ret = host->irq;
 		goto err;
 	}
 
-- 
2.26.3


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

* [PATCH v3 02/12] mmc: meson-gx: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 01/12] mmc: bcm2835: fix deferred probing Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 03/12] mmc: mtk-sd: " Sergey Shtylyov
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc
  Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-amlogic, linux-arm-kernel, stable

The driver overrides the error codes and IRQ0 returned by platform_get_irq()
to -EINVAL, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the error
codes upstream.  Since commit ce753ad1549c ("platform: finally disallow IRQ0
in platform_get_irq() and its ilk") IRQ0 is no longer returned by those APIs,
so we now can safely ignore it...

Fixes: cbcaac6d7dd2 ("mmc: meson-gx-mmc: Fix platform_get_irq's error checking")
Cc: stable@vger.kernel.org # v5.19+
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
---
Changes in version 3:
- added the platform_get_irq() commit reference to the  patch description and
  the Cc: tag marking the 1st kernel version containing it;
- added Neil's tag .

Changes in version 2:
- updated the fix due to the surrounding code change;
- refreshed the patch;
- removed stray newline in the Fixes: tag;
- slightly reformatted the patch description.

 drivers/mmc/host/meson-gx-mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index b8514d9d5e73..75f97dce7ef3 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1192,8 +1192,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
 		return PTR_ERR(host->regs);
 
 	host->irq = platform_get_irq(pdev, 0);
-	if (host->irq <= 0)
-		return -EINVAL;
+	if (host->irq < 0)
+		return host->irq;
 
 	cd_irq = platform_get_irq_optional(pdev, 1);
 	mmc_gpio_set_cd_irq(mmc, cd_irq);
-- 
2.26.3


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

* [PATCH v3 03/12] mmc: mtk-sd: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 01/12] mmc: bcm2835: fix deferred probing Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 02/12] mmc: meson-gx: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 04/12] mmc: mvsdio: " Sergey Shtylyov
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc
  Cc: Chaotian Jing, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-arm-kernel, linux-mediatek, linux-kernel

The driver overrides the error codes returned by platform_get_irq() to
-EINVAL, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the
error codes upstream.

Fixes: 208489032bdd ("mmc: mediatek: Add Mediatek MMC driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
Changes in version 2:
- refreshed the patch.

 drivers/mmc/host/mtk-sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index edade0e54a0c..9785ec91654f 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -2680,7 +2680,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
 
 	host->irq = platform_get_irq(pdev, 0);
 	if (host->irq < 0) {
-		ret = -EINVAL;
+		ret = host->irq;
 		goto host_free;
 	}
 
-- 
2.26.3


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

* [PATCH v3 04/12] mmc: mvsdio: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (2 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 03/12] mmc: mtk-sd: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 05/12] mmc: omap: " Sergey Shtylyov
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc; +Cc: Nicolas Pitre

The driver overrides the error codes returned by platform_get_irq() to
-ENXIO, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the
error codes upstream.

Fixes: 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/mmc/host/mvsdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index 629efbe639c4..b4f6a0a2fcb5 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -704,7 +704,7 @@ static int mvsd_probe(struct platform_device *pdev)
 	}
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return -ENXIO;
+		return irq;
 
 	mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev);
 	if (!mmc) {
-- 
2.26.3


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

* [PATCH v3 05/12] mmc: omap: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (3 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 04/12] mmc: mvsdio: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 06/12] mmc: omap_hsmmc: " Sergey Shtylyov
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc; +Cc: Aaro Koskinen, linux-omap

The driver overrides the error codes returned by platform_get_irq() to
-ENXIO, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the
error codes upstream.

Fixes: 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
Changes in version 2:
- updated the fix due to the surrounding code change.

 drivers/mmc/host/omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index ce78edfb402b..86454f1182bb 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1343,7 +1343,7 @@ static int mmc_omap_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return -ENXIO;
+		return irq;
 
 	host->virt_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(host->virt_base))
-- 
2.26.3


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

* [PATCH v3 06/12] mmc: omap_hsmmc: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (4 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 05/12] mmc: omap: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 07/12] mmc: owl: " Sergey Shtylyov
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc; +Cc: linux-omap

The driver overrides the error codes returned by platform_get_irq() to
-ENXIO, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the
error codes upstream.

Fixes: 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
Changes in version 2:
- refreshed the patch.

 drivers/mmc/host/omap_hsmmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 517dde777413..1e0f2d7774bd 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1791,9 +1791,11 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	irq = platform_get_irq(pdev, 0);
-	if (res == NULL || irq < 0)
+	if (!res)
 		return -ENXIO;
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
 
 	base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(base))
-- 
2.26.3


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

* [PATCH v3 07/12] mmc: owl: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (5 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 06/12] mmc: omap_hsmmc: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 08/12] mmc: sdhci-acpi: " Sergey Shtylyov
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc
  Cc: Andreas Färber, Manivannan Sadhasivam, linux-actions,
	linux-arm-kernel

The driver overrides the error codes returned by platform_get_irq() to
-EINVAL, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the
error codes upstream.

Fixes: ff65ffe46d28 ("mmc: Add Actions Semi Owl SoCs SD/MMC driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
Changes in version 2:
- refreshed the patch.

 drivers/mmc/host/owl-mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/owl-mmc.c b/drivers/mmc/host/owl-mmc.c
index 6f9d31a886ba..1bf22b08b373 100644
--- a/drivers/mmc/host/owl-mmc.c
+++ b/drivers/mmc/host/owl-mmc.c
@@ -637,7 +637,7 @@ static int owl_mmc_probe(struct platform_device *pdev)
 
 	owl_host->irq = platform_get_irq(pdev, 0);
 	if (owl_host->irq < 0) {
-		ret = -EINVAL;
+		ret = owl_host->irq;
 		goto err_release_channel;
 	}
 
-- 
2.26.3


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

* [PATCH v3 08/12] mmc: sdhci-acpi: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (6 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 07/12] mmc: owl: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 09/12] mmc: sdhci-spear: " Sergey Shtylyov
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc; +Cc: Adrian Hunter

The driver overrides the error codes returned by platform_get_irq() to
-EINVAL, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the
error codes upstream.

Fixes: 1b7ba57ecc86 ("mmc: sdhci-acpi: Handle return value of platform_get_irq")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
---
Changes in version 3:
- added Adrian's ACK.

Changes in version 2:
- refreshed the patch.

 drivers/mmc/host/sdhci-acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 8f0e639236b1..edf2e6c14dc6 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -829,7 +829,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
 	host->ops	= &sdhci_acpi_ops_dflt;
 	host->irq	= platform_get_irq(pdev, 0);
 	if (host->irq < 0) {
-		err = -EINVAL;
+		err = host->irq;
 		goto err_free;
 	}
 
-- 
2.26.3


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

* [PATCH v3 09/12] mmc: sdhci-spear: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (7 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 08/12] mmc: sdhci-acpi: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 10/12] mmc: sh_mmcif: " Sergey Shtylyov
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc; +Cc: Adrian Hunter, Viresh Kumar, stable, Viresh Kumar

The driver overrides the error codes and IRQ0 returned by platform_get_irq()
to -EINVAL, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the error
codes upstream.  Since commit ce753ad1549c ("platform: finally disallow IRQ0
in platform_get_irq() and its ilk") IRQ0 is no longer returned by those APIs,
so we now can safely ignore it...

Fixes: 682798a596a6 ("mmc: sdhci-spear: Handle return value of platform_get_irq")
Cc: stable@vger.kernel.org # v5.19+
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
---
Changes in version 3:
- added the platform_get_irq() commit reference to the  patch description and
  the Cc: tag marking the 1st kernel version containing it;
- added Viresh's and Adrian's ACKs.

Changes in version 2:
- slightly reformatted the patch description.

 drivers/mmc/host/sdhci-spear.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index d463e2fd5b1a..c79035727b20 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -65,8 +65,8 @@ static int sdhci_probe(struct platform_device *pdev)
 	host->hw_name = "sdhci";
 	host->ops = &sdhci_pltfm_ops;
 	host->irq = platform_get_irq(pdev, 0);
-	if (host->irq <= 0) {
-		ret = -EINVAL;
+	if (host->irq < 0) {
+		ret = host->irq;
 		goto err_host;
 	}
 	host->quirks = SDHCI_QUIRK_BROKEN_ADMA;
-- 
2.26.3


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

* [PATCH v3 10/12] mmc: sh_mmcif: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (8 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 09/12] mmc: sdhci-spear: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 11/12] mmc: sunxi: " Sergey Shtylyov
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc

The driver overrides the error codes returned by platform_get_irq() to
-ENXIO, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the
error codes upstream.

Fixes: 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
Changes in version 2:
- refreshed the patch.

 drivers/mmc/host/sh_mmcif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 0fd4c9d644dd..5cf53348372a 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1400,7 +1400,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	irq[0] = platform_get_irq(pdev, 0);
 	irq[1] = platform_get_irq_optional(pdev, 1);
 	if (irq[0] < 0)
-		return -ENXIO;
+		return irq[0];
 
 	reg = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(reg))
-- 
2.26.3


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

* [PATCH v3 11/12] mmc: sunxi: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (9 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 10/12] mmc: sh_mmcif: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-17 20:36 ` [PATCH v3 12/12] mmc: usdhi60rol0: " Sergey Shtylyov
  2023-06-19 11:43 ` [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Ulf Hansson
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc
  Cc: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, linux-arm-kernel,
	linux-sunxi, stable

The driver overrides the error codes and IRQ0 returned by platform_get_irq()
to -EINVAL, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing. Switch to propagating the error
codes upstream.  Since commit ce753ad1549c ("platform: finally disallow IRQ0
in platform_get_irq() and its ilk") IRQ0 is no longer returned by those APIs,
so we now can safely ignore it...

Fixes: 2408a08583d ("mmc: sunxi-mmc: Handle return value of platform_get_irq")
Cc: stable@vger.kernel.org # v5.19+
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
Changes in version 3:
- added the platform_get_irq() commit reference to the  patch description and
  the Cc: tag marking the 1st kernel version containing it;
- added Jernej's tag.

Changes in version 2:
- slightly reformatted the patch description.

 drivers/mmc/host/sunxi-mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 3db9f32d6a7b..69dcb8805e05 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1350,8 +1350,8 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
 		return ret;
 
 	host->irq = platform_get_irq(pdev, 0);
-	if (host->irq <= 0) {
-		ret = -EINVAL;
+	if (host->irq < 0) {
+		ret = host->irq;
 		goto error_disable_mmc;
 	}
 
-- 
2.26.3


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

* [PATCH v3 12/12] mmc: usdhi60rol0: fix deferred probing
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (10 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 11/12] mmc: sunxi: " Sergey Shtylyov
@ 2023-06-17 20:36 ` Sergey Shtylyov
  2023-06-19 11:43 ` [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Ulf Hansson
  12 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-17 20:36 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc; +Cc: Jesper Nilsson, Lars Persson, linux-arm-kernel

The driver overrides the error codes returned by platform_get_irq_byname()
to -ENODEV, so if it returns -EPROBE_DEFER, the driver will fail the probe
permanently instead of the deferred probing.  Switch to propagating error
codes upstream.

Fixes: 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
Changes in version 2:
- fixed up the function name in the patch description and reformatted it.

 drivers/mmc/host/usdhi6rol0.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
index 2f59917b105e..2e17903658fc 100644
--- a/drivers/mmc/host/usdhi6rol0.c
+++ b/drivers/mmc/host/usdhi6rol0.c
@@ -1757,8 +1757,10 @@ static int usdhi6_probe(struct platform_device *pdev)
 	irq_cd = platform_get_irq_byname(pdev, "card detect");
 	irq_sd = platform_get_irq_byname(pdev, "data");
 	irq_sdio = platform_get_irq_byname(pdev, "SDIO");
-	if (irq_sd < 0 || irq_sdio < 0)
-		return -ENODEV;
+	if (irq_sd < 0)
+		return irq_sd;
+	if (irq_sdio < 0)
+		return irq_sdio;
 
 	mmc = mmc_alloc_host(sizeof(struct usdhi6_host), dev);
 	if (!mmc)
-- 
2.26.3


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

* Re: [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers
  2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
                   ` (11 preceding siblings ...)
  2023-06-17 20:36 ` [PATCH v3 12/12] mmc: usdhi60rol0: " Sergey Shtylyov
@ 2023-06-19 11:43 ` Ulf Hansson
  12 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2023-06-19 11:43 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-mmc

On Sat, 17 Jun 2023 at 22:36, Sergey Shtylyov <s.shtylyov@omp.ru> wrote:
>
> Here are 12 patches against the 'fixes' branch of Ulf Hansson's 'mmc.git' repo.
>
> The affected MMC/SD drivers call platform_get_irq[_byname]() but override its
> result in case of error which prevents the deferred probing from working. Some
> of these patches logically depend on commit ce753ad1549c ("platform: finally
> disallow IRQ0 in platform_get_irq() and its ilk")...
>
> Sergey Shtylyov (12):
>   mmc: bcm2835: fix deferred probing
>   mmc: meson-gx: fix deferred probing
>   mmc: mtk-sd: fix deferred probing
>   mmc: mvsdio: fix deferred probing
>   mmc: omap: fix deferred probing
>   mmc: omap_hsmmc: fix deferred probing
>   mmc: owl: fix deferred probing
>   mmc: sdhci-acpi: fix deferred probing
>   mmc: sdhci-spear: fix deferred probing
>   mmc: sh_mmcif: fix deferred probing
>   mmc: sunxi: fix deferred probing
>   mmc: usdhi60rol0: fix deferred probing
>
>  drivers/mmc/host/bcm2835.c      | 4 ++--
>  drivers/mmc/host/meson-gx-mmc.c | 4 ++--
>  drivers/mmc/host/mtk-sd.c       | 2 +-
>  drivers/mmc/host/mvsdio.c       | 2 +-
>  drivers/mmc/host/omap.c         | 2 +-
>  drivers/mmc/host/omap_hsmmc.c   | 6 ++++--
>  drivers/mmc/host/owl-mmc.c      | 2 +-
>  drivers/mmc/host/sdhci-acpi.c   | 2 +-
>  drivers/mmc/host/sdhci-spear.c  | 4 ++--
>  drivers/mmc/host/sh_mmcif.c     | 2 +-
>  drivers/mmc/host/sunxi-mmc.c    | 4 ++--
>  drivers/mmc/host/usdhi6rol0.c   | 6 ++++--
>  12 files changed, 22 insertions(+), 18 deletions(-)
>

Applied for fixes, thanks!

Kind regards
Uffe

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

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

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-17 20:36 [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 01/12] mmc: bcm2835: fix deferred probing Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 02/12] mmc: meson-gx: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 03/12] mmc: mtk-sd: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 04/12] mmc: mvsdio: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 05/12] mmc: omap: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 06/12] mmc: omap_hsmmc: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 07/12] mmc: owl: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 08/12] mmc: sdhci-acpi: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 09/12] mmc: sdhci-spear: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 10/12] mmc: sh_mmcif: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 11/12] mmc: sunxi: " Sergey Shtylyov
2023-06-17 20:36 ` [PATCH v3 12/12] mmc: usdhi60rol0: " Sergey Shtylyov
2023-06-19 11:43 ` [PATCH v3 00/12] Fix deferred probing in the MMC/SD drivers Ulf Hansson

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