mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/6] mci: core: Use alias as a devname by default
@ 2018-12-07  7:33 Andrey Smirnov
  2018-12-07  7:33 ` [PATCH 2/6] mci: tegra-sdmmc: Drop explicit devname setup code Andrey Smirnov
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-12-07  7:33 UTC (permalink / raw)
  To: barebox; +Cc: 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.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/mci/mci-core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index c8d1d5e16..3efd80a8a 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -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
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/6] mci: tegra-sdmmc: Drop explicit devname setup code
  2018-12-07  7:33 [PATCH 1/6] mci: core: Use alias as a devname by default Andrey Smirnov
@ 2018-12-07  7:33 ` Andrey Smirnov
  2018-12-07  7:33 ` [PATCH 3/6] mci: dw_mmc: " Andrey Smirnov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-12-07  7:33 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

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

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/mci/tegra-sdmmc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/mci/tegra-sdmmc.c b/drivers/mci/tegra-sdmmc.c
index e465d891a..4c4791807 100644
--- a/drivers/mci/tegra-sdmmc.c
+++ b/drivers/mci/tegra-sdmmc.c
@@ -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);
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/6] mci: dw_mmc: Drop explicit devname setup code
  2018-12-07  7:33 [PATCH 1/6] mci: core: Use alias as a devname by default Andrey Smirnov
  2018-12-07  7:33 ` [PATCH 2/6] mci: tegra-sdmmc: Drop explicit devname setup code Andrey Smirnov
@ 2018-12-07  7:33 ` Andrey Smirnov
  2018-12-07  7:33 ` [PATCH 4/6] mci: omap_hsmmc: " Andrey Smirnov
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-12-07  7:33 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

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

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/mci/dw_mmc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/mci/dw_mmc.c b/drivers/mci/dw_mmc.c
index e4c550c3e..f035317ef 100644
--- a/drivers/mci/dw_mmc.c
+++ b/drivers/mci/dw_mmc.c
@@ -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);
 	}
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/6] mci: omap_hsmmc: Drop explicit devname setup code
  2018-12-07  7:33 [PATCH 1/6] mci: core: Use alias as a devname by default Andrey Smirnov
  2018-12-07  7:33 ` [PATCH 2/6] mci: tegra-sdmmc: Drop explicit devname setup code Andrey Smirnov
  2018-12-07  7:33 ` [PATCH 3/6] mci: dw_mmc: " Andrey Smirnov
@ 2018-12-07  7:33 ` Andrey Smirnov
  2018-12-07  7:33 ` [PATCH 5/6] mci: imx-esdhc: " Andrey Smirnov
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-12-07  7:33 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

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

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/mci/omap_hsmmc.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c
index cbc69e408..0cee3ec22 100644
--- a/drivers/mci/omap_hsmmc.c
+++ b/drivers/mci/omap_hsmmc.c
@@ -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;
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 5/6] mci: imx-esdhc: Drop explicit devname setup code
  2018-12-07  7:33 [PATCH 1/6] mci: core: Use alias as a devname by default Andrey Smirnov
                   ` (2 preceding siblings ...)
  2018-12-07  7:33 ` [PATCH 4/6] mci: omap_hsmmc: " Andrey Smirnov
@ 2018-12-07  7:33 ` Andrey Smirnov
  2018-12-07  7:33 ` [PATCH 6/6] mci: mxs: " Andrey Smirnov
  2018-12-10  9:03 ` [PATCH 1/6] mci: core: Use alias as a devname by default Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-12-07  7:33 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

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

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/mci/imx-esdhc.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index 7f2285635..09df7945c 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -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)
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 6/6] mci: mxs: Drop explicit devname setup code
  2018-12-07  7:33 [PATCH 1/6] mci: core: Use alias as a devname by default Andrey Smirnov
                   ` (3 preceding siblings ...)
  2018-12-07  7:33 ` [PATCH 5/6] mci: imx-esdhc: " Andrey Smirnov
@ 2018-12-07  7:33 ` Andrey Smirnov
  2018-12-10  9:03 ` [PATCH 1/6] mci: core: Use alias as a devname by default Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2018-12-07  7:33 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

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

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/mci/mxs.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/mci/mxs.c b/drivers/mci/mxs.c
index 446da8ad5..afd6a5639 100644
--- a/drivers/mci/mxs.c
+++ b/drivers/mci/mxs.c
@@ -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);
 	}
 
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/6] mci: core: Use alias as a devname by default
  2018-12-07  7:33 [PATCH 1/6] mci: core: Use alias as a devname by default Andrey Smirnov
                   ` (4 preceding siblings ...)
  2018-12-07  7:33 ` [PATCH 6/6] mci: mxs: " Andrey Smirnov
@ 2018-12-10  9:03 ` Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2018-12-10  9:03 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Thu, Dec 06, 2018 at 11:33:40PM -0800, Andrey Smirnov wrote:
> This idiom is repeatead by almost every mci driver, so move it to
> mci_of_parse() in order to reduce amount of duplicated code.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  drivers/mci/mci-core.c | 5 +++++
>  1 file changed, 5 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index c8d1d5e16..3efd80a8a 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -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
> -- 
> 2.19.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2018-12-10  9:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-07  7:33 [PATCH 1/6] mci: core: Use alias as a devname by default Andrey Smirnov
2018-12-07  7:33 ` [PATCH 2/6] mci: tegra-sdmmc: Drop explicit devname setup code Andrey Smirnov
2018-12-07  7:33 ` [PATCH 3/6] mci: dw_mmc: " Andrey Smirnov
2018-12-07  7:33 ` [PATCH 4/6] mci: omap_hsmmc: " Andrey Smirnov
2018-12-07  7:33 ` [PATCH 5/6] mci: imx-esdhc: " Andrey Smirnov
2018-12-07  7:33 ` [PATCH 6/6] mci: mxs: " Andrey Smirnov
2018-12-10  9:03 ` [PATCH 1/6] mci: core: Use alias as a devname by default Sascha Hauer

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