From patchwork Thu Apr 23 08:45:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 6260881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 437969F313 for ; Thu, 23 Apr 2015 08:49:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 75B7A20380 for ; Thu, 23 Apr 2015 08:49:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97C2820172 for ; Thu, 23 Apr 2015 08:49:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlCmf-0004Rx-DR; Thu, 23 Apr 2015 08:46:57 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlCm2-00043X-25 for linux-arm-kernel@lists.infradead.org; Thu, 23 Apr 2015 08:46:19 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id E48EE1403BE; Thu, 23 Apr 2015 08:45:58 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id D3B021406FB; Thu, 23 Apr 2015 08:45:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from blr-ubuntu-34.ap.qualcomm.com (unknown [202.46.23.61]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: rnayak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8BDC51403BE; Thu, 23 Apr 2015 08:45:56 +0000 (UTC) From: Rajendra Nayak To: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [RFC/RFT 1/6] PM / clock_ops: Make pm_clk_notify() do nothing in case DT passes power-domains Date: Thu, 23 Apr 2015 14:15:39 +0530 Message-Id: <1429778744-13352-2-git-send-email-rnayak@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org> References: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150423_014618_160922_F334F49E X-CRM114-Status: GOOD ( 15.74 ) X-Spam-Score: -0.0 (/) Cc: Rajendra Nayak X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP pm_clk_notify() intends to do nothing if the device is associated with a pm_domain other than whats stored in pm_clk_notifier_block. In case of DT though, just checking for an existing dev->pm_domain is not very useful as dev->pm_domain actually gets populated much later. Add a check for a 'power-domains' DT property to identify if the device would be assocaiated with a different power domain at a later point in time. Signed-off-by: Rajendra Nayak --- drivers/base/power/clock_ops.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 8abea66..6618818 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c @@ -16,6 +16,7 @@ #include #include #include +#include #ifdef CONFIG_PM @@ -323,6 +324,7 @@ int pm_clk_resume(struct device *dev) * of PM clocks, depending on @action. * * If the device's pm_domain field is already populated with a value different + * or is expected to be populated with a different value later (in case of DT) * from the one stored in the struct pm_clk_notifier_block object, the function * does nothing. */ @@ -332,7 +334,7 @@ static int pm_clk_notify(struct notifier_block *nb, struct pm_clk_notifier_block *clknb; struct device *dev = data; char **con_id; - int error; + int error, sz; dev_dbg(dev, "%s() %ld\n", __func__, action); @@ -343,6 +345,10 @@ static int pm_clk_notify(struct notifier_block *nb, if (dev->pm_domain) break; + /* With DT dev->pm_domain hookup happens later */ + if (of_find_property(dev->of_node, "power-domains", &sz)) + break; + error = pm_clk_create(dev); if (error) break;