From patchwork Fri Aug 16 02:25:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2845375 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2B34A9F239 for ; Fri, 16 Aug 2013 02:28:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 489D6202F8 for ; Fri, 16 Aug 2013 02:28:23 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 394A5202EC for ; Fri, 16 Aug 2013 02:28:22 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA9lG-0002zB-Ak; Fri, 16 Aug 2013 02:27:35 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA9ku-0006ZG-Td; Fri, 16 Aug 2013 02:27:12 +0000 Received: from mail-pb0-f46.google.com ([209.85.160.46]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA9kQ-0006Qg-3L for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2013 02:26:46 +0000 Received: by mail-pb0-f46.google.com with SMTP id rq2so1458940pbb.5 for ; Thu, 15 Aug 2013 19:26:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=jDAJIaDW984yAzLnbx0HMxBRaMDwtr1QWqx0t1T7cbo=; b=YdJFbv2sPqLaqMMiUFEhuQc5HYwA6OG1W91Iu50HXG9QxE9QHDVA9OogiHEo1CAnTM D0kbHyEXtM0qo8beD4JGCQS2jX9nJ1mongXhff+I1wnwg8Ypm3D+H8i0CyUw2YdJskTb o3lRjI5T4Z0VjFWGV54o7JDoWGrPxdcB/uFiaSxql/7RN7cEeVCTYTEbU3sl6deAxCEU Imqr8WXMbNySpVV8NR9eWtwch6ILIplaKjm6tdxg3R+ahvg0csvKbu2dnRFSkaOCiGwP Ig/pylSufRcXBHJDUgTn5iWO+YxiYw4kaUW3JXIdfNgSDJqhZ9ekGfrOuN1uCYGEqZVI zTfQ== X-Gm-Message-State: ALoCoQnteUs1hgdTeT76EMAn0V+FgSy5ZE+vpFEECogiIEEcpkDTuvekL+/SY00gEujas+I3R4Hu X-Received: by 10.68.200.9 with SMTP id jo9mr18289121pbc.120.1376619980569; Thu, 15 Aug 2013 19:26:20 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id ys4sm3047625pbb.9.2013.08.15.19.26.16 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 15 Aug 2013 19:26:19 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH 04/34] cpufreq: at32ap: remove calls to cpufreq_notify_transition() Date: Fri, 16 Aug 2013 07:55:01 +0530 Message-Id: <1507bf552f7f9f61197c599236be870e739b337c.1376619363.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130815_222642_271446_F2A4589C X-CRM114-Status: GOOD ( 10.44 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , patches@linaro.org, linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Hans-Christian Egtvedt X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Most of the drivers do following in their ->target_index() routines: struct cpufreq_freqs freqs; freqs.old = old freq... freqs.new = new freq... cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); /* Change rate here */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); This is replicated over all cpufreq drivers today and there doesn't exists a good enough reason why this shouldn't be moved to cpufreq core instead. Earlier patches have added support in cpufreq core to do cpufreq notification on frequency change, this one removes it from this driver. Some related minor cleanups are also done along with it. Cc: Hans-Christian Egtvedt Signed-off-by: Viresh Kumar Acked-by: Hans-Christian Egtvedt --- drivers/cpufreq/at32ap-cpufreq.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/at32ap-cpufreq.c b/drivers/cpufreq/at32ap-cpufreq.c index 81d0752..856ad80 100644 --- a/drivers/cpufreq/at32ap-cpufreq.c +++ b/drivers/cpufreq/at32ap-cpufreq.c @@ -37,27 +37,23 @@ static unsigned long loops_per_jiffy_ref; static int at32_set_target(struct cpufreq_policy *policy, unsigned int index) { - struct cpufreq_freqs freqs; + unsigned int old_freq, new_freq; - freqs.old = at32_get_speed(0); - freqs.new = freq_table[index].frequency; + old_freq = at32_get_speed(0); + new_freq = freq_table[index].frequency; if (!ref_freq) { - ref_freq = freqs.old; + ref_freq = old_freq; loops_per_jiffy_ref = boot_cpu_data.loops_per_jiffy; } - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); - if (freqs.old < freqs.new) + if (old_freq < new_freq) boot_cpu_data.loops_per_jiffy = cpufreq_scale( - loops_per_jiffy_ref, ref_freq, freqs.new); - clk_set_rate(cpuclk, freqs.new * 1000); - if (freqs.new < freqs.old) + loops_per_jiffy_ref, ref_freq, new_freq); + clk_set_rate(cpuclk, new_freq * 1000); + if (new_freq < old_freq) boot_cpu_data.loops_per_jiffy = cpufreq_scale( - loops_per_jiffy_ref, ref_freq, freqs.new); - cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); - - pr_debug("cpufreq: set frequency %u Hz\n", freqs.new * 1000); + loops_per_jiffy_ref, ref_freq, new_freq); return 0; }