Skip to contentSkip to conversation

mci: core: Use alias as a devname by default

PATCH Applied Andrey Smirnov 2 participants 7 messages Dec 7, 2018 – Dec 10, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 mci: core: Use alias as a devname by default

This idiom is repeatead by almost every mci driver, so move it to mci_of_parse() in order to reduce amount of duplicated code.

---
 drivers/mci/mci-core.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mci/mci-core.c +5 -0
index c8d1d5e16..3efd80a8a 100644
@@ -1858,6 +1858,7 @@ void mci_of_parse_node(struct mci_host *host,
 {
 	u32 bus_width;
 	u32 dsr_val;
+	const char *alias;
 
 	if (!IS_ENABLED(CONFIG_OFDEVICE))
 		return;
@@ -1865,6 +1866,10 @@ void mci_of_parse_node(struct mci_host *host,
 	if (!host->hw_dev || !np)
 		return;
 
+	alias = of_alias_get(np);
+	if (alias)
+		host->devname = xstrdup(alias);
+
 	/* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */
 	if (of_property_read_u32(np, "bus-width", &bus_width) < 0) {
 		/* If bus-width is missing we get the driver's default, which
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/6 mci: tegra-sdmmc: Drop explicit devname setup code

Drop explicit devname setup code. Same setup will be done by mci_of_parse().

---
 drivers/mci/tegra-sdmmc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/mci/tegra-sdmmc.c +0 -3
index e465d891a..4c4791807 100644
@@ -411,10 +411,7 @@ static int tegra_sdmmc_detect(struct device_d *dev)
 static void tegra_sdmmc_parse_dt(struct tegra_sdmmc_host *host)
 {
 	struct device_node *np = host->mci.hw_dev->device_node;
-	const char *alias = of_alias_get(np);
 
-	if (alias)
-		host->mci.devname = xstrdup(alias);
 	host->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0);
 	host->gpio_pwr = of_get_named_gpio(np, "power-gpios", 0);
 	mci_of_parse(&host->mci);
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 3/6 mci: dw_mmc: Drop explicit devname setup code

In reply to Andrey Smirnov

Drop explicit devname setup code. Same setup will be done by mci_of_parse().

---
 drivers/mci/dw_mmc.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/mci/dw_mmc.c +0 -3
index e4c550c3e..f035317ef 100644
@@ -602,9 +602,6 @@ static int dw_mmc_probe(struct device_d *dev)
 		host->mci.host_caps &= ~MMC_CAP_BIT_DATA_MASK;
 		host->mci.host_caps |= pdata->bus_width_caps;
 	} else if (dev->device_node) {
-		const char *alias = of_alias_get(dev->device_node);
-		if (alias)
-			host->mci.devname = xstrdup(alias);
 		of_property_read_u32(dev->device_node, "dw-mshc-ciu-div",
 				&host->ciu_div);
 	}
Signature · 7 lines
2.19.1


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

PATCH 4/6 mci: omap_hsmmc: Drop explicit devname setup code

In reply to Andrey Smirnov

Drop explicit devname setup code. Same setup will be done by mci_of_parse().

---
 drivers/mci/omap_hsmmc.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/mci/omap_hsmmc.c +0 -6
index cbc69e408..0cee3ec22 100644
@@ -625,12 +625,6 @@ static int omap_mmc_probe(struct device_d *dev)
 			hsmmc->mci.devname = pdata->devname;
 	}
 
-	if (dev->device_node) {
-		const char *alias = of_alias_get(dev->device_node);
-		if (alias)
-			hsmmc->mci.devname = xstrdup(alias);
-	}
-
 	mci_of_parse(&hsmmc->mci);
 
 	dev->priv = hsmmc;
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 5/6 mci: imx-esdhc: Drop explicit devname setup code

In reply to Andrey Smirnov

Drop explicit devname setup code. Same setup will be done by mci_of_parse().

---
 drivers/mci/imx-esdhc.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/mci/imx-esdhc.c +0 -4
index 7f2285635..09df7945c 100644
@@ -668,10 +668,6 @@ static int fsl_esdhc_probe(struct device_d *dev)
 		mci->host_caps = pdata->caps;
 		if (pdata->devname)
 			mci->devname = pdata->devname;
-	} else if (dev->device_node) {
-		const char *alias = of_alias_get(dev->device_node);
-		if (alias)
-			mci->devname = xstrdup(alias);
 	}
 
 	if (caps & ESDHC_HOSTCAPBLT_HSS)
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 6/6 mci: mxs: Drop explicit devname setup code

In reply to Andrey Smirnov

Drop explicit devname setup code. Same setup will be done by mci_of_parse().

---
 drivers/mci/mxs.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/mci/mxs.c +0 -6
index 446da8ad5..afd6a5639 100644
@@ -574,12 +574,6 @@ static int mxs_mci_probe(struct device_d *hw_dev)
 		/* fixed to 3.3 V */
 		host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
 
-		if (hw_dev->device_node) {
-			const char *alias = of_alias_get(hw_dev->device_node);
-			if (alias)
-				host->devname = xstrdup(alias);
-		}
-
 		mci_of_parse(host);
 	}
 
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer Applied
#6 lore raw
In reply to Andrey Smirnov
Quoted 7 lines · Andrey Smirnov

This idiom is repeatead by almost every mci driver, so move it to mci_of_parse() in order to reduce amount of duplicated code.

---
 drivers/mci/mci-core.c | 5 +++++
 1 file changed, 5 insertions(+)

Applied, thanks

Sascha

Quoted 33 lines
drivers/mci/mci-core.c +5 -0
index c8d1d5e16..3efd80a8a 100644
@@ -1858,6 +1858,7 @@ void mci_of_parse_node(struct mci_host *host,
 {
 	u32 bus_width;
 	u32 dsr_val;
+	const char *alias;
 
 	if (!IS_ENABLED(CONFIG_OFDEVICE))
 		return;
@@ -1865,6 +1866,10 @@ void mci_of_parse_node(struct mci_host *host,
 	if (!host->hw_dev || !np)
 		return;
 
+	alias = of_alias_get(np);
+	if (alias)
+		host->devname = xstrdup(alias);
+
 	/* "bus-width" is translated to MMC_CAP_*_BIT_DATA flags */
 	if (of_property_read_u32(np, "bus-width", &bus_width) < 0) {
 		/* If bus-width is missing we get the driver's default, which
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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