From patchwork Fri Aug 16 02:25:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2845435 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 C2EBD9F271 for ; Fri, 16 Aug 2013 02:46:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC0EF2026F for ; Fri, 16 Aug 2013 02:46:47 +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 D837B20264 for ; Fri, 16 Aug 2013 02:46:46 +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 1VA9nx-000549-HQ; Fri, 16 Aug 2013 02:30:22 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA9nX-0006xp-G7; Fri, 16 Aug 2013 02:29:55 +0000 Received: from mail-pd0-f181.google.com ([209.85.192.181]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA9lq-0006fU-LV for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2013 02:28:11 +0000 Received: by mail-pd0-f181.google.com with SMTP id g10so1581836pdj.26 for ; Thu, 15 Aug 2013 19:27:49 -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=Moh7l5gRRZjxNK+auHaagpy8zYIHUPba33raSNKOkU8=; b=itxuKgo9UX2jFgU8xVHL/xpSjHrczekzHxVRbHvMfHeYYyiE1GoMUbAjfSt5EY2X1V 3CocHXfsRxvHLVzSNmgtSomWJtwT4mnQBMoKgui1Xz56PZWC3B8prXkVbuOTIX0/UH2a 7zdXahVR0/SAMYL5TLmPiODf508UrbTYX4VQ0WTMNG4hZ8qytjewLQSsZwE3ZTe1Gl4Z /DVcnssEV5tdHNff/ZEDvr2fisBurQPtq/L3ctd8guPUpfkTR0nmlaf7CKUnvcuGNV9y MukqfaaVNphtGUXw7TQ6YGMBn0iijeWQnPrdiRSM41ScHHop/0vJiqV7prdLgykY+8iz DhRA== X-Gm-Message-State: ALoCoQk0R6NVmzk+J5jnCt4Vb5K+kOsTXIg/JtgK6dKfcIt28DjsZVH+nSg56RAe+A6wW9TpY6zk X-Received: by 10.68.254.73 with SMTP id ag9mr18566081pbd.54.1376620069731; Thu, 15 Aug 2013 19:27:49 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id e7sm2826780pbc.11.2013.08.15.19.27.45 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 15 Aug 2013 19:27:49 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH 16/34] cpufreq: kirkwood: remove calls to cpufreq_notify_transition() Date: Fri, 16 Aug 2013 07:55:13 +0530 Message-Id: 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_222810_823407_08B740D2 X-CRM114-Status: GOOD ( 13.82 ) X-Spam-Score: -1.9 (-) Cc: Andrew Lunn , 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 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: Andrew Lunn Signed-off-by: Viresh Kumar --- drivers/cpufreq/kirkwood-cpufreq.c | 54 ++++++++++++++------------------------ 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c index c3d6987..fcf461e 100644 --- a/drivers/cpufreq/kirkwood-cpufreq.c +++ b/drivers/cpufreq/kirkwood-cpufreq.c @@ -58,48 +58,34 @@ static unsigned int kirkwood_cpufreq_get_cpu_frequency(unsigned int cpu) static int kirkwood_cpufreq_target(struct cpufreq_policy *policy, unsigned int index) { - struct cpufreq_freqs freqs; unsigned int state = kirkwood_freq_table[index].driver_data; unsigned long reg; - freqs.old = kirkwood_cpufreq_get_cpu_frequency(0); - freqs.new = kirkwood_freq_table[index].frequency; + local_irq_disable(); - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); + /* Disable interrupts to the CPU */ + reg = readl_relaxed(priv.base); + reg |= CPU_SW_INT_BLK; + writel_relaxed(reg, priv.base); - dev_dbg(priv.dev, "Attempting to set frequency to %i KHz\n", - kirkwood_freq_table[index].frequency); - dev_dbg(priv.dev, "old frequency was %i KHz\n", - kirkwood_cpufreq_get_cpu_frequency(0)); - - if (freqs.old != freqs.new) { - local_irq_disable(); - - /* Disable interrupts to the CPU */ - reg = readl_relaxed(priv.base); - reg |= CPU_SW_INT_BLK; - writel_relaxed(reg, priv.base); - - switch (state) { - case STATE_CPU_FREQ: - clk_disable(priv.powersave_clk); - break; - case STATE_DDR_FREQ: - clk_enable(priv.powersave_clk); - break; - } + switch (state) { + case STATE_CPU_FREQ: + clk_disable(priv.powersave_clk); + break; + case STATE_DDR_FREQ: + clk_enable(priv.powersave_clk); + break; + } - /* Wait-for-Interrupt, while the hardware changes frequency */ - cpu_do_idle(); + /* Wait-for-Interrupt, while the hardware changes frequency */ + cpu_do_idle(); - /* Enable interrupts to the CPU */ - reg = readl_relaxed(priv.base); - reg &= ~CPU_SW_INT_BLK; - writel_relaxed(reg, priv.base); + /* Enable interrupts to the CPU */ + reg = readl_relaxed(priv.base); + reg &= ~CPU_SW_INT_BLK; + writel_relaxed(reg, priv.base); - local_irq_enable(); - } - cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); + local_irq_enable(); return 0; }