From patchwork Fri Oct 18 13:59:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21151 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f200.google.com (mail-ye0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0B960202FF for ; Fri, 18 Oct 2013 14:02:46 +0000 (UTC) Received: by mail-ye0-f200.google.com with SMTP id r9sf5822960yen.3 for ; Fri, 18 Oct 2013 07:02:45 -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=/DBfjyAyFp071gZdqMO5j0W9NnnxKGcP4RtfmW8cWZQ=; b=CTAwL0otWfojbv9xJBkfz8N8OZuKJdbWXJR7cvPrqB3sb4onqXN4o9xZT3pDKQ+DHa EScCpIppGU0ymPBIqiPXPLon0z2ey0rZXaev8KypJ8ujRMcS6qnmE0RqmdvUYRWD0wIS 0mn8kAp7l8fZlriFP9Itt9ULnEUvfd0u9kMiryITlNK329rH3Q1+dXfrDA60mAx5WkL6 9SfzPqZTYuWmnpl1BYcw6OtMJzfBQmnC221MNthGKOzwqXPEVlDaVZjdznrDC9dgVKgx wxCJu8yADY3s817UjPzW8pXiiv0I0ixCTsbRuMa1RK0eBgTwXJ0p1OLkR8IAFLOXZ8KH sjyg== X-Received: by 10.236.135.211 with SMTP id u59mr2633082yhi.43.1382104965804; Fri, 18 Oct 2013 07:02:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.5.9 with SMTP id o9ls1293333qeo.49.gmail; Fri, 18 Oct 2013 07:02:45 -0700 (PDT) X-Received: by 10.220.1.203 with SMTP id 11mr2193622vcg.15.1382104965632; Fri, 18 Oct 2013 07:02:45 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id ed9si332465vcb.81.2013.10.18.07.02.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.175 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.175; Received: by mail-ve0-f175.google.com with SMTP id pa12so1984544veb.6 for ; Fri, 18 Oct 2013 07:02:45 -0700 (PDT) X-Gm-Message-State: ALoCoQmKu3f/1IPmCTrHgHKjQaEzQ4rbtuOTc17DUxVFfNfqjlf+ppBh2QUZp4vUAqLPTRccKv7U X-Received: by 10.220.86.69 with SMTP id r5mr2185014vcl.9.1382104965523; Fri, 18 Oct 2013 07:02:45 -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 u4csp38065vcz; Fri, 18 Oct 2013 07:02:45 -0700 (PDT) X-Received: by 10.66.144.102 with SMTP id sl6mr3692521pab.96.1382104964526; Fri, 18 Oct 2013 07:02:44 -0700 (PDT) Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by mx.google.com with ESMTPS id fk10si1598835pab.29.2013.10.18.07.02.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.178 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.178; Received: by mail-pd0-f178.google.com with SMTP id w10so4755824pde.9 for ; Fri, 18 Oct 2013 07:02:44 -0700 (PDT) X-Received: by 10.68.172.36 with SMTP id az4mr3337519pbc.48.1382104964105; Fri, 18 Oct 2013 07:02:44 -0700 (PDT) Received: from localhost ([120.56.197.189]) by mx.google.com with ESMTPSA id uw6sm2655919pbc.8.2013.10.18.07.02.40 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:43 -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 , "David S. Miller" Subject: [PATCH V2 Resend 20/34] cpufreq: p4: Convert to light weight ->target_index() routine Date: Fri, 18 Oct 2013 19:29:43 +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.175 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 6164c1c..3c23053 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); @@ -255,7 +245,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,