From patchwork Fri May 31 06:15:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 17311 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7783D25D81 for ; Fri, 31 May 2013 06:15:42 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id ox1sf1454714veb.10 for ; Thu, 30 May 2013 23:15:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :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=pxlQg+xRiKdffiK/yLm7MU7088fn1+HK3Vqr4W3tsao=; b=P5vyA6TSzK2okFur9PoXi3EetDCwXD1fDDIY72wpao1TtXn+E6VMS8doQdMi2TGGUu pVLz8H7dqaKHhxzoJx8Xt+fx0J01g067QNRwWZGiZ6134HHElGpbhWnOLLG0Y1uj+3sS TduDC7PnEBdBxm9gD4Wb5RPAvZVHk4lvlsqOAIlB4Wzfgu/+qJYQUoyqQKbrgq1MIAOj E8aGzsxVG5tbjmQ4OqH7AmlepiRUTn8jHiTWV/O8kv3zF/5/Uc2EkgqZWMf3kf/khBHm QFEWdukcNFV+Pw9CxT5MxTdEVfPKDSIOQI7bv64AmRIRJUy8L7b+XKD+qoHuGm2Ng/Rk 4P8w== X-Received: by 10.224.165.143 with SMTP id i15mr6050277qay.0.1369980941637; Thu, 30 May 2013 23:15:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.3.105 with SMTP id b9ls776251qeb.34.gmail; Thu, 30 May 2013 23:15:41 -0700 (PDT) X-Received: by 10.52.160.102 with SMTP id xj6mr7474639vdb.45.1369980941403; Thu, 30 May 2013 23:15:41 -0700 (PDT) Received: from mail-ve0-x233.google.com (mail-ve0-x233.google.com [2607:f8b0:400c:c01::233]) by mx.google.com with ESMTPS id sy4si27374099vdc.95.2013.05.30.23.15.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 May 2013 23:15:41 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::233 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::233; Received: by mail-ve0-f179.google.com with SMTP id d10so862799vea.10 for ; Thu, 30 May 2013 23:15:41 -0700 (PDT) X-Received: by 10.52.34.114 with SMTP id y18mr7436366vdi.56.1369980940938; Thu, 30 May 2013 23:15:40 -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.229.199 with SMTP id jj7csp37323vcb; Thu, 30 May 2013 23:15:40 -0700 (PDT) X-Received: by 10.68.178.66 with SMTP id cw2mr11380576pbc.47.1369980939940; Thu, 30 May 2013 23:15:39 -0700 (PDT) Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by mx.google.com with ESMTPS id qb9si16169090pbb.154.2013.05.30.23.15.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 May 2013 23:15:39 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.182 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.182; Received: by mail-pd0-f182.google.com with SMTP id g10so1656935pdj.13 for ; Thu, 30 May 2013 23:15:39 -0700 (PDT) X-Received: by 10.68.197.195 with SMTP id iw3mr11302165pbc.177.1369980939218; Thu, 30 May 2013 23:15:39 -0700 (PDT) Received: from localhost ([223.238.249.240]) by mx.google.com with ESMTPSA id kr16sm48241790pab.23.2013.05.30.23.15.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 23:15:38 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, robin.randhawa@arm.com, Steve.Bannister@arm.com, Liviu.Dudau@arm.com, charles.garcia-tobin@arm.com, arvind.chauhan@arm.com, Viresh Kumar Subject: [PATCH] cpufreq: remove unnecessary cpufreq_cpu_{get|put}() calls Date: Fri, 31 May 2013 11:45:08 +0530 Message-Id: <40258fb25d164a4923251d20b6d6604f190a5a32.1369980833.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e X-Gm-Message-State: ALoCoQlisJIIpTAFiEtwOaLft1uXelYxzQ+YS+2Q/jjrKV0CdG9NnPWeoUDvl625yPxVLfVTT+F0 X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::233 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: , struct cpufreq_policy is already passed as argument to some routines like: __cpufreq_driver_getavg() and so we don't really need to do cpufreq_cpu_get() before and cpufreq_cpu_put() in them to get policy structure. Remove them. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index ce9273a7..f8c2860 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1572,10 +1572,6 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, { int ret = -EINVAL; - policy = cpufreq_cpu_get(policy->cpu); - if (!policy) - goto no_policy; - if (unlikely(lock_policy_rwsem_write(policy->cpu))) goto fail; @@ -1584,30 +1580,19 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, unlock_policy_rwsem_write(policy->cpu); fail: - cpufreq_cpu_put(policy); -no_policy: return ret; } EXPORT_SYMBOL_GPL(cpufreq_driver_target); int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) { - int ret = 0; - if (cpufreq_disabled()) - return ret; + return 0; if (!cpufreq_driver->getavg) return 0; - policy = cpufreq_cpu_get(policy->cpu); - if (!policy) - return -EINVAL; - - ret = cpufreq_driver->getavg(policy, cpu); - - cpufreq_cpu_put(policy); - return ret; + return cpufreq_driver->getavg(policy, cpu); } EXPORT_SYMBOL_GPL(__cpufreq_driver_getavg);