From patchwork Fri Mar 13 15:43:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 45795 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7B2C0214BF for ; Fri, 13 Mar 2015 15:44:30 +0000 (UTC) Received: by wivr20 with SMTP id r20sf4312336wiv.0 for ; Fri, 13 Mar 2015 08:44:29 -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:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=pkEhFHe4m+JxGZLefdHym5Vvrg8aAXD6yZT1ZYa8hIg=; b=fqMKuWYFMRp/X9URg3gBNbkJjub4f3qTxg1w40jYWoD794HgJwL8pV9tJwxBhj0b4c 1bbW6xSrM1MBL4eYjpwQA3BwGASyN4Kh/b9jykseBzUdsGzhjEK/EH5LUBbQnvKWtFuy 5HxURxG1jGBF0K94c9hd5mNioe9K1vw87ISyEdsXimH5sZWslTNDsBht5HuxTMnNjXFR /kz9GX8iWjhMZORVRECnGN85cXxskH5K4RFwE9AEvKfMSrUBTs9S/7UJLqnpplpqJfJL qi8Qj2RdlKFdELz39enk8Y3Pk8DFeWms7jgKoQVBtlIf/K/FXFEsQqBLiKzZlc+YvGjG 0Tsg== X-Gm-Message-State: ALoCoQkAglTmdILf3PtpgP3O1xlb8UVqWr1eLljV7Urg7wGffnTLer2GjSx7FVWCiaqsxN3JHfj4 X-Received: by 10.112.125.67 with SMTP id mo3mr5665813lbb.6.1426261469825; Fri, 13 Mar 2015 08:44:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.199 with SMTP id x7ls445010lae.0.gmail; Fri, 13 Mar 2015 08:44:29 -0700 (PDT) X-Received: by 10.152.6.71 with SMTP id y7mr31733821lay.116.1426261469555; Fri, 13 Mar 2015 08:44:29 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id v3si1649240lav.12.2015.03.13.08.44.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 08:44:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbvp9 with SMTP id p9so23648061lbv.10 for ; Fri, 13 Mar 2015 08:44:29 -0700 (PDT) X-Received: by 10.152.43.51 with SMTP id t19mr43267104lal.73.1426261469460; Fri, 13 Mar 2015 08:44:29 -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.35.133 with SMTP id h5csp1000150lbj; Fri, 13 Mar 2015 08:44:29 -0700 (PDT) X-Received: by 10.152.22.229 with SMTP id h5mr44038157laf.21.1426261460904; Fri, 13 Mar 2015 08:44:20 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id gz6si1632370lac.135.2015.03.13.08.44.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 08:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by labhs14 with SMTP id hs14so22913928lab.5 for ; Fri, 13 Mar 2015 08:44:20 -0700 (PDT) X-Received: by 10.112.92.66 with SMTP id ck2mr43572840lbb.105.1426261460768; Fri, 13 Mar 2015 08:44:20 -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 i9sm471248lbs.26.2015.03.13.08.44.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Mar 2015 08:44:20 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Kevin Hilman , linux-pm@vger.kernel.org Cc: Geert Uytterhoeven , Dmitry Torokhov , Russell King , Greg Kroah-Hartman , Mark Brown , Wolfram Sang , linux-arm-kernel@lists.infradead.org, Ulf Hansson , Aaron Lu Subject: [PATCH 7/9] mmc: core: Attach PM domain prior probing of SDIO func driver Date: Fri, 13 Mar 2015 16:43:47 +0100 Message-Id: <1426261429-31883-8-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426261429-31883-1-git-send-email-ulf.hansson@linaro.org> References: <1426261429-31883-1-git-send-email-ulf.hansson@linaro.org> 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.217.177 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: , Align the behvaior to how other buses are handling attachment of PM domains. Additionally, let's add error handling. Cc: Aaron Lu Signed-off-by: Ulf Hansson --- For reference, this change has been discussed before. http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/294278.html --- drivers/mmc/core/sdio_bus.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index bee02e6..71357b8 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c @@ -315,13 +315,19 @@ int sdio_add_func(struct sdio_func *func) sdio_set_of_node(func); sdio_acpi_set_handle(func); + + ret = dev_pm_domain_attach(&func->dev, false); + if (ret) + return ret; + ret = device_add(&func->dev); - if (ret == 0) { - sdio_func_set_present(func); - dev_pm_domain_attach(&func->dev, false); + if (ret) { + dev_pm_domain_detach(&func->dev, false); + return ret; } - return ret; + sdio_func_set_present(func); + return 0; } /*