From patchwork Tue Aug 13 13:32:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19076 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4F187246B8 for ; Tue, 13 Aug 2013 13:35:48 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id e13sf223597vbg.4 for ; Tue, 13 Aug 2013 06:35:48 -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=skLj+73iZ8gU0Ig6bA5A0zYjEmtBHW7vkD8wzg17nqw=; b=OUmcKzWTcHKBcCib6PlicpRX2f7FtBzpe6YxDFk33pNRmWK+5WWshKnUHV/2doZN6x Sr22f72TTBM5POIzRO/LYHXRElDuu7tK35At9HyaiTi8YltF9pm+nd921bcfW6ivtypl rQsXp/RsrTqDHtetCt/SnZcbIv9aoR0XPML4wJ3iyBCmgDutqsmqfmTXgK8rkHtCAlge kBPZbok3/6GdNokJY620Heqth2mO2MxpYwPJQ4oGqgUJ2vzG+d5rigOrGLuj9bIxbWJm TANg02sDMOQ1v1UCo5jv1kx3q+zvNyi+FnMcTF+yQLyh1N/1bEgJpNNCSOTBMbXkHNen ucCw== X-Received: by 10.236.150.203 with SMTP id z51mr1643393yhj.23.1376400948000; Tue, 13 Aug 2013 06:35:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.106.197 with SMTP id gw5ls680164qeb.1.gmail; Tue, 13 Aug 2013 06:35:47 -0700 (PDT) X-Received: by 10.220.80.132 with SMTP id t4mr106171vck.57.1376400947876; Tue, 13 Aug 2013 06:35:47 -0700 (PDT) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id l8si9743598vez.124.2013.08.13.06.35.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:47 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.41 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.41; Received: by mail-vb0-f41.google.com with SMTP id g17so6600561vbg.14 for ; Tue, 13 Aug 2013 06:35:47 -0700 (PDT) X-Gm-Message-State: ALoCoQkjnCUfxIBpnZX1B2r/ZqOLX529AJtB78U+8jz81bbifJGzYNDUMWzH87BO2C2w3no1hNXg X-Received: by 10.221.23.72 with SMTP id qz8mr94413vcb.66.1376400947778; Tue, 13 Aug 2013 06:35:47 -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 u4csp154234vcz; Tue, 13 Aug 2013 06:35:47 -0700 (PDT) X-Received: by 10.68.200.9 with SMTP id jo9mr4548550pbc.120.1376400946951; Tue, 13 Aug 2013 06:35:46 -0700 (PDT) Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by mx.google.com with ESMTPS id tl4si26240094pac.224.2013.08.13.06.35.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.182 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.182; Received: by mail-pd0-f182.google.com with SMTP id r10so4917848pdi.41 for ; Tue, 13 Aug 2013 06:35:46 -0700 (PDT) X-Received: by 10.66.37.43 with SMTP id v11mr4637520paj.108.1376400946569; Tue, 13 Aug 2013 06:35:46 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id a5sm44025926pbw.4.2013.08.13.06.35.42 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:45 -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 , "David S. Miller" Subject: [PATCH V2 21/35] cpufreq: p4: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:34 +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.41 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: David S. Miller Signed-off-by: Viresh Kumar --- drivers/cpufreq/p4-clockmod.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c index 4fe6d4c..5a6263e 100644 --- a/drivers/cpufreq/p4-clockmod.c +++ b/drivers/cpufreq/p4-clockmod.c @@ -105,23 +105,13 @@ static struct cpufreq_frequency_table p4clockmod_table[] = { }; -static int cpufreq_p4_target(struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) +static int cpufreq_p4_target(struct cpufreq_policy *policy, unsigned int index) { - unsigned int newstate = DC_RESV; struct cpufreq_freqs freqs; int i; - if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], - target_freq, relation, &newstate)) - return -EINVAL; - freqs.old = cpufreq_p4_get(policy->cpu); - freqs.new = stock_freq * p4clockmod_table[newstate].driver_data / 8; - - if (freqs.new == freqs.old) - return 0; + freqs.new = stock_freq * p4clockmod_table[index].driver_data / 8; /* notifiers */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); @@ -131,7 +121,7 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy, * Developer's Manual, Volume 3 */ for_each_cpu(i, policy->cpus) - cpufreq_p4_setdc(i, p4clockmod_table[newstate].driver_data); + cpufreq_p4_setdc(i, p4clockmod_table[index].driver_data); /* notifiers */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); @@ -256,7 +246,7 @@ static unsigned int cpufreq_p4_get(unsigned int cpu) static struct cpufreq_driver p4clockmod_driver = { .verify = cpufreq_generic_frequency_table_verify, - .target = cpufreq_p4_target, + .target_index = cpufreq_p4_target, .init = cpufreq_p4_cpu_init, .exit = cpufreq_generic_exit, .get = cpufreq_p4_get,