From patchwork Fri Aug 16 02:25:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2845452 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 12EBD9F2F5 for ; Fri, 16 Aug 2013 03:37:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10DFF2022D for ; Fri, 16 Aug 2013 03:37:01 +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 0CA5E20205 for ; Fri, 16 Aug 2013 03:37:00 +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 1VA9mP-0003gu-IF; Fri, 16 Aug 2013 02:28:47 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA9lh-0006h2-Hm; Fri, 16 Aug 2013 02:28:01 +0000 Received: from mail-pd0-f169.google.com ([209.85.192.169]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VA9kr-0006VL-3O for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2013 02:27:14 +0000 Received: by mail-pd0-f169.google.com with SMTP id r10so1599313pdi.14 for ; Thu, 15 Aug 2013 19:26:50 -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=L2INzWKEzLe8MhG5MfFwome8pt+4QcuXJSZg2xekCy4=; b=a6msmqVNj60vpVKvlH86wXwvNin/KCsvHnf653ctdWrkYv4vr5y8Sz1pvUuzAhHzl9 EHmD29lE7CN2M3hh4QP94HCSYNVB+cI8iYeo9sLvA/XYAJpMmP7TkFSlq4FiHV6JsY69 fgV3P4YPsIKc3/wI8/EmaKhB0HwRwf6Sn+v//3cLT7ZuCWebKlU4f2szHcf7EIHDFZ+z xYFAFl1+1R1Qi2pyepBSq8OqFBGjqSBcYQKbro0fKRJCD2qWwjebSv8hK+cteFYSjWk2 z50d4TWNr6hUaeLeuvWwx6t/GTs2DkyW6DEmmoMkchJTBLouA+iaOxj4SoZOSN+Eckai 6rSQ== X-Gm-Message-State: ALoCoQkWQA+s06r6GSm6P0MtVp45y2ppDkQUVUmNKJlD2xN1IWILEdZ+xRgQKoCC7Eb9e8C+QkrX X-Received: by 10.66.123.5 with SMTP id lw5mr610021pab.83.1376620010391; Thu, 15 Aug 2013 19:26:50 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id ot4sm92496pac.17.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 15 Aug 2013 19:26:49 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH 08/34] cpufreq: davinci: remove calls to cpufreq_notify_transition() Date: Fri, 16 Aug 2013 07:55:05 +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_222709_267342_ED39F6D0 X-CRM114-Status: GOOD ( 12.80 ) X-Spam-Score: -1.9 (-) Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , patches@linaro.org, Sekhar Nori , 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: Sekhar Nori Signed-off-by: Viresh Kumar --- drivers/cpufreq/davinci-cpufreq.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c index 07ea6c0..7fcae0c 100644 --- a/drivers/cpufreq/davinci-cpufreq.c +++ b/drivers/cpufreq/davinci-cpufreq.c @@ -70,46 +70,36 @@ static unsigned int davinci_getspeed(unsigned int cpu) static int davinci_target(struct cpufreq_policy *policy, unsigned int idx) { - int ret = 0; - struct cpufreq_freqs freqs; struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; struct clk *armclk = cpufreq.armclk; + unsigned int old_freq, new_freq; + int ret = 0; - freqs.old = davinci_getspeed(0); - freqs.new = pdata->freq_table[idx].frequency; - - dev_dbg(cpufreq.dev, "transition: %u --> %u\n", freqs.old, freqs.new); - - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); + old_freq = davinci_getspeed(0); + new_freq = pdata->freq_table[idx].frequency; /* if moving to higher frequency, up the voltage beforehand */ - if (pdata->set_voltage && freqs.new > freqs.old) { + if (pdata->set_voltage && new_freq > old_freq) { ret = pdata->set_voltage(idx); if (ret) - goto out; + return ret; } ret = clk_set_rate(armclk, idx); if (ret) - goto out; + return ret; if (cpufreq.asyncclk) { ret = clk_set_rate(cpufreq.asyncclk, cpufreq.asyncrate); if (ret) - goto out; + return ret; } /* if moving to lower freq, lower the voltage after lowering freq */ - if (pdata->set_voltage && freqs.new < freqs.old) + if (pdata->set_voltage && new_freq < old_freq) pdata->set_voltage(idx); -out: - if (ret) - freqs.new = freqs.old; - - cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); - - return ret; + return 0; } static int davinci_cpu_init(struct cpufreq_policy *policy)