From patchwork Wed Sep 2 09:06:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 52957 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 8F87A22E23 for ; Wed, 2 Sep 2015 09:07:16 +0000 (UTC) Received: by lanb10 with SMTP id b10sf1513259lan.3 for ; Wed, 02 Sep 2015 02:07:15 -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:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=mByeM8BbzgMRYNe2npoUZL469IjeqEO5DMmMlzYXMhc=; b=dHVdCeUsPHQNkBISa+ivdxi2CAnHgmIzKbEoa+iwYILgePkeIqMMNL2iT0a5EKPQ+S RaJ+L/aGKdOn/cuJekfU9RuudtbPHWM7mAN/9jY2MHWIqM5tqUkR65s7joXNmG796Vhr ht+eREr5jfowBTczwIkT04iCNzmJq20Nv2+D4p6DNnYCd2EqLr++pob+DHne05Wcpw3o CT5cPXBD1MnsFRdWHXsSLyBWDPSFcIjoRhtp+Lq2MOUUa4FyPTzQbLSqUy2ewz4eSehX 2rJ9VtD6hS2sPREEArWyTpM0mAWPZPDHpxpFJaHjjJFc5g0xGH7nxtVxuOr7wJ+5ijIT 1GwA== X-Gm-Message-State: ALoCoQnQpC77JoFzlon8Hcy+nfRL132Wv+ImqZqFG5oTu0pJOQPRPb3+31qcH8MOOxf7XhKqWoNO X-Received: by 10.152.45.101 with SMTP id l5mr8827205lam.7.1441184835526; Wed, 02 Sep 2015 02:07:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.8.133 with SMTP id dk5ls44602lad.75.gmail; Wed, 02 Sep 2015 02:07:15 -0700 (PDT) X-Received: by 10.112.150.100 with SMTP id uh4mr6502007lbb.60.1441184835345; Wed, 02 Sep 2015 02:07:15 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id x3si19057932lae.20.2015.09.02.02.07.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 02:07:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbcao8 with SMTP id ao8so2205416lbc.3 for ; Wed, 02 Sep 2015 02:07:15 -0700 (PDT) X-Received: by 10.112.16.135 with SMTP id g7mr15115217lbd.19.1441184835218; Wed, 02 Sep 2015 02:07:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.164.42 with SMTP id yn10csp402162lbb; Wed, 2 Sep 2015 02:07:14 -0700 (PDT) X-Received: by 10.68.184.225 with SMTP id ex1mr52643708pbc.75.1441184833777; Wed, 02 Sep 2015 02:07:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id po9si19336290pac.168.2015.09.02.02.07.12; Wed, 02 Sep 2015 02:07:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753410AbbIBJHI (ORCPT + 28 others); Wed, 2 Sep 2015 05:07:08 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:35899 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753136AbbIBJHF (ORCPT ); Wed, 2 Sep 2015 05:07:05 -0400 Received: by pacwi10 with SMTP id wi10so5053789pac.3 for ; Wed, 02 Sep 2015 02:07:04 -0700 (PDT) X-Received: by 10.66.193.132 with SMTP id ho4mr54972603pac.154.1441184824812; Wed, 02 Sep 2015 02:07:04 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id qh2sm1389340pbc.7.2015.09.02.02.07.03 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 02 Sep 2015 02:07:04 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/3] cpufreq: dt: Check OPP count before marking them shared Date: Wed, 2 Sep 2015 14:36:48 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@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.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We need to explicitly mark OPPs as shared, when they are not defined with OPP-v2 bindings. But this isn't required to be done if we failed to initialize OPP table. Reorder code to verify OPP count before marking them shared. Fixes: 2e02d8723edf ("cpufreq: dt: Add support for operating-points-v2 bindings") Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-dt.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index c3583cdfadbd..8c38b5192baa 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -239,6 +239,17 @@ static int cpufreq_init(struct cpufreq_policy *policy) */ of_cpumask_init_opp_table(policy->cpus); + /* + * But we need OPP table to function so if it is not there let's + * give platform code chance to provide it for us. + */ + ret = dev_pm_opp_get_opp_count(cpu_dev); + if (ret <= 0) { + pr_debug("OPP table is not ready, deferring probe\n"); + ret = -EPROBE_DEFER; + goto out_free_opp; + } + if (need_update) { struct cpufreq_dt_platform_data *pd = cpufreq_get_driver_data(); @@ -256,17 +267,6 @@ static int cpufreq_init(struct cpufreq_policy *policy) transition_latency = dev_pm_opp_get_max_clock_latency(cpu_dev); } - /* - * But we need OPP table to function so if it is not there let's - * give platform code chance to provide it for us. - */ - ret = dev_pm_opp_get_opp_count(cpu_dev); - if (ret <= 0) { - pr_debug("OPP table is not ready, deferring probe\n"); - ret = -EPROBE_DEFER; - goto out_free_opp; - } - priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) { ret = -ENOMEM;