From patchwork Mon Oct 13 14:02:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5076621 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B7DCDC11AC for ; Mon, 13 Oct 2014 14:03:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD532201F5 for ; Mon, 13 Oct 2014 14:03:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64A2E20212 for ; Mon, 13 Oct 2014 14:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754140AbaJMOCr (ORCPT ); Mon, 13 Oct 2014 10:02:47 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:39684 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754142AbaJMOCp (ORCPT ); Mon, 13 Oct 2014 10:02:45 -0400 Received: by mail-wi0-f170.google.com with SMTP id hi2so9309422wib.5 for ; Mon, 13 Oct 2014 07:02:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XqHeqzoHuEtempV96gev7GEtbvdqUVn0vQgoTJoSXA4=; b=H9GjEwAcs/gnrl+8/1M0AjJEU3TVgezsG8FwF0e/pgLVHIN6uCL674gP51vhIC/tsH M5nyGuPHlRWacUZQQ1K3mcni1y/ZYdUKaoe38p4tJHi0S/sngbRDzYt/4pNirKedomML SJGILzzdVKgB/suinWWFmixUNNdfKINvr9IpAs6qnS1fmyOOikgySfdg9JeD+RpJEYYi cJmEue0w9YtJ8224GhwRGIFn161zXHt3nD+npnFOPcSRsWjRfoug6BJge9znuPJrSZv0 lf7RnSQhUEA/NCcorZI894z6BPQmv5+AWqPEnlMp4rlx3Yk6/YdXn7Nh9RGwHUrVZMQL fz8Q== X-Gm-Message-State: ALoCoQkVP5alg1/kL63KmhsC8UcMhFKU/GZg3p4h7KYKRCsp5krjaLKI3YZC9El0vq7zt41EaMlQ X-Received: by 10.180.73.103 with SMTP id k7mr917789wiv.83.1413208964701; Mon, 13 Oct 2014 07:02:44 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id fq1sm1533474wib.12.2014.10.13.07.02.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Oct 2014 07:02:44 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Geert Uytterhoeven , Kevin Hilman , Alan Stern , Greg Kroah-Hartman , Tomasz Figa , Simon Horman , Magnus Damm , Ben Dooks , Kukjin Kim , Philipp Zabel , Mark Brown , Wolfram Sang , Russell King , Dmitry Torokhov , Jack Dai , Jinkun Hong , Aaron Lu , Sylwester Nawrocki , Ulf Hansson Subject: [PATCH v3 7/9] mmc: core: Attach PM domain prior probing of SDIO func driver Date: Mon, 13 Oct 2014 16:02:08 +0200 Message-Id: <1413208930-26019-8-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413208930-26019-1-git-send-email-ulf.hansson@linaro.org> References: <1413208930-26019-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Align the behvaior to how other buses are handling attachment of PM domains. Additionally, let's add error handling. Signed-off-by: Ulf Hansson --- 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 65cf7a7..ba97779 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c @@ -313,13 +313,19 @@ int sdio_add_func(struct sdio_func *func) dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num); 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; } /*