From patchwork Tue Aug 13 13:32:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19062 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CB4B0246B8 for ; Tue, 13 Aug 2013 13:34:01 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id z20sf9473114yhz.11 for ; Tue, 13 Aug 2013 06:34:01 -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=WeNsww8b7xO/IqMfj6i1etq/0/WWLSNkx/cVJEvcxRk=; b=fsQwqjptsjlCp4saLxe1/SxvDCNzuUzEMADabxBqdZSKlNyr1qiJ/WjSWSCCy+RrHH 86PyMPgfegB39eH0ebr1ULZQXpovvI+U+QVwQTWDbJEiMZoR8p9A05yJ94uU39enSJTj O/hncJI7ofhtimfnr7etrdOU6x+YZustgL7kUc3Vdh4rxMlHLVzTASVYIAwzaOUT/PdO GJv+7zizmjsf/maA+JQc5JHhu2J3iwwfv00vYM9/w8tulLsto2U6qdb8mtnfPl1BtaOM ZISY5bmZ482cXAszSTp4dQM/6z8OwPcGjGzjmjwjIwRGDlPOM73MS/yQ4hmIiHZaYWua lGNg== X-Received: by 10.236.93.113 with SMTP id k77mr1636256yhf.25.1376400841252; Tue, 13 Aug 2013 06:34:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.26.70 with SMTP id j6ls2726226qeg.94.gmail; Tue, 13 Aug 2013 06:34:01 -0700 (PDT) X-Received: by 10.221.6.195 with SMTP id ol3mr780852vcb.34.1376400841138; Tue, 13 Aug 2013 06:34:01 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id r9si9752290vcc.1.2013.08.13.06.34.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:34:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id c13so6637890vea.24 for ; Tue, 13 Aug 2013 06:34:01 -0700 (PDT) X-Gm-Message-State: ALoCoQk3+jtFhjk/lSHJagTH3qtGQiCKC2jffs8vcyl0zrDVxljAw1L+bj0xRVNxZgFd0qugAsp7 X-Received: by 10.58.201.227 with SMTP id kd3mr4520021vec.14.1376400841033; Tue, 13 Aug 2013 06:34:01 -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 u4csp154145vcz; Tue, 13 Aug 2013 06:34:00 -0700 (PDT) X-Received: by 10.66.152.102 with SMTP id ux6mr4556245pab.79.1376400840091; Tue, 13 Aug 2013 06:34:00 -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 bk3si25140031pbd.58.2013.08.13.06.33.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:34:00 -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 g10so4901583pdj.16 for ; Tue, 13 Aug 2013 06:33:59 -0700 (PDT) X-Received: by 10.68.171.35 with SMTP id ar3mr4607795pbc.61.1376400839696; Tue, 13 Aug 2013 06:33:59 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id eq5sm44001747pbc.15.2013.08.13.06.33.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:33:58 -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 , Shawn Guo Subject: [PATCH V2 07/35] cpufreq: cpu0: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:20 +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.128.179 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: , This patch converts existing .target() to newly defined light weight .target_index() routine for this driver. CPUFreq core will call cpufreq_frequency_table_target() before calling this routine and will pass index to it. Cc: Shawn Guo Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-cpu0.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 3d24e7b..fb07a40 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -34,24 +34,14 @@ static unsigned int cpu0_get_speed(unsigned int cpu) return clk_get_rate(cpu_clk) / 1000; } -static int cpu0_set_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) +static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index) { struct cpufreq_freqs freqs; struct opp *opp; unsigned long volt = 0, volt_old = 0, tol = 0; long freq_Hz, freq_exact; - unsigned int index; int ret; - ret = cpufreq_frequency_table_target(policy, freq_table, target_freq, - relation, &index); - if (ret) { - pr_err("failed to match target freqency %d: %d\n", - target_freq, ret); - return ret; - } - freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000); if (freq_Hz < 0) freq_Hz = freq_table[index].frequency * 1000; @@ -59,9 +49,6 @@ static int cpu0_set_target(struct cpufreq_policy *policy, freqs.new = freq_Hz / 1000; freqs.old = clk_get_rate(cpu_clk) / 1000; - if (freqs.old == freqs.new) - return 0; - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); if (cpu_reg) { @@ -145,7 +132,7 @@ static int cpu0_cpufreq_init(struct cpufreq_policy *policy) static struct cpufreq_driver cpu0_cpufreq_driver = { .flags = CPUFREQ_STICKY, .verify = cpufreq_generic_frequency_table_verify, - .target = cpu0_set_target, + .target_index = cpu0_set_target, .get = cpu0_get_speed, .init = cpu0_cpufreq_init, .exit = cpufreq_generic_exit,