linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: stefan@agner.ch
To: chris@printf.net, linux-mmc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org, linux@arm.linux.org.uk,
	linux-kernel@vger.kernel.org, stefan@agner.ch
Subject: [RFC 2/2] mmc: use SD/MMC host ID for block device name ID
Date: Tue,  1 Apr 2014 22:35:52 +0200	[thread overview]
Message-ID: <2f6ac51155f9d34791b274b5102d15a997ff8b99.1396384101.git.stefan@agner.ch> (raw)
In-Reply-To: <cover.1396384101.git.stefan@agner.ch>

From: Stefan Agner <stefan@agner.ch>

By using the SD/MMC host device ID as a starting point for block
device numbering, one can reliably predict the first block device
name (at least for the first controller). This is especially useful
for SoCs with multiple SD/MMC host controller, where the controller
with index 0 is connected to a eMMC device.

Usually the first controller gets the first block device name ID,
however this is not guaranteed. Also if the first controller is
aliased as second controller and visa-versa (using device tree
aliases), the block device name ID assignation is not ordered by
the SD/MMC host device ID (since mmc_rescan is called in order of
the memory mapped pheripherial addresses).

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/mmc/card/block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 7b5424f..03626ed 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2045,7 +2045,8 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 	 * index anymore so we keep track of a name index.
 	 */
 	if (!subname) {
-		md->name_idx = find_first_zero_bit(name_use, max_devices);
+		md->name_idx = find_next_zero_bit(name_use, max_devices,
+				card->host->index);
 		__set_bit(md->name_idx, name_use);
 	} else
 		md->name_idx = ((struct mmc_blk_data *)
-- 
1.9.1

  parent reply	other threads:[~2014-04-01 20:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01 20:35 [RFC 0/2] fixed order for mmc devices/mmc block devices stefan-XLVq0VzYD2Y
     [not found] ` <cover.1396384101.git.stefan-XLVq0VzYD2Y@public.gmane.org>
2014-04-01 20:35   ` [RFC 1/2] mmc: read mmc alias from device tree stefan-XLVq0VzYD2Y
     [not found]     ` <5570bdf5ebb3aaae5a376634ecfbac9c2fd7b9f4.1396384101.git.stefan-XLVq0VzYD2Y@public.gmane.org>
2014-08-06 19:43       ` Doug Anderson
2015-03-13 20:08       ` Doug Anderson
2014-04-01 20:35 ` stefan [this message]
2014-04-01 20:47   ` [RFC 2/2] mmc: use SD/MMC host ID for block device name ID Stephen Warren
     [not found]     ` <533B25E8.8040201-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-04-01 21:46       ` Stefan Agner
     [not found]   ` <2f6ac51155f9d34791b274b5102d15a997ff8b99.1396384101.git.stefan-XLVq0VzYD2Y@public.gmane.org>
2014-08-06 19:50     ` Doug Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f6ac51155f9d34791b274b5102d15a997ff8b99.1396384101.git.stefan@agner.ch \
    --to=stefan@agner.ch \
    --cc=chris@printf.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).