From patchwork Mon Jun 1 10:18:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 49286 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1D04721580 for ; Mon, 1 Jun 2015 10:18:49 +0000 (UTC) Received: by wgv5 with SMTP id 5sf27846407wgv.0 for ; Mon, 01 Jun 2015 03:18:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Uptc4QEYb1Jx7cRZ4FSbFrcTxyMvtkxVeZ0ds+BChoU=; b=eX+g1EgSlc0dQYjBK7iLjXrZ8SdBFge8bdsNrNst0d2EHh+N12b8/91LKUVzyFmnyk 90ew3XSBmtO0ZhPDDN49T2bEu4DKpGjMSaE6ELGbQ1kX9sUpHtUMtnbc2/dpDBzrOS6t 49QIZy8skNYPsmVELhcDM5wUV54Bkn2fNwmD0pPMkN/Vx3nd44reP8FlgkNEX/wLIFvL lhUlVwCJjtGLhuy+P/mHEilpaYVCDe6gsSqyuhYP7Y5NmGrW9budb5e+BNhRF9RicLlb sdlWKnGhmvp1FdhvCD9b+8uxIG/qoiIACAUCHhLtRTfjpWh83P+rSGaUwttCGcA96RXl laEA== X-Gm-Message-State: ALoCoQmNU27NXatodb2Ckk5mvNbigl5UMZn9sab3pVREpjxNZt+YbxlEsph0I3F77sbaLDJ1gLRh X-Received: by 10.180.11.101 with SMTP id p5mr10989887wib.3.1433153928223; Mon, 01 Jun 2015 03:18:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.10 with SMTP id z10ls624598lae.24.gmail; Mon, 01 Jun 2015 03:18:48 -0700 (PDT) X-Received: by 10.112.145.132 with SMTP id su4mr19791954lbb.85.1433153928064; Mon, 01 Jun 2015 03:18:48 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id k18si11956333lbh.10.2015.06.01.03.18.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 03:18:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labpy14 with SMTP id py14so85867175lab.0 for ; Mon, 01 Jun 2015 03:18:47 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr4285622lbb.56.1433153927424; Mon, 01 Jun 2015 03:18:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2203985lbb; Mon, 1 Jun 2015 03:18:47 -0700 (PDT) X-Received: by 10.112.202.36 with SMTP id kf4mr20697498lbc.0.1433153927017; Mon, 01 Jun 2015 03:18:47 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id rh10si11929379lbb.105.2015.06.01.03.18.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 03:18:47 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laei3 with SMTP id i3so9906650lae.3 for ; Mon, 01 Jun 2015 03:18:46 -0700 (PDT) X-Received: by 10.152.5.225 with SMTP id v1mr20056852lav.111.1433153926875; Mon, 01 Jun 2015 03:18:46 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id t15sm4129115lbk.0.2015.06.01.03.18.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jun 2015 03:18:45 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Russell King , Dmitry Torokhov , Kevin Hilman , "Rafael J. Wysocki" , Aaron Lu Subject: [PATCH] mmc: core: Attach PM domain prior probing of SDIO func driver Date: Mon, 1 Jun 2015 12:18:25 +0200 Message-Id: <1433153905-25204-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Other subsystem buses attach PM domains during probe, but prior calling the driver's ->probe() method. During the removal phase, detaching the PM domain will be done after invoking the driver's ->remove() callback. Convert the SDIO bus to follow this behavior and add error handling. Signed-off-by: Ulf Hansson --- A similar patch as $subject patch has been posted and discussed earlier. According to Aaron Lu, who added the initial support for the ACPI PM domain to the SDIO bus, this change is safe. http://www.spinics.net/lists/linux-mmc/msg28946.html --- drivers/mmc/core/sdio_bus.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index bee02e6..7e327a6 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c @@ -137,6 +137,10 @@ static int sdio_bus_probe(struct device *dev) if (!id) return -ENODEV; + ret = dev_pm_domain_attach(dev, false); + if (ret == -EPROBE_DEFER) + return ret; + /* Unbound SDIO functions are always suspended. * During probe, the function is set active and the usage count * is incremented. If the driver supports runtime PM, @@ -166,6 +170,7 @@ static int sdio_bus_probe(struct device *dev) disable_runtimepm: if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) pm_runtime_put_noidle(dev); + dev_pm_domain_detach(dev, false); return ret; } @@ -197,6 +202,8 @@ static int sdio_bus_remove(struct device *dev) if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) pm_runtime_put_sync(dev); + dev_pm_domain_detach(dev, false); + return ret; } @@ -316,10 +323,8 @@ int sdio_add_func(struct sdio_func *func) sdio_set_of_node(func); sdio_acpi_set_handle(func); ret = device_add(&func->dev); - if (ret == 0) { + if (ret == 0) sdio_func_set_present(func); - dev_pm_domain_attach(&func->dev, false); - } return ret; } @@ -335,7 +340,6 @@ void sdio_remove_func(struct sdio_func *func) if (!sdio_func_present(func)) return; - dev_pm_domain_detach(&func->dev, false); device_del(&func->dev); of_node_put(func->dev.of_node); put_device(&func->dev);