From patchwork Thu Jun 20 15:24:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 11007147 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 272801398 for ; Thu, 20 Jun 2019 15:24:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 180022886F for ; Thu, 20 Jun 2019 15:24:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C4BD288E4; Thu, 20 Jun 2019 15:24:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E60E288D0 for ; Thu, 20 Jun 2019 15:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726582AbfFTPYk (ORCPT ); Thu, 20 Jun 2019 11:24:40 -0400 Received: from shell.v3.sk ([90.176.6.54]:51762 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726562AbfFTPYk (ORCPT ); Thu, 20 Jun 2019 11:24:40 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 30901CC540; Thu, 20 Jun 2019 17:24:38 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id iA_7RQlh7XYt; Thu, 20 Jun 2019 17:24:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 7D255CC54A; Thu, 20 Jun 2019 17:24:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wSrM4WSP_D_g; Thu, 20 Jun 2019 17:24:34 +0200 (CEST) Received: from belphegor.brq.redhat.com (nat-pool-brq-t.redhat.com [213.175.37.10]) by zimbra.v3.sk (Postfix) with ESMTPSA id C124FCC540; Thu, 20 Jun 2019 17:24:34 +0200 (CEST) From: Lubomir Rintel To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Lubomir Rintel Subject: [PATCH RESEND] mmc: core: try to use an id from the devicetree Date: Thu, 20 Jun 2019 17:24:32 +0200 Message-Id: <20190620152432.1408278-1-lkundrak@v3.sk> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If there's a mmc* alias in the device tree, take the device number from it, so that we end up with a device name that matches the alias. Signed-off-by: Lubomir Rintel --- drivers/mmc/core/host.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 6a51f7a06ce7..4733ddb894da 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -411,7 +411,12 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) /* scanning will be enabled when we're ready */ host->rescan_disable = 1; - err = ida_simple_get(&mmc_host_ida, 0, 0, GFP_KERNEL); + /* prefer an alias */ + err = of_alias_get_id(dev->of_node, "mmc"); + if (err < 0) + err = 0; + + err = ida_simple_get(&mmc_host_ida, err, 0, GFP_KERNEL); if (err < 0) { kfree(host); return NULL;