From patchwork Thu May 16 09:28:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 16982 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 174972391B for ; Thu, 16 May 2013 09:31:19 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id i13sf3599275qae.3 for ; Thu, 16 May 2013 02:30:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=J0Ly99nvbdiU7OEPhuvekgpd3p/JAy9hldpAdbAF0Wc=; b=Fr8YqiJSIt17OmHKllfY1mPstyN8pD47cx5B4Ji1s1RhbjryDIHDR29PGdMbEAM/2M 3rHCkVBeMFeLtYQG1ISDZv3w+a+pNy3jhd7TjySoL9m+Y3wTyhDbc0EnRVEJEBxecYNM 10izwt/yiGl9kLFBV0eOdmsbtgjtkWn3X7Owfn/uZ9ks+I/9Umvm8Se0Yn5wWdbjDoTb DGovwi4FKJfl8v1ZmlLG+Rel6MS9fVoeL0Qw6OVcx3KZtfk7ZcxEMFCU86yslV4EqteP MMkKOPQqmND3UAD0RTPSCfe46C6tORF64omP7S0NY1v59WGwfGOTXmA1lcGkzH3Af14u WBKA== X-Received: by 10.236.170.36 with SMTP id o24mr22831586yhl.2.1368696640308; Thu, 16 May 2013 02:30:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.8 with SMTP id e8ls1096954qey.6.gmail; Thu, 16 May 2013 02:30:40 -0700 (PDT) X-Received: by 10.220.192.3 with SMTP id do3mr27381524vcb.16.1368696640101; Thu, 16 May 2013 02:30:40 -0700 (PDT) Received: from mail-ve0-x231.google.com (mail-ve0-x231.google.com [2607:f8b0:400c:c01::231]) by mx.google.com with ESMTPS id tq4si3518833vdc.1.2013.05.16.02.30.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 02:30:40 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::231 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::231; Received: by mail-ve0-f177.google.com with SMTP id ox1so2833840veb.36 for ; Thu, 16 May 2013 02:30:40 -0700 (PDT) X-Received: by 10.220.46.197 with SMTP id k5mr27705765vcf.40.1368696639913; Thu, 16 May 2013 02:30:39 -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.220.126.138 with SMTP id c10csp55987vcs; Thu, 16 May 2013 02:30:39 -0700 (PDT) X-Received: by 10.66.251.101 with SMTP id zj5mr42651109pac.122.1368696638540; Thu, 16 May 2013 02:30:38 -0700 (PDT) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by mx.google.com with ESMTPS id hb2si4438187pac.31.2013.05.16.02.30.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 02:30:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.174 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.174; Received: by mail-pd0-f174.google.com with SMTP id u10so2175067pdi.19 for ; Thu, 16 May 2013 02:30:38 -0700 (PDT) X-Received: by 10.68.224.1 with SMTP id qy1mr43368178pbc.85.1368696638101; Thu, 16 May 2013 02:30:38 -0700 (PDT) Received: from localhost ([106.197.193.133]) by mx.google.com with ESMTPSA id gi2sm6157973pbb.2.2013.05.16.02.30.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 May 2013 02:30:37 -0700 (PDT) From: Viresh Kumar To: toddpoynor@google.com Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, robin.randhawa@arm.com, Steve.Bannister@arm.com, Liviu.Dudau@arm.com, charles.garcia-tobin@arm.com, arvind.chauhan@arm.com, android-kernel@googlegroups.com, viresh.kumar@linaro.org Subject: [PATCH 05/16] cpufreq: Don't call __cpufreq_governor() for drivers without target() Date: Thu, 16 May 2013 14:58:43 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQl24mdStYPyPeXUrt8imSPlEBK6zztCaIKI2RBIvAK8mLEoZtFMc/wzVix/rje9Y+nA5Mds X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::231 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , Some cpufreq drivers implement their own governor and so don't need us to call generic governors interface via __cpufreq_governor(). Few recent commits haven't obeyed this law well and we saw some regressions. This patch is an attempt to fix the above issue. Signed-off-by: Viresh Kumar Reported-and-tested-by: Sedat Dilek Tested-by: Dirk Brandewie Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 0072b46..95a6b14 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -808,13 +808,14 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling, struct device *dev) { struct cpufreq_policy *policy; - int ret = 0; + int ret = 0, has_target = !!cpufreq_driver->target; unsigned long flags; policy = cpufreq_cpu_get(sibling); WARN_ON(!policy); - __cpufreq_governor(policy, CPUFREQ_GOV_STOP); + if (has_target) + __cpufreq_governor(policy, CPUFREQ_GOV_STOP); lock_policy_rwsem_write(sibling); @@ -827,8 +828,10 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling, unlock_policy_rwsem_write(sibling); - __cpufreq_governor(policy, CPUFREQ_GOV_START); - __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); + if (has_target) { + __cpufreq_governor(policy, CPUFREQ_GOV_START); + __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); + } ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq"); if (ret) { @@ -1077,7 +1080,8 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif /* If cpu is last user of policy, free policy */ if (cpus == 1) { - __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); + if (cpufreq_driver->target) + __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); lock_policy_rwsem_read(cpu); kobj = &data->kobj;