From 89901703a22c265e1a20934bf15eb113fe550326 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:33:40 -0800 Subject: 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. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- 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 c8d1d5e164..3efd80a8a1 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 -- cgit v1.2.3 From 3ae1a15007ea71a04c0e634b48d44cd895d1a651 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:33:41 -0800 Subject: mci: tegra-sdmmc: Drop explicit devname setup code Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- 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 e465d891a2..4c47918076 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); -- cgit v1.2.3 From 0f5038d626de3190440c1bbe151ac55031fdda76 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:33:42 -0800 Subject: mci: dw_mmc: Drop explicit devname setup code Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- 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 e4c550c3ed..f035317ef2 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); } -- cgit v1.2.3 From 1b1ab68d91adefc69cfce5f0083c02bee349a27b Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:33:43 -0800 Subject: mci: omap_hsmmc: Drop explicit devname setup code Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- 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 cbc69e4083..0cee3ec22d 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; -- cgit v1.2.3 From d8470c4bba600d5f9e857a551bd5b33c3c24594e Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:33:44 -0800 Subject: mci: imx-esdhc: Drop explicit devname setup code Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- 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 7f2285635b..09df7945cb 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) -- cgit v1.2.3 From 59f7c6e6fa3d9d81074c5ec0f86361917db951de Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:33:45 -0800 Subject: mci: mxs: Drop explicit devname setup code Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/mci/mxs.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/mci/mxs.c b/drivers/mci/mxs.c index 446da8ad53..afd6a56397 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); } -- cgit v1.2.3