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: 5177691 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 B7A02C11AC for ; Tue, 28 Oct 2014 14:38:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31A8020254 for ; Tue, 28 Oct 2014 14:38:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 59A0F200D6 for ; Tue, 28 Oct 2014 14:38:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754512AbaJ1Oid (ORCPT ); Tue, 28 Oct 2014 10:38:33 -0400 Received: from mail-la0-f51.google.com ([209.85.215.51]:52874 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754244AbaJ1Oic (ORCPT ); Tue, 28 Oct 2014 10:38:32 -0400 Received: by mail-la0-f51.google.com with SMTP id q1so733431lam.38 for ; Tue, 28 Oct 2014 07:38:30 -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=VaBIEXNsAwIjHslu9qaquHugf3d0Yv5rZ4k/Y8tvQIU=; b=fm/kHBGkl0RSKNzkZzs3+sYfwBlREcRvxbLeiSQ/u44VDYOj7XFouHCDkp+QvwRwjC 1NN1bVkGdTsdc5hEs9HBXDQk7Uq4SSEHTzfjFFhVvYRrBJC0rJiXf4rDqCUmKqfKXNMq VCOx8hduGp3KpT8eKKOmC5Dc6ZxXhYsy+D83VoyTU6guWlxSEq12GgzIvO0LmivdAwwo n+/k09KtssW2EVshAfdLP4ct5kTBFk3HWlTKTgl6JpeD48EKRpwYnnCv7DmfVVCTi/qw G/zh40Ul++6eqSiL+QXVsWaSWmFQRCAoXiPtBBh6p8DhhlB/6NucitsHhiK/8vN6QFDe IKKg== X-Gm-Message-State: ALoCoQl8CvVQUganTTOsLnKdm/xYeuVhwGvAhKh7EIirqdNK9QkBOKMv6sYLS+GI8B1Am1LeMXbI 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> 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=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 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); };