From patchwork Wed Jan 11 02:17:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhang Rui X-Patchwork-Id: 9509101 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 493FD6075F for ; Wed, 11 Jan 2017 02:17:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36E90283BA for ; Wed, 11 Jan 2017 02:17:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 296AA285BA; Wed, 11 Jan 2017 02:17:21 +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 C3319283BA for ; Wed, 11 Jan 2017 02:17:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936019AbdAKCRT (ORCPT ); Tue, 10 Jan 2017 21:17:19 -0500 Received: from mga07.intel.com ([134.134.136.100]:20734 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935831AbdAKCRT (ORCPT ); Tue, 10 Jan 2017 21:17:19 -0500 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 10 Jan 2017 18:17:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,345,1477983600"; d="scan'208,223";a="52430019" Received: from xzhong1-mobl5.gar.corp.intel.com ([10.255.29.143]) by fmsmga006.fm.intel.com with ESMTP; 10 Jan 2017 18:17:16 -0800 Message-ID: <1484101035.2253.8.camel@intel.com> Subject: [RESEND PATCH v2] mmc: sdhci-acpi: support deferred probe From: Zhang Rui To: linux-mmc@vger.kernel.org Cc: adrain , cja@gmx.net, darcari@redhat.com, ulf.hansson@linaro.org Date: Wed, 11 Jan 2017 10:17:15 +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 760aca40f3f10065f888cdf18cb20491f8b52264 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Wed, 7 Dec 2016 13:13:31 +0800 Subject: [PATCH v2] 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 160f695..5440323 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;   }