From patchwork Wed Jul 2 04:03:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 4463261 Return-Path: X-Original-To: patchwork-linux-arm-msm@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 80C8FBEEAA for ; Wed, 2 Jul 2014 04:03:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7DB2E202FF for ; Wed, 2 Jul 2014 04:03:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64184202F0 for ; Wed, 2 Jul 2014 04:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750871AbaGBEDk (ORCPT ); Wed, 2 Jul 2014 00:03:40 -0400 Received: from mail-qg0-f47.google.com ([209.85.192.47]:55651 "EHLO mail-qg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757AbaGBEDj (ORCPT ); Wed, 2 Jul 2014 00:03:39 -0400 Received: by mail-qg0-f47.google.com with SMTP id q108so4167811qgd.20 for ; Tue, 01 Jul 2014 21:03:38 -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=wXczB0NfYm2mNTgn6Ll3CcAcGZdIPItg/pVnJRCkl5M=; b=WiAXcZJuqsDa3hjvr6B1Px9Afe+CId0p8u5AdszXyQlVBmsQQSjLlzg1QCQ4I9A/T1 GPfPig/DAqn4C5vlOOh7od1pNPav4F/IxalsF3ysXXLAbfOFWzwO1nUAq0BkGgArh1ff ynYkTgv+nRHMnuPhew5PHqg98PH0q7RxjF7HrCgYVomblH3gfVtt+qAKx1fc4bgyogCx Ogu5j83cLB44CMHJgM5vIUaOk7y95QTL2R6rLpyjKvOyOopxQU9WSJzuZyr73GcRwKOW iik/LMWUW/xCGnO7R7rBw6XR/O5NZDHAJJX3sv8nefJpF6UfME35wGEPx8liPMvA0cY2 YF7Q== X-Gm-Message-State: ALoCoQlYcF/VJeH6ZY0UtTQF3OodjAuR1+yU5QO2cOydRl3qn6XpksEY0UzI3mxOb7gFK/lD5Z4j X-Received: by 10.224.129.68 with SMTP id n4mr79601346qas.66.1404273818811; Tue, 01 Jul 2014 21:03:38 -0700 (PDT) Received: from localhost (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id b10sm15524355qgf.7.2014.07.01.21.03.32 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 01 Jul 2014 21:03:38 -0700 (PDT) From: Viresh Kumar To: rjw@rjwysocki.net, shawn.guo@linaro.org Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, arvind.chauhan@arm.com, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, spk.linux@gmail.com, thomas.ab@samsung.com, nm@ti.com, t.figa@samsung.com, Viresh Kumar Subject: [PATCH V2 Resend 07/14] cpufreq: cpu0: OPPs can be populated at runtime Date: Wed, 2 Jul 2014 09:33:23 +0530 Message-Id: X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <1ba7771e910084cd0820c19ca5994fe1b3d6451d.1404231535.git.viresh.kumar@linaro.org> References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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=ham 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 OPPs can be populated statically, via DT, or added at run time with dev_pm_opp_add(). While this driver handles the first case correctly, it would fail to populate OPPs added at runtime. Because call to of_init_opp_table() would fail as there are no OPPs in DT and probe will return early. To fix this, remove error checking and call dev_pm_opp_init_cpufreq_table() unconditionally. Update bindings as well. Suggested-by: Stephen Boyd Signed-off-by: Viresh Kumar --- V2 Resend: Update bindings as well Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt | 6 ++++-- drivers/cpufreq/cpufreq-cpu0.c | 7 ++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt index f055515..366690c 100644 --- a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt @@ -8,10 +8,12 @@ Both required and optional properties listed below must be defined under node /cpus/cpu@0. Required properties: -- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt - for details +- None Optional properties: +- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt for + details. OPPs *must* be supplied either via DT, i.e. this property, or + populated at runtime. - clock-latency: Specify the possible maximum transition latency for clock, in unit of nanoseconds. - voltage-tolerance: Specify the CPU voltage tolerance in percentage. diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index b5b8e1c..f47f703 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -164,11 +164,8 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) goto out_put_reg; } - ret = of_init_opp_table(cpu_dev); - if (ret) { - pr_err("failed to init OPP table: %d\n", ret); - goto out_put_clk; - } + /* OPPs might be populated at runtime, don't check for error here */ + of_init_opp_table(cpu_dev); ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); if (ret) {