From patchwork Tue Aug 13 13:32:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19075 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 EC88A246B8 for ; Tue, 13 Aug 2013 13:35:41 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id a11sf9803245qen.3 for ; Tue, 13 Aug 2013 06:35:41 -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=dpZcYZs4ah6zTwrxFjsePNW4XBv5aXq4ra0SYJbS/gs=; b=d5lHGr0CZvkLnjcVbYjUwZzpf2bs/OXjI2Hqu2gjgtjDPrIRdYx+pJTj+iu+f8wLuQ ZX6l6Hk6GEYyUPsFjyDaCcx+LHdtc6BEEx+DdKlIFfmoL0rmmvGoBSJLQVoHvjl3uOpi bxKVaqGJRP1BA2YtnYTW+lwSbeIQO17UvIrugsJ+I8du8HcR1YL4m1XdZlcPsmJkXVhJ UZeCoHBzYvRDYlf3/jy/XS4TqJ9cVxUJdKt5ZCUUS+joS/Dv++BAM2/qpBA2a3LAvrn+ fwA7q/R2aUdv3q0N4NTfwkUYMIThNktJA0NubD9uIsUnb9C4lDaCQo4Wu+Trmja/30nI 2Lvw== X-Received: by 10.236.74.169 with SMTP id x29mr1683368yhd.34.1376400941731; Tue, 13 Aug 2013 06:35:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.110.195 with SMTP id ic3ls2747113qeb.62.gmail; Tue, 13 Aug 2013 06:35:41 -0700 (PDT) X-Received: by 10.52.240.145 with SMTP id wa17mr853218vdc.40.1376400941598; Tue, 13 Aug 2013 06:35:41 -0700 (PDT) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id st7si9743297vec.125.2013.08.13.06.35.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.47 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.47; Received: by mail-vb0-f47.google.com with SMTP id h10so6676578vbh.34 for ; Tue, 13 Aug 2013 06:35:41 -0700 (PDT) X-Gm-Message-State: ALoCoQkaShRbNEob5+S/Q1dRVQKxSytbRSM1Whnumi8JwIcrhLSHwTc6U+3k88hYLLe645MwaxKy X-Received: by 10.52.232.165 with SMTP id tp5mr3736900vdc.11.1376400941493; Tue, 13 Aug 2013 06:35:41 -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 u4csp154230vcz; Tue, 13 Aug 2013 06:35:40 -0700 (PDT) X-Received: by 10.68.130.71 with SMTP id oc7mr4664468pbb.10.1376400940627; Tue, 13 Aug 2013 06:35:40 -0700 (PDT) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by mx.google.com with ESMTPS id tp5si26228129pac.280.2013.08.13.06.35.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:40 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.174 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.174; Received: by mail-pd0-f174.google.com with SMTP id y13so4884169pdi.5 for ; Tue, 13 Aug 2013 06:35:39 -0700 (PDT) X-Received: by 10.68.14.234 with SMTP id s10mr4649882pbc.139.1376400939278; Tue, 13 Aug 2013 06:35:39 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id s6sm46868589pan.12.2013.08.13.06.35.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:38 -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 V2 20/35] cpufreq: omap: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:33 +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.47 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: Santosh Shilimkar Signed-off-by: Viresh Kumar --- drivers/cpufreq/omap-cpufreq.c | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index 48020b5..69bf7d8 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c @@ -51,40 +51,15 @@ static unsigned int omap_getspeed(unsigned int cpu) return rate; } -static int omap_target(struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) +static int omap_target(struct cpufreq_policy *policy, unsigned int index) { - unsigned int i; int r, ret = 0; struct cpufreq_freqs freqs; struct opp *opp; unsigned long freq, volt = 0, volt_old = 0, tol = 0; - if (!freq_table) { - dev_err(mpu_dev, "%s: cpu%d: no freq table!\n", __func__, - policy->cpu); - return -EINVAL; - } - - ret = cpufreq_frequency_table_target(policy, freq_table, target_freq, - relation, &i); - if (ret) { - dev_dbg(mpu_dev, "%s: cpu%d: no freq match for %d(ret=%d)\n", - __func__, policy->cpu, target_freq, ret); - return ret; - } - freqs.new = freq_table[i].frequency; - if (!freqs.new) { - dev_err(mpu_dev, "%s: cpu%d: no match for freq %d\n", __func__, - policy->cpu, target_freq); - return -EINVAL; - } - freqs.old = omap_getspeed(policy->cpu); - - if (freqs.old == freqs.new && policy->cur == freqs.new) - return ret; + freqs.new = freq_table[index].frequency; freq = freqs.new * 1000; ret = clk_round_rate(mpu_clk, freq); @@ -223,7 +198,7 @@ static int omap_cpu_exit(struct cpufreq_policy *policy) static struct cpufreq_driver omap_driver = { .flags = CPUFREQ_STICKY, .verify = cpufreq_generic_frequency_table_verify, - .target = omap_target, + .target_index = omap_target, .get = omap_getspeed, .init = omap_cpu_init, .exit = omap_cpu_exit,