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: 19181 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 533842486D for ; Fri, 16 Aug 2013 02:26:52 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id hf12sf1790014vcb.3 for ; Thu, 15 Aug 2013 19:26:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state: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=L2INzWKEzLe8MhG5MfFwome8pt+4QcuXJSZg2xekCy4=; b=Y9S5Tx/KUk7uq1T6kKDYfpuBQ8mw2t6cyniv/Hh4bnyo5YxyExOb82f08esv50SaAM slnETPR4bOmF85bmtEFAvwAfJCji/FkxOiSLNE4adJZMmGS20fZg+aJNoXGC38auxIF5 xZxUnV/vx+5ZNgeTaNsn7TazLrZf5nLibK3ZmakmGlepYdizjXyYDEXlM/NGOMdkMtpj 9npQhN72lfq6pA9IKnlbv40WWoISCGk/s+PnDox2guj2nxwdDp7UJfRbldWE6eqmSH08 BtX647B3hI2sssLRFAPCkr309uWm/m6IuXPJenQ3t8LtuLVX3OhcgAG4B0rZA5K1yM+4 EH3A== X-Received: by 10.236.187.38 with SMTP id x26mr337640yhm.51.1376620012017; Thu, 15 Aug 2013 19:26:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.72 with SMTP id da8ls563114qeb.49.gmail; Thu, 15 Aug 2013 19:26:51 -0700 (PDT) X-Received: by 10.52.34.74 with SMTP id x10mr14488756vdi.13.1376620011883; Thu, 15 Aug 2013 19:26:51 -0700 (PDT) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id ae9si693628vdc.80.2013.08.15.19.26.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Aug 2013 19:26:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.51 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.51; Received: by mail-vb0-f51.google.com with SMTP id x16so1213794vbf.24 for ; Thu, 15 Aug 2013 19:26:51 -0700 (PDT) X-Gm-Message-State: ALoCoQmP+1EzLuXzDwsykgeyOOGUP3WrKeLxL0FBpZ+a95wFPV6j4bYkgc5c3NQJuXXosfgvwsEV X-Received: by 10.221.36.4 with SMTP id sy4mr17541043vcb.11.1376620011799; Thu, 15 Aug 2013 19:26:51 -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 u4csp45160vcz; Thu, 15 Aug 2013 19:26:51 -0700 (PDT) X-Received: by 10.68.232.225 with SMTP id tr1mr11713756pbc.143.1376620010985; Thu, 15 Aug 2013 19:26:50 -0700 (PDT) Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by mx.google.com with ESMTPS id zr1si1644978pbc.300.2013.08.15.19.26.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Aug 2013 19:26:50 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.171 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.171; Received: by mail-pd0-f171.google.com with SMTP id g10so1592932pdj.2 for ; Thu, 15 Aug 2013 19:26:50 -0700 (PDT) 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 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 , Sekhar Nori 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-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.51 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: 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)