Skip to contentSkip to conversation

mmc: Minor cleanups and compile test

PATCH In review Krzysztof Kozlowski 7 participants 24 messages Sep 2, 2020 – Sep 11, 2020

Subsystems (12)
lore
Share & tools
lore
#1 lore raw

PATCH 1/11 mmc: bcm2835: Simplify with dev_err_probe()

In reply to Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/mmc/host/bcm2835.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/bcm2835.c +1 -3
index a0767790a826..35320bc9dc02 100644
@@ -1406,9 +1406,7 @@ static int bcm2835_probe(struct platform_device *pdev)
 
 	clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(clk)) {
-		ret = PTR_ERR(clk);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "could not get clk: %d\n", ret);
+		ret = dev_err_probe(dev, PTR_ERR(clk), "could not get clk\n");
 		goto err;
 	}
 
Signature · 1 line
2.17.1
#0 lore raw

cover mmc: Minor cleanups and compile test

Hi,

Set of minor cleanups. Patches requiring more attention:
- 6/11: Testing and review would be appreciated,
- 11/11: I build tested multiple architectures but not all and definitely no all possible configs. This one could sit on the lists for few days so 0-day would try it.

Best regards,
Krzysztof

Krzysztof Kozlowski (11):
mmc: bcm2835: Simplify with dev_err_probe()
mmc: davinci: Simplify with dev_err_probe()
mmc: dw_mmc-zx: Simplify with dev_err_probe()
mmc: jz4740: Simplify with dev_err_probe()
mmc: meson: Simplify with dev_err_probe()
mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe()
mmc: sdhci-of-arasan: Simplify with dev_err_probe()
mmc: sdhci-tegra: Simplify with dev_err_probe()
mmc: dw_mmc: Simplify with dev_err_probe()
mmc: sdhci-of-sparx5: Use proper printk format for dma_addr_t
mmc: host: Enable compile testing of multiple drivers

 drivers/mmc/host/Kconfig           | 42 ++++++++++++++++--------------
 drivers/mmc/host/bcm2835.c         |  4 +--
 drivers/mmc/host/davinci_mmc.c     |  5 ++--
 drivers/mmc/host/dw_mmc-zx.c       | 11 +++-----
 drivers/mmc/host/dw_mmc.c          |  9 +++----
 drivers/mmc/host/jz4740_mmc.c      |  5 ++--
 drivers/mmc/host/meson-gx-mmc.c    | 16 ++++--------
 drivers/mmc/host/sdhci-brcmstb.c   | 12 ++++-----
 drivers/mmc/host/sdhci-of-arasan.c |  7 +++--
 drivers/mmc/host/sdhci-of-sparx5.c |  4 +--
 drivers/mmc/host/sdhci-tegra.c     |  7 ++---
 11 files changed, 51 insertions(+), 71 deletions(-)
Signature · 7 lines
2.17.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#3 lore raw

PATCH 2/11 mmc: davinci: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/mmc/host/davinci_mmc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mmc/host/davinci_mmc.c +2 -3
index e50a08bce7ef..fad1010fb52b 100644
@@ -1240,9 +1240,8 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
 		pdev->id_entry = match->data;
 		ret = mmc_of_parse(mmc);
 		if (ret) {
-			if (ret != -EPROBE_DEFER)
-				dev_err(&pdev->dev,
-					"could not parse of data: %d\n", ret);
+			dev_err_probe(&pdev->dev, ret,
+				      "could not parse of data\n");
 			goto parse_fail;
 		}
 	} else {
Signature · 1 line
2.17.1
#4 lore raw

PATCH 3/11 mmc: dw_mmc-zx: Simplify with dev_err_probe()

In reply to Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/mmc/host/dw_mmc-zx.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/mmc/host/dw_mmc-zx.c +3 -8
index eada648b27ec..d9e483432a61 100644
@@ -155,7 +155,6 @@ static int dw_mci_zx_parse_dt(struct dw_mci *host)
 	struct device_node *node;
 	struct dw_mci_zx_priv_data *priv;
 	struct regmap *sysc_base;
-	int ret;
 
 	/* syscon is needed only by emmc */
 	node = of_parse_phandle(np, "zte,aon-syscon", 0);
@@ -163,13 +162,9 @@ static int dw_mci_zx_parse_dt(struct dw_mci *host)
 		sysc_base = syscon_node_to_regmap(node);
 		of_node_put(node);
 
-		if (IS_ERR(sysc_base)) {
-			ret = PTR_ERR(sysc_base);
-			if (ret != -EPROBE_DEFER)
-				dev_err(host->dev, "Can't get syscon: %d\n",
-					ret);
-			return ret;
-		}
+		if (IS_ERR(sysc_base))
+			return dev_err_probe(host->dev, PTR_ERR(sysc_base),
+					     "Can't get syscon\n");
 	} else {
 		return 0;
 	}
Signature · 1 line
2.17.1
#5 lore raw

PATCH 4/11 mmc: jz4740: Simplify with dev_err_probe()

In reply to Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/mmc/host/jz4740_mmc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mmc/host/jz4740_mmc.c +2 -3
index 81d71010b474..0c5b52b53303 100644
@@ -991,9 +991,8 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
 
 	ret = mmc_of_parse(mmc);
 	if (ret) {
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev,
-				"could not parse device properties: %d\n", ret);
+		dev_err_probe(&pdev->dev, ret,
+			      "could not parse device properties\n");
 		goto err_free_host;
 	}
 
Signature · 1 line
2.17.1
#8 lore raw

PATCH 5/11 mmc: meson: Simplify with dev_err_probe()

In reply to Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/mmc/host/meson-gx-mmc.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +5 -11
index 08a3b1c05acb..2802e4520783 100644
@@ -426,11 +426,9 @@ static int meson_mmc_clk_init(struct meson_host *host)
 
 		snprintf(name, sizeof(name), "clkin%d", i);
 		clk = devm_clk_get(host->dev, name);
-		if (IS_ERR(clk)) {
-			if (clk != ERR_PTR(-EPROBE_DEFER))
-				dev_err(host->dev, "Missing clock %s\n", name);
-			return PTR_ERR(clk);
-		}
+		if (IS_ERR(clk))
+			return dev_err_probe(host->dev, PTR_ERR(clk),
+					     "Missing clock %s\n", name);
 
 		mux_parent_names[i] = __clk_get_name(clk);
 	}
@@ -1077,12 +1075,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
 	}
 
 	ret = device_reset_optional(&pdev->dev);
-	if (ret) {
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "device reset failed: %d\n", ret);
-
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret, "device reset failed\n");
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	host->regs = devm_ioremap_resource(&pdev->dev, res);
Signature · 1 line
2.17.1
#9 lore raw

PATCH 6/11 mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe()

In reply to Krzysztof Kozlowski

Only -ENOENT from devm_clk_get() means that clock is not present in device tree. Other errors have their own meaning and should not be ignored.

Simplify getting the clock which is in fact optional and also use dev_err_probe() for handling deferred.

---

Not tested on HW.

---
 drivers/mmc/host/sdhci-brcmstb.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mmc/host/sdhci-brcmstb.c +5 -7
index ad01f6451a95..876668827580 100644
@@ -235,13 +235,11 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev)
 
 	dev_dbg(&pdev->dev, "Probe found match for %s\n",  match->compatible);
 
-	clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(clk)) {
-		if (PTR_ERR(clk) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-		dev_err(&pdev->dev, "Clock not found in Device Tree\n");
-		clk = NULL;
-	}
+	clk = devm_clk_get_optional(&pdev->dev, NULL);
+	if (IS_ERR(clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(clk),
+				     "Failed to get clock from Device Tree\n");
+
 	res = clk_prepare_enable(clk);
 	if (res)
 		return res;
Signature · 1 line
2.17.1
#12 lore raw

PATCH 7/11 mmc: sdhci-of-arasan: Simplify with dev_err_probe()

In reply to Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/mmc/host/sdhci-of-arasan.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +3 -4
index f186fbd016b1..3aea46db2ea7 100644
@@ -1543,10 +1543,9 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 		of_node_put(node);
 
 		if (IS_ERR(sdhci_arasan->soc_ctl_base)) {
-			ret = PTR_ERR(sdhci_arasan->soc_ctl_base);
-			if (ret != -EPROBE_DEFER)
-				dev_err(&pdev->dev, "Can't get syscon: %d\n",
-					ret);
+			ret = dev_err_probe(&pdev->dev,
+					    PTR_ERR(sdhci_arasan->soc_ctl_base),
+					    "Can't get syscon\n");
 			goto err_pltfm_free;
 		}
 	}
Signature · 1 line
2.17.1
#13 lore raw

PATCH 8/11 mmc: sdhci-tegra: Simplify with dev_err_probe()

In reply to Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/mmc/host/sdhci-tegra.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mmc/host/sdhci-tegra.c +2 -5
index 0a3f9d024f2a..118528f3325d 100644
@@ -1615,11 +1615,8 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 
 	clk = devm_clk_get(mmc_dev(host->mmc), NULL);
 	if (IS_ERR(clk)) {
-		rc = PTR_ERR(clk);
-
-		if (rc != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "failed to get clock: %d\n", rc);
-
+		rc = dev_err_probe(&pdev->dev, PTR_ERR(clk),
+				   "failed to get clock\n");
 		goto err_clk_get;
 	}
 	clk_prepare_enable(clk);
Signature · 1 line
2.17.1
#14 lore raw

PATCH 9/11 mmc: dw_mmc: Simplify with dev_err_probe()

In reply to Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code, the error value gets printed and real error from dw_mci_parse_dt() is passed further instead of fixed -EINVAL.

---
 drivers/mmc/host/dw_mmc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mmc/host/dw_mmc.c +3 -6
index 0fba940544ca..43c5795691fb 100644
@@ -3161,12 +3161,9 @@ int dw_mci_probe(struct dw_mci *host)
 
 	if (!host->pdata) {
 		host->pdata = dw_mci_parse_dt(host);
-		if (PTR_ERR(host->pdata) == -EPROBE_DEFER) {
-			return -EPROBE_DEFER;
-		} else if (IS_ERR(host->pdata)) {
-			dev_err(host->dev, "platform data not available\n");
-			return -EINVAL;
-		}
+		if (IS_ERR(host->pdata))
+			return dev_err_probe(host->dev, PTR_ERR(host->pdata),
+					     "platform data not available\n");
 	}
 
 	host->biu_clk = devm_clk_get(host->dev, "biu");
Signature · 1 line
2.17.1
#15 lore raw

PATCH 10/11 mmc: sdhci-of-sparx5: Use proper printk format for dma_addr_t

In reply to Krzysztof Kozlowski

dma_addr_t size varies between architectures so use dedicated printk format to fix compile testing warning (e.g. on 32-bit MIPS):

drivers/mmc/host/sdhci-of-sparx5.c:63:11: warning:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘dma_addr_t {aka unsigned int}’ [-Wformat=]

---
 drivers/mmc/host/sdhci-of-sparx5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-sparx5.c +2 -2
index 14b5dad6575a..747f108a0ace 100644
@@ -60,8 +60,8 @@ static void sdhci_sparx5_adma_write_desc(struct sdhci_host *host, void **desc,
 		return;
 	}
 
-	pr_debug("%s: write_desc: splitting dma len %d, offset 0x%0llx\n",
-		 mmc_hostname(host->mmc), len, addr);
+	pr_debug("%s: write_desc: splitting dma len %d, offset %pad\n",
+		 mmc_hostname(host->mmc), len, &addr);
 
 	offset = addr & (SZ_128M - 1);
 	tmplen = SZ_128M - offset;
Signature · 1 line
2.17.1
#17 lore raw

PATCH 11/11 mmc: host: Enable compile testing of multiple drivers

In reply to Krzysztof Kozlowski

Multiple MMC host controller driver can be compile tested as they do not depend on architecture specific headers.

---
 drivers/mmc/host/Kconfig | 42 ++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 19 deletions(-)
drivers/mmc/host/Kconfig +23 -19
index b95f79f53395..ff5a88faf877 100644
@@ -178,7 +178,7 @@ config MMC_SDHCI_OF_AT91
 config MMC_SDHCI_OF_ESDHC
 	tristate "SDHCI OF support for the Freescale eSDHC controller"
 	depends on MMC_SDHCI_PLTFM
-	depends on PPC || ARCH_MXC || ARCH_LAYERSCAPE
+	depends on PPC || ARCH_MXC || ARCH_LAYERSCAPE || COMPILE_TEST
 	select MMC_SDHCI_IO_ACCESSORS
 	select FSL_GUTS
 	help
@@ -216,7 +216,7 @@ config MMC_SDHCI_OF_DWCMSHC
 config MMC_SDHCI_OF_SPARX5
 	tristate "SDHCI OF support for the MCHP Sparx5 SoC"
 	depends on MMC_SDHCI_PLTFM
-	depends on ARCH_SPARX5
+	depends on ARCH_SPARX5 || COMPILE_TEST
 	help
 	  This selects the Secure Digital Host Controller Interface (SDHCI)
 	  found in the MCHP Sparx5 SoC.
@@ -238,7 +238,7 @@ config MMC_SDHCI_CADENCE
 
 config MMC_SDHCI_CNS3XXX
 	tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
-	depends on ARCH_CNS3XXX
+	depends on ARCH_CNS3XXX || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
 	help
 	  This selects the SDHCI support for CNS3xxx System-on-Chip devices.
@@ -262,7 +262,7 @@ config MMC_SDHCI_ESDHC_MCF
 
 config MMC_SDHCI_ESDHC_IMX
 	tristate "SDHCI support for the Freescale eSDHC/uSDHC i.MX controller"
-	depends on ARCH_MXC
+	depends on ARCH_MXC || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
 	select MMC_SDHCI_IO_ACCESSORS
 	select MMC_CQHCI
@@ -276,7 +276,7 @@ config MMC_SDHCI_ESDHC_IMX
 
 config MMC_SDHCI_DOVE
 	tristate "SDHCI support on Marvell's Dove SoC"
-	depends on ARCH_DOVE || MACH_DOVE
+	depends on ARCH_DOVE || MACH_DOVE || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
 	select MMC_SDHCI_IO_ACCESSORS
 	help
@@ -289,7 +289,7 @@ config MMC_SDHCI_DOVE
 
 config MMC_SDHCI_TEGRA
 	tristate "SDHCI platform support for the Tegra SD/MMC Controller"
-	depends on ARCH_TEGRA
+	depends on ARCH_TEGRA || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
 	select MMC_SDHCI_IO_ACCESSORS
 	select MMC_CQHCI
@@ -301,7 +301,8 @@ config MMC_SDHCI_TEGRA
 
 config MMC_SDHCI_S3C
 	tristate "SDHCI support on Samsung S3C SoC"
-	depends on MMC_SDHCI && (PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS)
+	depends on MMC_SDHCI
+	depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
 	help
 	  This selects the Secure Digital Host Controller Interface (SDHCI)
 	  often referrered to as the HSMMC block in some of the Samsung S3C
@@ -313,7 +314,7 @@ config MMC_SDHCI_S3C
 
 config MMC_SDHCI_SIRF
 	tristate "SDHCI support on CSR SiRFprimaII and SiRFmarco SoCs"
-	depends on ARCH_SIRF
+	depends on ARCH_SIRF || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
 	select MMC_SDHCI_IO_ACCESSORS
 	help
@@ -351,7 +352,8 @@ config MMC_SDHCI_PXAV2
 
 config MMC_SDHCI_SPEAR
 	tristate "SDHCI support on ST SPEAr platform"
-	depends on MMC_SDHCI && PLAT_SPEAR
+	depends on MMC_SDHCI
+	depends on PLAT_SPEAR || COMPILE_TEST
 	depends on OF
 	help
 	  This selects the Secure Digital Host Controller Interface (SDHCI)
@@ -374,7 +376,7 @@ config MMC_SDHCI_S3C_DMA
 
 config MMC_SDHCI_BCM_KONA
 	tristate "SDHCI support on Broadcom KONA platform"
-	depends on ARCH_BCM_MOBILE
+	depends on ARCH_BCM_MOBILE || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
 	help
 	  This selects the Broadcom Kona Secure Digital Host Controller
@@ -422,7 +424,8 @@ config MMC_SDHCI_IPROC
 
 config MMC_MESON_GX
 	tristate "Amlogic S905/GX*/AXG SD/MMC Host Controller support"
-	depends on ARCH_MESON && MMC
+	depends on MMC
+	depends on ARCH_MESON|| COMPILE_TEST
 	help
 	  This selects support for the Amlogic SD/MMC Host Controller
 	  found on the S905/GX*/AXG family of SoCs.  This controller is
@@ -458,7 +461,8 @@ config MMC_MESON_MX_SDIO
 
 config MMC_MOXART
 	tristate "MOXART SD/MMC Host Controller support"
-	depends on ARCH_MOXART && MMC
+	depends on MMC
+	depends on ARCH_MOXART || COMPILE_TEST
 	help
 	  This selects support for the MOXART SD/MMC Host Controller.
 	  MOXA provides one multi-functional card reader which can
@@ -467,7 +471,7 @@ config MMC_MOXART
 
 config MMC_SDHCI_ST
 	tristate "SDHCI support on STMicroelectronics SoC"
-	depends on ARCH_STI || FSP2
+	depends on ARCH_STI || FSP2 || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
 	select MMC_SDHCI_IO_ACCESSORS
 	help
@@ -587,7 +591,7 @@ config MMC_TIFM_SD
 
 config MMC_MVSDIO
 	tristate "Marvell MMC/SD/SDIO host driver"
-	depends on PLAT_ORION
+	depends on PLAT_ORION || (COMPILE_TEST && ARM)
 	depends on OF
 	help
 	  This selects the Marvell SDIO host driver.
@@ -599,7 +603,7 @@ config MMC_MVSDIO
 
 config MMC_DAVINCI
 	tristate "TI DAVINCI Multimedia Card Interface support"
-	depends on ARCH_DAVINCI
+	depends on ARCH_DAVINCI || COMPILE_TEST
 	help
 	  This selects the TI DAVINCI Multimedia card Interface.
 	  If you have an DAVINCI board with a Multimedia Card slot,
@@ -628,7 +632,7 @@ config MMC_SPI
 
 config MMC_S3C
 	tristate "Samsung S3C SD/MMC Card Interface support"
-	depends on ARCH_S3C24XX
+	depends on ARCH_S3C24XX || COMPILE_TEST
 	depends on S3C24XX_DMAC
 	help
 	  This selects a driver for the MCI interface found in
@@ -681,7 +685,7 @@ config MMC_SDRICOH_CS
 
 config MMC_SDHCI_SPRD
 	tristate "Spreadtrum SDIO host Controller"
-	depends on ARCH_SPRD
+	depends on ARCH_SPRD || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
 	select MMC_SDHCI_IO_ACCESSORS
 	select MMC_HSQ
@@ -698,7 +702,7 @@ config MMC_TMIO_CORE
 
 config MMC_TMIO
 	tristate "Toshiba Mobile IO Controller (TMIO) MMC/SD function support"
-	depends on MFD_TMIO || MFD_ASIC3
+	depends on MFD_TMIO || MFD_ASIC3 || COMPILE_TEST
 	select MMC_TMIO_CORE
 	help
 	  This provides support for the SD/MMC cell found in TC6393XB,
@@ -971,7 +975,7 @@ config MMC_REALTEK_USB
 
 config MMC_SUNXI
 	tristate "Allwinner sunxi SD/MMC Host Controller support"
-	depends on ARCH_SUNXI
+	depends on ARCH_SUNXI || COMPILE_TEST
 	help
 	  This selects support for the SD/MMC Host Controller on
 	  Allwinner sunxi SoCs.
Signature · 1 line
2.17.1
Acked-by on v1 6/11
#10 lore raw

Re: [RFT 06/11] mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe()

In reply to Krzysztof Kozlowski
Quoted 8 lines · Krzysztof Kozlowski

Only -ENOENT from devm_clk_get() means that clock is not present in device tree. Other errors have their own meaning and should not be ignored.

Simplify getting the clock which is in fact optional and also use dev_err_probe() for handling deferred.

This is actually an open coded version of devm_clk_get_optional(), so this is fine:

Signature · 1 line
Florian
#18 lore raw

Re: [PATCH 11/11] mmc: host: Enable compile testing of multiple drivers

In reply to Krzysztof Kozlowski
Quoted 2 lines · Krzysztof Kozlowski

Multiple MMC host controller driver can be compile tested as they do not depend on architecture specific headers.

[...]

Quoted 3 lines
drivers/mmc/host/Kconfig +0 -0
@@ -178,7 +178,7 @@ config MMC_SDHCI_OF_AT91

[...]

Quoted 5 lines

config MMC_MESON_GX

drivers/mmc/host/Kconfig +2 -1
 	tristate "Amlogic S905/GX*/AXG SD/MMC Host Controller support"
-	depends on ARCH_MESON && MMC
+	depends on MMC
+	depends on ARCH_MESON|| COMPILE_TEST

[...]

drivers/mmc/host/Kconfig config MMC_MESON_MX_SDIO · line 465

Quoted 5 lines

config MMC_MOXART

drivers/mmc/host/Kconfig +2 -1
 	tristate "MOXART SD/MMC Host Controller support"
-	depends on ARCH_MOXART && MMC
+	depends on MMC
+	depends on ARCH_MOXART || COMPILE_TEST

[...]

You can drop 'MMC' from depends as the whole tree is under 'if MMC' already.

Best Regards,
Michał Mirosław

#19 lore raw

Re: [PATCH 11/11] mmc: host: Enable compile testing of multiple drivers

Quoted 14 lines · Michał Mirosław
Quoted 2 lines · Krzysztof Kozlowski

Multiple MMC host controller driver can be compile tested as they do not depend on architecture specific headers.

[...]

Quoted 3 lines
drivers/mmc/host/Kconfig +0 -0
@@ -178,7 +178,7 @@ config MMC_SDHCI_OF_AT91

[...]

Quoted 5 lines

config MMC_MESON_GX

drivers/mmc/host/Kconfig +2 -1
 	tristate "Amlogic S905/GX*/AXG SD/MMC Host Controller support"
-	depends on ARCH_MESON && MMC
+	depends on MMC
+	depends on ARCH_MESON|| COMPILE_TEST

[...]

Quoted 8 lines

drivers/mmc/host/Kconfig config MMC_MESON_MX_SDIO · line 465

Quoted 5 lines

config MMC_MOXART

drivers/mmc/host/Kconfig +2 -1
 	tristate "MOXART SD/MMC Host Controller support"
-	depends on ARCH_MOXART && MMC
+	depends on MMC
+	depends on ARCH_MOXART || COMPILE_TEST

[...]

You can drop 'MMC' from depends as the whole tree is under 'if MMC' already.

Right, thanks for feedback.

Best regards,
Krzysztof

#11 lore raw

Re: [RFT 06/11] mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe()

In reply to Florian Fainelli
Quoted 8 lines · Florian Fainelli
Quoted 4 lines · Krzysztof Kozlowski

Only -ENOENT from devm_clk_get() means that clock is not present in device tree. Other errors have their own meaning and should not be ignored.

Quoted 7 lines
Quoted 4 lines

Simplify getting the clock which is in fact optional and also use dev_err_probe() for handling deferred.

This is actually an open coded version of devm_clk_get_optional(), so this is fine:

devm_clk_get_optional() treats -ENOENT specifically, so it's not an exact open coded version. I think that's why Krzysztof prefered to get it tested on HW.

Quoted 2 lines

Thanks!

I am queuing this up for next, without waiting for explicit tests . There is time to get that from testing in linux-next anyway.

Kind regards
Uffe

#20 lore raw
In reply to Krzysztof Kozlowski
Quoted 38 lines · Krzysztof Kozlowski

Hi,

Set of minor cleanups. Patches requiring more attention:
- 6/11: Testing and review would be appreciated,
- 11/11: I build tested multiple architectures but not all and definitely no all possible configs. This one could sit on the lists for few days so 0-day would try it.

Best regards,
Krzysztof

Krzysztof Kozlowski (11):
mmc: bcm2835: Simplify with dev_err_probe()
mmc: davinci: Simplify with dev_err_probe()
mmc: dw_mmc-zx: Simplify with dev_err_probe()
mmc: jz4740: Simplify with dev_err_probe()
mmc: meson: Simplify with dev_err_probe()
mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe()
mmc: sdhci-of-arasan: Simplify with dev_err_probe()
mmc: sdhci-tegra: Simplify with dev_err_probe()
mmc: dw_mmc: Simplify with dev_err_probe()
mmc: sdhci-of-sparx5: Use proper printk format for dma_addr_t
mmc: host: Enable compile testing of multiple drivers

 drivers/mmc/host/Kconfig           | 42 ++++++++++++++++--------------
 drivers/mmc/host/bcm2835.c         |  4 +--
 drivers/mmc/host/davinci_mmc.c     |  5 ++--
 drivers/mmc/host/dw_mmc-zx.c       | 11 +++-----
 drivers/mmc/host/dw_mmc.c          |  9 +++----
 drivers/mmc/host/jz4740_mmc.c      |  5 ++--
 drivers/mmc/host/meson-gx-mmc.c    | 16 ++++--------
 drivers/mmc/host/sdhci-brcmstb.c   | 12 ++++-----
 drivers/mmc/host/sdhci-of-arasan.c |  7 +++--
 drivers/mmc/host/sdhci-of-sparx5.c |  4 +--
 drivers/mmc/host/sdhci-tegra.c     |  7 ++---
 11 files changed, 51 insertions(+), 71 deletions(-)
Quoted 3 lines

--
2.17.1

Series applied for next, except 11, thanks!

Kind regards
Uffe

#21 lore raw
Quoted 2 lines · Ulf Hansson

Series applied for next, except 11, thanks!

Thanks. I will fix pointed compile-test issues and send later a follow up, also removing the MMC dependency as pointed by Michał.

Best regards,
Krzysztof

maintainer Reviewed-by on v1 4/11
#6 lore raw

Re: [PATCH 04/11] mmc: jz4740: Simplify with dev_err_probe()

In reply to Krzysztof Kozlowski

Hi Krzysztof,

Quoted 13 lines · Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/mmc/host/jz4740_mmc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mmc/host/jz4740_mmc.c +0 -0
index 81d71010b474..0c5b52b53303 100644

drivers/mmc/host/jz4740_mmc.c static int jz4740_mmc_probe(struct · line 996

Quoted 9 lines
drivers/mmc/host/jz4740_mmc.c +2 -3
@@ -991,9 +991,8 @@ static int jz4740_mmc_probe(struct 
 platform_device* pdev)
 
 	ret = mmc_of_parse(mmc);
 	if (ret) {
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev,
-				"could not parse device properties: %d\n", ret);
+		dev_err_probe(&pdev->dev, ret,
+			      "could not parse device properties\n");

I think you can put that on one line.

With that said:

Cheers,
-Paul

Quoted 6 lines
drivers/mmc/host/jz4740_mmc.c +0 -1
 		goto err_free_host;
 	}
 
--

2.17.1

#7 lore raw

Re: [PATCH 04/11] mmc: jz4740: Simplify with dev_err_probe()

Quoted 21 lines · Paul Cercueil

Hi Krzysztof,

Le mer. 2 sept. 2020 à 21:36, Krzysztof Kozlowski <[email protected]> a écrit :

Quoted 16 lines

Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed.

---
 drivers/mmc/host/jz4740_mmc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mmc/host/jz4740_mmc.c +0 -0
index 81d71010b474..0c5b52b53303 100644
@@ -991,9 +991,8 @@ static int jz4740_mmc_probe(struct
 platform_device* pdev)
 
Quoted 9 lines

drivers/mmc/host/jz4740_mmc.c static int jz4740_mmc_probe(struct platform_device* pdev) · line 995

Quoted 7 lines
drivers/mmc/host/jz4740_mmc.c +2 -3
      ret = mmc_of_parse(mmc);
      if (ret) {
-             if (ret != -EPROBE_DEFER)
-                     dev_err(&pdev->dev,
-                             "could not parse device properties: %d\n", ret);
+             dev_err_probe(&pdev->dev, ret,
+                           "could not parse device properties\n");

I think you can put that on one line.

I can amend the patch when I rebase my branch next week, no need for a resend.

Quoted 3 lines

With that said:

And I add your tag as well, thanks!

Kind regards
Uffe

Quoted 12 lines

Cheers,
-Paul

Quoted 6 lines
drivers/mmc/host/jz4740_mmc.c +0 -1
              goto err_free_host;
      }
 
--

2.17.1

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

Acked-by on v1 10/11
#16 lore raw

Re: [PATCH 10/11] mmc: sdhci-of-sparx5: Use proper printk format for dma_addr_t

In reply to Krzysztof Kozlowski
Quoted 16 lines · Krzysztof Kozlowski

dma_addr_t size varies between architectures so use dedicated printk format to fix compile testing warning (e.g. on 32-bit MIPS):

drivers/mmc/host/sdhci-of-sparx5.c:63:11: warning:
format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘dma_addr_t {aka unsigned int}’ [-Wformat=]

---
 drivers/mmc/host/sdhci-of-sparx5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-sparx5.c +0 -0
index 14b5dad6575a..747f108a0ace 100644

drivers/mmc/host/sdhci-of-sparx5.c static void sdhci_sparx5_adma_write_desc(struct sdhci_host *host, void **desc, · line 67

Quoted 10 lines
drivers/mmc/host/sdhci-of-sparx5.c +2 -2
@@ -60,8 +60,8 @@ static void sdhci_sparx5_adma_write_desc(struct sdhci_host *host, void **desc,
                return;
        }
 
-       pr_debug("%s: write_desc: splitting dma len %d, offset 0x%0llx\n",
-                mmc_hostname(host->mmc), len, addr);
+       pr_debug("%s: write_desc: splitting dma len %d, offset %pad\n",
+                mmc_hostname(host->mmc), len, &addr);
 
        offset = addr & (SZ_128M - 1);
        tmplen = SZ_128M - offset;
Signature · 2 lines
Lars Povlsen,
Microchip
#22 lore raw
In reply to Ulf Hansson
Quoted 40 lines · Ulf Hansson
Quoted 38 lines · Krzysztof Kozlowski

Hi,

Set of minor cleanups. Patches requiring more attention:
- 6/11: Testing and review would be appreciated,
- 11/11: I build tested multiple architectures but not all and definitely no all possible configs. This one could sit on the lists for few days so 0-day would try it.

Best regards,
Krzysztof

Krzysztof Kozlowski (11):
mmc: bcm2835: Simplify with dev_err_probe()
mmc: davinci: Simplify with dev_err_probe()
mmc: dw_mmc-zx: Simplify with dev_err_probe()
mmc: jz4740: Simplify with dev_err_probe()
mmc: meson: Simplify with dev_err_probe()
mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe()
mmc: sdhci-of-arasan: Simplify with dev_err_probe()
mmc: sdhci-tegra: Simplify with dev_err_probe()
mmc: dw_mmc: Simplify with dev_err_probe()
mmc: sdhci-of-sparx5: Use proper printk format for dma_addr_t
mmc: host: Enable compile testing of multiple drivers

 drivers/mmc/host/Kconfig           | 42 ++++++++++++++++--------------
 drivers/mmc/host/bcm2835.c         |  4 +--
 drivers/mmc/host/davinci_mmc.c     |  5 ++--
 drivers/mmc/host/dw_mmc-zx.c       | 11 +++-----
 drivers/mmc/host/dw_mmc.c          |  9 +++----
 drivers/mmc/host/jz4740_mmc.c      |  5 ++--
 drivers/mmc/host/meson-gx-mmc.c    | 16 ++++--------
 drivers/mmc/host/sdhci-brcmstb.c   | 12 ++++-----
 drivers/mmc/host/sdhci-of-arasan.c |  7 +++--
 drivers/mmc/host/sdhci-of-sparx5.c |  4 +--
 drivers/mmc/host/sdhci-tegra.c     |  7 ++---
 11 files changed, 51 insertions(+), 71 deletions(-)
Quoted 5 lines
Quoted 3 lines

--
2.17.1

Series applied for next, except 11, thanks!

I see there's a bunch of these already, but I think we can do better here than dev_err_probe. We have _optional variants for the case not getting a resource is not an error. So the called functions like devm_clk_get can print an error. We already have this for platform_get_irq along with a coccinelle script to fix cases. I have a WIP branch[1] doing this.

Rob

[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git dev_err-removal

#23 lore raw
Quoted 46 lines · Rob Herring
Quoted 44 lines · Ulf Hansson
Quoted 41 lines · Krzysztof Kozlowski

Hi,

Set of minor cleanups. Patches requiring more attention:
- 6/11: Testing and review would be appreciated,
- 11/11: I build tested multiple architectures but not all and definitely no all possible configs. This one could sit on the lists for few days so 0-day would try it.

Best regards,
Krzysztof

Krzysztof Kozlowski (11):
mmc: bcm2835: Simplify with dev_err_probe()
mmc: davinci: Simplify with dev_err_probe()
mmc: dw_mmc-zx: Simplify with dev_err_probe()
mmc: jz4740: Simplify with dev_err_probe()
mmc: meson: Simplify with dev_err_probe()
mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe()
mmc: sdhci-of-arasan: Simplify with dev_err_probe()
mmc: sdhci-tegra: Simplify with dev_err_probe()
mmc: dw_mmc: Simplify with dev_err_probe()
mmc: sdhci-of-sparx5: Use proper printk format for dma_addr_t
mmc: host: Enable compile testing of multiple drivers

 drivers/mmc/host/Kconfig           | 42 ++++++++++++++++--------------
 drivers/mmc/host/bcm2835.c         |  4 +--
 drivers/mmc/host/davinci_mmc.c     |  5 ++--
 drivers/mmc/host/dw_mmc-zx.c       | 11 +++-----
 drivers/mmc/host/dw_mmc.c          |  9 +++----
 drivers/mmc/host/jz4740_mmc.c      |  5 ++--
 drivers/mmc/host/meson-gx-mmc.c    | 16 ++++--------
 drivers/mmc/host/sdhci-brcmstb.c   | 12 ++++-----
 drivers/mmc/host/sdhci-of-arasan.c |  7 +++--
 drivers/mmc/host/sdhci-of-sparx5.c |  4 +--
 drivers/mmc/host/sdhci-tegra.c     |  7 ++---
 11 files changed, 51 insertions(+), 71 deletions(-)

--
2.17.1

Quoted 8 lines
Quoted 1 line

Series applied for next, except 11, thanks!

I see there's a bunch of these already, but I think we can do better here than dev_err_probe. We have _optional variants for the case not getting a resource is not an error. So the called functions like devm_clk_get can print an error. We already have this for platform_get_irq along with a coccinelle script to fix cases. I have a WIP branch[1] doing this.

That's quite good idea.

Best regards,
Krzysztof