From 30eb68037835061a4003a7a279b15a1e78c6d4ac Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 29 Nov 2012 16:49:29 +0100 Subject: 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 --- drivers/mci/mci-core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers') 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); -- cgit v1.2.3