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>
This commit is contained in:
parent
f3468dc387
commit
30eb680378
|
@ -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);
|
||||
|
|
|
@ -286,6 +286,7 @@ struct mci_ios {
|
|||
/** host information */
|
||||
struct mci_host {
|
||||
struct device_d *hw_dev; /**< the host MCI hardware device */
|
||||
char *devname; /**< the devicename for the card, defaults to disk%d */
|
||||
unsigned voltages;
|
||||
unsigned host_caps; /**< Host's interface capabilities, refer MMC_VDD_* */
|
||||
unsigned f_min; /**< host interface lower limit */
|
||||
|
|
Loading…
Reference in New Issue