summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-11-29 16:49:29 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-12-17 08:42:32 +0100
commit30eb68037835061a4003a7a279b15a1e78c6d4ac (patch)
treedb55293b9c718cfdd832f536d114c8e1001eb90a /drivers
parentf3468dc387f2a1f3a4ae5f9a921ba6b3d2c31ab5 (diff)
downloadbarebox-30eb68037835061a4003a7a279b15a1e78c6d4ac.tar.gz
barebox-30eb68037835061a4003a7a279b15a1e78c6d4ac.tar.xz
mci: Allow to specify device name
When multiple MMC/SD cards are present in the system we often have to have persistent names to identify them during runtime. This patch allows to overwrite the devicename which is used. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mci/mci-core.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index e29bd2ed3e..559f8abc9a 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1397,9 +1397,13 @@ static int mci_card_probe(struct mci *mci)
mci->blk.dev = mci->mci_dev;
mci->blk.ops = &mci_ops;
- disknum = cdev_find_free_index("disk");
+ if (host->devname) {
+ mci->blk.cdev.name = strdup(host->devname);
+ } else {
+ disknum = cdev_find_free_index("disk");
+ mci->blk.cdev.name = asprintf("disk%d", disknum);
+ }
- mci->blk.cdev.name = asprintf("disk%d", disknum);
mci->blk.blockbits = SECTOR_SHIFT;
mci->blk.num_blocks = mci_calc_blk_cnt(mci->capacity, mci->blk.blockbits);
@@ -1409,7 +1413,7 @@ static int mci_card_probe(struct mci *mci)
goto on_error;
}
- dev_info(mci->mci_dev, "registered disk%d\n", disknum);
+ dev_info(mci->mci_dev, "registered %s\n", mci->blk.cdev.name);
/* create partitions on demand */
rc = parse_partition_table(&mci->blk);