diff options
author | vdumpa <vdumpa@nvidia.com> | 2010-07-28 16:05:08 -0700 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2010-07-28 17:01:25 -0700 |
commit | c73596cdb7b88c0abd5802c28703c2385fc40aee (patch) | |
tree | a2d89d15962f078735469b3cfcb5d0345cd7dccb | |
parent | fdc51b5f2f7952f3ee1674bc4e29a7712c88f068 (diff) |
[tegra mmc] Generate mmcblk names based on controller.
Generate mmcblk[%d] names based on sdhci controller instance numbers.
Bug 700011
Change-Id: I2be0c88f45cb2044306b1f8b8fe98ee95a800e0e
Reviewed-on: http://git-master.nvidia.com/r/4274
Reviewed-by: Jonathan Mayo <jmayo@nvidia.com>
Tested-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Gary King <gking@nvidia.com>
-rw-r--r-- | drivers/mmc/card/Kconfig | 10 | ||||
-rw-r--r-- | drivers/mmc/card/block.c | 19 |
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/mmc/card/Kconfig b/drivers/mmc/card/Kconfig index 86948f90c3ff..d89c495e6f27 100644 --- a/drivers/mmc/card/Kconfig +++ b/drivers/mmc/card/Kconfig @@ -41,6 +41,16 @@ config MMC_BLOCK_DEFERRED_RESUME is requested. This will reduce overall resume latency and save power when theres an SD card inserted but not being used. +config MMC_BLOCK_DEVICE_NUMBERING + bool "Enable mmc block device numbering based on controller instance" + depends on MMC_BLOCK + default n + help + Say Y here to enable mmc block device numbering based on the + sdhci controller instance number. This will make sure that + the card connected to instance n will have block device + name as mmcblkn. + config SDIO_UART tristate "SDIO UART/GPS class support" help diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 8d2bd242ac63..191989d6ccdd 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -516,12 +516,31 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) { struct mmc_blk_data *md; int devidx, ret; +#ifdef CONFIG_MMC_BLOCK_DEVICE_NUMBERING + int idx; + const char *mmc_blk_name; +#endif devidx = find_first_zero_bit(dev_use, MMC_NUM_MINORS); if (devidx >= MMC_NUM_MINORS) return ERR_PTR(-ENOSPC); __set_bit(devidx, dev_use); +#ifdef CONFIG_MMC_BLOCK_DEVICE_NUMBERING + mmc_blk_name = kobject_name(&card->host->parent->kobj); + mmc_blk_name = mmc_blk_name ? strrchr(mmc_blk_name, '.') : mmc_blk_name; + if (mmc_blk_name) { + mmc_blk_name++; + idx = simple_strtol(mmc_blk_name, NULL, 10); + if ( (idx >= 0) && (idx != devidx) && + (!test_bit(idx, dev_use)) && (idx < MMC_NUM_MINORS) ) { + __set_bit(idx, dev_use); + __clear_bit(devidx, dev_use); + devidx = idx; + } + } +#endif + md = kzalloc(sizeof(struct mmc_blk_data), GFP_KERNEL); if (!md) { ret = -ENOMEM; |