summaryrefslogtreecommitdiffstats
path: root/drivers/mci
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-12-06 23:33:40 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2018-12-10 10:02:52 +0100
commit89901703a22c265e1a20934bf15eb113fe550326 (patch)
tree78d5323187b2fead55ee36b1f2e1567f556f2c58 /drivers/mci
parentb76b1e8a7856719c187bef2d2c329635a730b9c9 (diff)
downloadbarebox-89901703a22c265e1a20934bf15eb113fe550326.tar.gz
barebox-89901703a22c265e1a20934bf15eb113fe550326.tar.xz
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 <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci')
-rw-r--r--drivers/mci/mci-core.c5
1 files changed, 5 insertions, 0 deletions
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