From mboxrd@z Thu Jan 1 00:00:00 1970 From: Douglas Anderson Subject: [PATCH v2 3/4] mmc: use SD/MMC host ID for block device name ID Date: Fri, 29 Apr 2016 10:32:18 -0700 Message-ID: <1461951139-6109-4-git-send-email-dianders@chromium.org> References: <1461951139-6109-1-git-send-email-dianders@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fTjCxwVxLu9D19+59ReupVG53JbzqZl0vSgp3WEvjfY=; b=R+gOZ5T8t8IeNReTLZGxcEw+ILBGsUmyY52RKSh963RB3KuU1Q+reiqQL827k2I4+1 USGOCVgdFCYotbAIJ7aS5+iJjKF0mQPRS996jZgGBMHF6N3iSWCF0vlLLVcU9NANdB5S Bc9Y8UcskK+1/OduimrAgHbP4nAz5irjvRmN0= In-Reply-To: <1461951139-6109-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+glpar-linux-rockchip=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, jh80.chung-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org Cc: jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org, Heiko Stuebner , devicetree-spec-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org, dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, adrian.hunter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, stefan-XLVq0VzYD2Y@public.gmane.org, Douglas Anderson , lporzio-AL4WhLSQfzjQT0dZR+AlfA@public.gmane.org, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org, jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org, computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org From: Stefan Agner 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 Signed-off-by: Douglas Anderson --- Changes in v2: - Rebased atop mmc-next drivers/mmc/card/block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 9ce679255775..360700f3e0ea 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -2197,7 +2197,7 @@ again: return ERR_PTR(-ENOMEM); spin_lock(&mmc_blk_lock); - ret = ida_get_new(&mmc_blk_ida, &devidx); + ret = ida_get_new_above(&mmc_blk_ida, card->host->index, &devidx); spin_unlock(&mmc_blk_lock); if (ret == -EAGAIN) -- 2.8.0.rc3.226.g39d4020