From patchwork Fri Jan 13 11:03:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 9515219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF34160762 for ; Fri, 13 Jan 2017 11:03:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C531E284B9 for ; Fri, 13 Jan 2017 11:03:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9F4328601; Fri, 13 Jan 2017 11:03:53 +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=-6.9 required=2.0 tests=BAYES_00,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 2BEAA285A1 for ; Fri, 13 Jan 2017 11:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751820AbdAMLDr (ORCPT ); Fri, 13 Jan 2017 06:03:47 -0500 Received: from mga09.intel.com ([134.134.136.24]:57654 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbdAMLDl (ORCPT ); Fri, 13 Jan 2017 06:03:41 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 13 Jan 2017 03:03:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,221,1477983600"; d="scan'208,223";a="808415371" Received: from dzhan35-mobl3.ccr.corp.intel.com ([10.254.212.179]) by FMSMGA003.fm.intel.com with ESMTP; 13 Jan 2017 03:03:37 -0800 Message-ID: <1484305415.2221.45.camel@intel.com> Subject: [PATCH v3] mmc: sdhci-acpi: support deferred probe From: Zhang Rui To: linux-mmc Cc: cja@gmx.net, darcari@redhat.com, ulf.hansson@linaro.org, adrain Date: Fri, 13 Jan 2017 19:03:35 +0800 X-Mailer: Evolution 3.18.5.2-0ubuntu3 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 From c889f737322b797b743c63eda241d0283696d3f5 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Wed, 7 Dec 2016 13:13:31 +0800 Subject: [PATCH v3] mmc: sdhci-acpi: support deferred probe With commit 67bf5156edc4 ("gpio / ACPI: fix returned error from acpi_dev_gpio_irq_get()"), mmc_gpiod_request_cd() returns -EPROBE_DEFER if GPIO is not ready when sdhci-acpi driver is probed, and sdhci-acpi driver should be probed again later in this case. This fixes an order issue when both GPIO and sdhci-acpi drivers are built as modules. CC: stable@vger.kernel.org # v4.9 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177101 Tested-by: Jonas Aaberg Signed-off-by: Zhang Rui Acked-by: Adrian Hunter ---  drivers/mmc/host/sdhci-acpi.c | 5 ++++-  1 file changed, 4 insertions(+), 1 deletion(-) --  2.7.4 -- 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/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index 160f695cc09c..5440323894ee 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -466,7 +466,10 @@ static int sdhci_acpi_probe(struct platform_device *pdev)   if (sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD)) {   bool v = sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL);   - if (mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0, NULL)) { + err = mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0, NULL); + if (err) { + if (err == -EPROBE_DEFER) + goto err_free;   dev_warn(dev, "failed to setup card detect gpio\n");   c->use_runtime_pm = false;   }