From patchwork Tue Oct 28 14:38:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 39672 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 29B1B24046 for ; Tue, 28 Oct 2014 14:38:33 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id m15sf538292wgh.0 for ; Tue, 28 Oct 2014 07:38:32 -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=VaBIEXNsAwIjHslu9qaquHugf3d0Yv5rZ4k/Y8tvQIU=; b=C2xWABJwwwza6f0b0WQPGFdWSucVrQuZlnWPDNtA70axJKh5gib86UhAi+4ClA4MdS wE+AMzgHPjJ8sk+olAKBsz0ufLd3XOK4hEhVIcTFvVkm+cboXoUkSv2C9cJMBxCSsQq0 rTOnyFjDawkVJXdqahHQDDIXNsQgkkgnu0tsnj5dvnbLRjuiU+6+FAPTbe9plPvoq9Zg e2PhBAyq5A2b06b3nOCynsWqwvGdsFSl2GNuwHsff6LHiHWd1t8l8INdXlhEn9mgjgwE rhytqa2H7dgZXdF7bQRy/yze2CbD83LZVB9vTu32yd29ntL3oaoD0MNf8lOeBULdH3LV cjsg== X-Gm-Message-State: ALoCoQn9vaP5k1PneH2PxrLbj17+qQjsEfZNXxa5WuZDhbFOQzqZ5dJqJmfCJm59fMVdVfse2obZ X-Received: by 10.181.29.105 with SMTP id jv9mr823209wid.1.1414507112022; Tue, 28 Oct 2014 07:38:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.101 with SMTP id w5ls52228laz.16.gmail; Tue, 28 Oct 2014 07:38:31 -0700 (PDT) X-Received: by 10.152.88.70 with SMTP id be6mr4545099lab.72.1414507111867; Tue, 28 Oct 2014 07:38:31 -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 js17si2889723lab.24.2014.10.28.07.38.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 07:38:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id pv20so747781lab.34 for ; Tue, 28 Oct 2014 07:38:31 -0700 (PDT) X-Received: by 10.152.5.38 with SMTP id p6mr4493992lap.44.1414507111789; Tue, 28 Oct 2014 07:38:31 -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.84.229 with SMTP id c5csp492351lbz; Tue, 28 Oct 2014 07:38:31 -0700 (PDT) X-Received: by 10.112.140.135 with SMTP id rg7mr4602083lbb.24.1414507110946; Tue, 28 Oct 2014 07:38:30 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id m8si2799889lam.108.2014.10.28.07.38.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 07:38:30 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id 10so740175lbg.1 for ; Tue, 28 Oct 2014 07:38:30 -0700 (PDT) X-Received: by 10.112.16.195 with SMTP id i3mr4501257lbd.72.1414507110845; Tue, 28 Oct 2014 07:38:30 -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 qg4sm680886lbb.36.2014.10.28.07.38.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Oct 2014 07:38:30 -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 4/4] PM / Domains: Let the ->attach_dev() callback return an error code Date: Tue, 28 Oct 2014 15:38:10 +0100 Message-Id: <1414507090-516-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414507090-516-1-git-send-email-ulf.hansson@linaro.org> References: <1414507090-516-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.215.47 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: , Typically an ->attach_dev() callback would fetch some PM resourses. Those operations, like for example clk_get() may fail with different errors, including -EPROBE_DEFER. Instead of ignoring these errors and potentially only print an error message, let's propagate them to give callers the option to handle them. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 11 +++++++++-- include/linux/pm_domain.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 4e5fcd7..da40769 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1394,12 +1394,19 @@ static int genpd_alloc_dev_data(struct generic_pm_domain *genpd, if (ret) goto err_data; - if (genpd->attach_dev) - genpd->attach_dev(dev); + if (genpd->attach_dev) { + ret = genpd->attach_dev(dev); + if (ret) + goto err_attach; + } dev_pm_qos_add_notifier(dev, &gpd_data->nb); return 0; + err_attach: + spin_lock_irq(&dev->power.lock); + dev->power.subsys_data->domain_data = NULL; + spin_unlock_irq(&dev->power.lock); err_data: kfree(gpd_data); err_alloc: diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index e4edde1..70a3bc3 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -72,7 +72,7 @@ struct generic_pm_domain { bool max_off_time_changed; bool cached_power_down_ok; struct gpd_cpuidle_data *cpuidle_data; - void (*attach_dev)(struct device *dev); + int (*attach_dev)(struct device *dev); void (*detach_dev)(struct device *dev); };