From patchwork Fri Sep 13 13:02:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20252 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2A7DA20358 for ; Fri, 13 Sep 2013 13:26:38 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id 6sf1237064qea.3 for ; Fri, 13 Sep 2013 06:26:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=jzfkFqCQyTfMuI7i10S36OHtbhjjEsLgxMzwr2eCRnY=; b=KN6DkdaQEtQrM+oszhcW7eg1VqOHYeVT/ScvtJQZYQHDMOFRpdF0qa3Jn/49BYybqT 3nThYOsXCJi/RAyqe/Pkb46AN9kkQGYz91qsD0MdzOA4ccALfkZkP2yT53+JOzpRhXx4 lpOQb90hkLctoTpysjk9YJLzrStLWztNX0ztGZHMQF22LE4qvlqN9xS1S+62pE+U3O7T dD8vmU6kzeql3jE/vGiFv6/IBYXAKIJAwkfC+BA3h4nn6EYqM7FX+/sK4PzhYU2NXtNV tfRqo2LapBhYMVs/qshhir9927A/uMY+xNUdRFYEf7iQoF6Q1wDZ+GAW8AwuF67vreWp 15aA== X-Gm-Message-State: ALoCoQkNZpiHtW3HntZQyG2X8T+0/O5qQ4WwlgY3z5vMvrMCtigbzGf3lkgKl4m93tfd0wp7UidR X-Received: by 10.236.4.69 with SMTP id 45mr4951883yhi.20.1379078797908; Fri, 13 Sep 2013 06:26:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.49 with SMTP id f17ls1169036qey.33.gmail; Fri, 13 Sep 2013 06:26:37 -0700 (PDT) X-Received: by 10.52.164.102 with SMTP id yp6mr10423770vdb.14.1379078797700; Fri, 13 Sep 2013 06:26:37 -0700 (PDT) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by mx.google.com with ESMTPS id rp4si3115808vcb.111.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:26:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.48 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.48; Received: by mail-vb0-f48.google.com with SMTP id w16so900760vbf.35 for ; Fri, 13 Sep 2013 06:26:37 -0700 (PDT) X-Received: by 10.52.64.143 with SMTP id o15mr10113172vds.16.1379078797595; Fri, 13 Sep 2013 06:26:37 -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.174.196 with SMTP id u4csp80668vcz; Fri, 13 Sep 2013 06:26:37 -0700 (PDT) X-Received: by 10.68.234.102 with SMTP id ud6mr13591299pbc.50.1379078796621; Fri, 13 Sep 2013 06:26:36 -0700 (PDT) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id pz2si10868898pac.144.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:26:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.47; Received: by mail-pa0-f47.google.com with SMTP id kl13so2515807pab.6 for ; Fri, 13 Sep 2013 06:26:36 -0700 (PDT) X-Received: by 10.66.142.42 with SMTP id rt10mr15160823pab.1.1379078796212; Fri, 13 Sep 2013 06:26:36 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id gg10sm11740491pbc.46.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:26:35 -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, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Santosh Shilimkar Subject: [PATCH 198/228] cpufreq: omap: remove calls to cpufreq_notify_transition() Date: Fri, 13 Sep 2013 18:32:24 +0530 Message-Id: <460ac80ae0afb99ba681bedcbd3863c0ddae0ea8.1379063063.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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.48 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: , 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: Santosh Shilimkar Signed-off-by: Viresh Kumar --- drivers/cpufreq/omap-cpufreq.c | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index 0653887..e92d72e 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c @@ -53,15 +53,15 @@ static unsigned int omap_getspeed(unsigned int cpu) static int omap_target(struct cpufreq_policy *policy, unsigned int index) { - int r, ret = 0; - struct cpufreq_freqs freqs; + int r, ret; struct opp *opp; unsigned long freq, volt = 0, volt_old = 0, tol = 0; + unsigned int old_freq, new_freq; - freqs.old = omap_getspeed(policy->cpu); - freqs.new = freq_table[index].frequency; + old_freq = omap_getspeed(policy->cpu); + new_freq = freq_table[index].frequency; - freq = freqs.new * 1000; + freq = new_freq * 1000; ret = clk_round_rate(mpu_clk, freq); if (IS_ERR_VALUE(ret)) { dev_warn(mpu_dev, @@ -77,7 +77,7 @@ static int omap_target(struct cpufreq_policy *policy, unsigned int index) if (IS_ERR(opp)) { rcu_read_unlock(); dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n", - __func__, freqs.new); + __func__, new_freq); return -EINVAL; } volt = opp_get_voltage(opp); @@ -87,43 +87,32 @@ static int omap_target(struct cpufreq_policy *policy, unsigned int index) } dev_dbg(mpu_dev, "cpufreq-omap: %u MHz, %ld mV --> %u MHz, %ld mV\n", - freqs.old / 1000, volt_old ? volt_old / 1000 : -1, - freqs.new / 1000, volt ? volt / 1000 : -1); - - /* notifiers */ - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); + old_freq / 1000, volt_old ? volt_old / 1000 : -1, + new_freq / 1000, volt ? volt / 1000 : -1); /* scaling up? scale voltage before frequency */ - if (mpu_reg && (freqs.new > freqs.old)) { + if (mpu_reg && (new_freq > old_freq)) { r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol); if (r < 0) { dev_warn(mpu_dev, "%s: unable to scale voltage up.\n", __func__); - freqs.new = freqs.old; - goto done; + return r; } } - ret = clk_set_rate(mpu_clk, freqs.new * 1000); + ret = clk_set_rate(mpu_clk, new_freq * 1000); /* scaling down? scale voltage after frequency */ - if (mpu_reg && (freqs.new < freqs.old)) { + if (mpu_reg && (new_freq < old_freq)) { r = regulator_set_voltage(mpu_reg, volt - tol, volt + tol); if (r < 0) { dev_warn(mpu_dev, "%s: unable to scale voltage down.\n", __func__); - ret = clk_set_rate(mpu_clk, freqs.old * 1000); - freqs.new = freqs.old; - goto done; + clk_set_rate(mpu_clk, old_freq * 1000); + return r; } } - freqs.new = omap_getspeed(policy->cpu); - -done: - /* notifiers */ - cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); - return ret; }