From patchwork Wed Sep 18 00:06:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 2904311 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2ECDEBFF05 for ; Wed, 18 Sep 2013 00:06:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1935E20103 for ; Wed, 18 Sep 2013 00:06:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06577200F0 for ; Wed, 18 Sep 2013 00:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754153Ab3IRAGr (ORCPT ); Tue, 17 Sep 2013 20:06:47 -0400 Received: from mail-vb0-f45.google.com ([209.85.212.45]:47168 "EHLO mail-vb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752890Ab3IRAGq (ORCPT ); Tue, 17 Sep 2013 20:06:46 -0400 Received: by mail-vb0-f45.google.com with SMTP id e15so4777344vbg.32 for ; Tue, 17 Sep 2013 17:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=gD3dINhqd6+ZOIvH/akx0R+9Yl80qOa6O3ftrUHHeMQ=; b=QDpGdmxzuEDCR+NfTPRybLOg2KUplzCAYM4y1T2GKzA1rK/NjbK+Ipq2UhOGH/07MV XenlwA+DXTrlRK4LcsAVimdz9rDMvkaw0Qom+aTSq6dMn8acOzYPl6UafIC28bwiwbCs essil3U5wgnsW2SMvtypZjYN391lp8ZQ7xz4C0YciLGOdfpzPbXQd1+skQRsMPN9fKL6 A/4LduCLZsADOqhaSVJjdrP2JmZF5dtLicLMsbea97e09hQ0d5lKtdb0DwSXhOkaQwvo W3/8yY1tyI97WkM0KxLhOCwxbnWWTTKHOlsnWnpb2Yi0XDJa46T/qhXTfDieIc03Bi5c NPiA== MIME-Version: 1.0 X-Received: by 10.58.230.135 with SMTP id sy7mr104326vec.42.1379462804718; Tue, 17 Sep 2013 17:06:44 -0700 (PDT) Received: by 10.58.112.169 with HTTP; Tue, 17 Sep 2013 17:06:44 -0700 (PDT) In-Reply-To: References: Date: Tue, 17 Sep 2013 21:06:44 -0300 Message-ID: Subject: Re: Adding aliases to mmc From: Fabio Estevam To: Dirk Behme Cc: linux-mmc@vger.kernel.org, "devicetree@vger.kernel.org" , Sascha Hauer Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Dirk, On Tue, Sep 17, 2013 at 3:04 PM, Fabio Estevam wrote: > Hi Dirk, > > I have adapted your patch at: > http://lists.infradead.org/pipermail/linux-arm-kernel/2012-July/111022.html > > and tested it on 3.12-rc1 on a mx6qsabresd board. > > Do you have plans to submit it? Maybe as a RFC? > > It solves the mmcblkX order issue on my tests and it would be nice we > could have this problem addressed. I simplied your patch a bit: What do you think? --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 1a3163f..94f842b 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -2026,7 +2026,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, struct mmc_blk_data *md; int devidx, ret; - devidx = find_first_zero_bit(dev_use, max_devices); + devidx = find_next_zero_bit(dev_use, max_devices, card->host->devidx); if (devidx >= max_devices) return ERR_PTR(-ENOSPC); __set_bit(devidx, dev_use); @@ -2044,7 +2044,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->devidx); __set_bit(md->name_idx, name_use); } else md->name_idx = ((struct mmc_blk_data *) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index abc8cf0..e11a6af 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -524,8 +524,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) struct sdhci_pltfm_host *pltfm_host; struct sdhci_host *host; struct esdhc_platform_data *boarddata; - int err; + int err, ret; struct pltfm_imx_data *imx_data; + struct device_node *np = pdev->dev.of_node; host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0); if (IS_ERR(host)) @@ -602,6 +603,13 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) host->mmc->parent->platform_data); } + + if (np) { + ret = of_alias_get_id(np, "mmcblk"); + if (ret >= 0) + host->mmc->devidx = ret; + } + /* write_protect */ if (boarddata->wp_type == ESDHC_WP_GPIO) { err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 3b0c33a..8209f72 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -362,6 +362,8 @@ struct mmc_host { unsigned int slotno; /* used for sdio acpi binding */ + /* preferred mmc block device index (mmcblkX) */ + unsigned int devidx; unsigned long private[0] ____cacheline_aligned; };