From patchwork Fri Oct 18 13:59:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21150 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 06F0D202FF for ; Fri, 18 Oct 2013 14:02:38 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id fa1sf6400601pad.1 for ; Fri, 18 Oct 2013 07:02:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; 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=6xuYBFu2vpnSGLza6+l1nX4rQg+N1IUTT2AkPRBCSv8=; b=P53Yy6yOClx3+4GnND0L4eUsAhxuYnUH/DM7fj6mGDuAWUaJLZGtQy1PTjXS2FW/OD 1QKYS5j4kJghoTyznhUvSI27yXZvCet0dPB08aMws6gV+512maDShM49C3vj8THQ+1Xp ACOLa+aAkdlDzpCLxVy86FHoszOHwqPbFiF1+62uPUXdpY4D1eEnwIEUH92di1nmjbUb JCBwFMFJwrHEbPrKEJvahzlYWgQiomE7w8E9kq7p4fb3P122qvoy93B7qo8G/76Vsnxm zFHNANKqiD3DcpOh5plYosUy0FUZijex9+APXsyQzIQp99MN8pGp3vh+cXr+QWOlJrq3 nMDw== X-Received: by 10.68.137.163 with SMTP id qj3mr1150371pbb.4.1382104958296; Fri, 18 Oct 2013 07:02:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.29.200 with SMTP id m8ls1210822qeh.1.gmail; Fri, 18 Oct 2013 07:02:38 -0700 (PDT) X-Received: by 10.58.67.9 with SMTP id j9mr2171225vet.3.1382104958041; Fri, 18 Oct 2013 07:02:38 -0700 (PDT) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by mx.google.com with ESMTPS id j6si326762vet.131.2013.10.18.07.02.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.52 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.52; Received: by mail-vb0-f52.google.com with SMTP id f12so1817966vbg.39 for ; Fri, 18 Oct 2013 07:02:38 -0700 (PDT) X-Gm-Message-State: ALoCoQktuzXy0AJ39LSYXo7nRm0m2kIXst8Vg/7Wcm98uEtAwgc6r38GEaDULJmpcl4mWZRsyauB X-Received: by 10.52.119.228 with SMTP id kx4mr1874833vdb.12.1382104957961; Fri, 18 Oct 2013 07:02: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 u4csp38055vcz; Fri, 18 Oct 2013 07:02:37 -0700 (PDT) X-Received: by 10.67.14.67 with SMTP id fe3mr3745297pad.134.1382104957008; Fri, 18 Oct 2013 07:02:37 -0700 (PDT) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) by mx.google.com with ESMTPS id z1si962933pbw.339.2013.10.18.07.02.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.173 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.173; Received: by mail-pd0-f173.google.com with SMTP id r10so2449058pdi.32 for ; Fri, 18 Oct 2013 07:02:36 -0700 (PDT) X-Received: by 10.66.251.40 with SMTP id zh8mr2100631pac.185.1382104956606; Fri, 18 Oct 2013 07:02:36 -0700 (PDT) Received: from localhost ([120.56.197.189]) by mx.google.com with ESMTPSA id gf5sm2629207pbc.22.2013.10.18.07.02.32 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:36 -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, Viresh Kumar , Santosh Shilimkar Subject: [PATCH V2 Resend 19/34] cpufreq: omap: Convert to light weight ->target_index() routine Date: Fri, 18 Oct 2013 19:29:42 +0530 Message-Id: <2955c345b6a55c0ead2c98f4a53ff4479233b905.1382104515.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.52 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 ac552d0..b551271 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 dev_pm_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); @@ -200,7 +175,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,