From patchwork Fri Oct 19 20:12:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1619601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 970BBDF2AB for ; Fri, 19 Oct 2012 20:14:45 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TPIvh-0005qH-UU; Fri, 19 Oct 2012 20:12:26 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TPIve-0005py-0h for linux-arm-kernel@lists.infradead.org; Fri, 19 Oct 2012 20:12:22 +0000 Received: by mail-pa0-f49.google.com with SMTP id bi5so606604pad.36 for ; Fri, 19 Oct 2012 13:12:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=DvMcKTGKeSc36OQ2FnF/adonhSXqBd27smZzWYwLnco=; b=bkCHZ/7WJoeKdgL74AQr0mdecvKUc1Tg2ClwlkpHsqcDxV5VSYU0BQEuf7NtXgBO+j BLd9Q5arQmp20rWaa5wm9GhuggqKavYR5IB7mzPzOrSapkHWiCC7n4bVM7W/kpgPeyak vW/U7n75+dDts2Tpqfw7rE/uyQCnEFVmwJzejllndttcGVRVBCIPxRjlqIXSV851DrHM 98bAxQ/8WDwbzMtEJjlM3zol+XB1vDLBrpipdrk+JjDZGEuI64iILlIphsoaieA+xedp mWd3KAXrYD+ghYKCfPJ9VC/ScYE9yTjluaS/Vg27bZi9wbVxcQLI8yKEFaZ3Um6Xfhlo W8mQ== Received: by 10.66.81.199 with SMTP id c7mr6998168pay.19.1350677539765; Fri, 19 Oct 2012 13:12:19 -0700 (PDT) Received: from localhost ([122.167.126.73]) by mx.google.com with ESMTPS id ih2sm1682222pbc.65.2012.10.19.13.12.15 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Oct 2012 13:12:19 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH 1/2] cpufreq: return early from __cpufreq_driver_getavg() Date: Sat, 20 Oct 2012 01:42:05 +0530 Message-Id: <32e5bed743cc6cc4e614291a7080299f5f0d0933.1350677395.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e X-Gm-Message-State: ALoCoQnNRefRdiugbhj+88sGwa+dD9XJSUVYm7T1+mknprhUiYOs/nstjUtiIlb+B4dCtMzOLVKb X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linaro-dev@lists.linaro.org, patches@linaro.org, Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, pdsw-power-team@arm.com, arvind.chauhan@arm.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for drivers that don't support getavg() routine. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 85df538..f552d5f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1511,12 +1511,14 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) { int ret = 0; + if (!(cpu_online(cpu) && cpufreq_driver->getavg)) + return 0; + policy = cpufreq_cpu_get(policy->cpu); if (!policy) return -EINVAL; - if (cpu_online(cpu) && cpufreq_driver->getavg) - ret = cpufreq_driver->getavg(policy, cpu); + ret = cpufreq_driver->getavg(policy, cpu); cpufreq_cpu_put(policy); return ret;