From patchwork Mon Aug 12 17:49:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 266600 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 901AE2C00B8 for ; Tue, 13 Aug 2013 03:53:37 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755210Ab3HLRxA (ORCPT ); Mon, 12 Aug 2013 13:53:00 -0400 Received: from mail-pb0-f50.google.com ([209.85.160.50]:42789 "EHLO mail-pb0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755080Ab3HLRwv (ORCPT ); Mon, 12 Aug 2013 13:52:51 -0400 Received: by mail-pb0-f50.google.com with SMTP id uo5so7050398pbc.37 for ; Mon, 12 Aug 2013 10:52:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=qhRL1U80nB2OdIZ/+zEy5sdEXXww2ZfeNbm+J7ByEIs=; b=GOU13A6yW7PaSudx6gmi7gkQ6l2Er4NW2W7kQZa7RGoL+DRWrHInDJO82oVWSe1jTv V0qCeYgFroQIKUjF5WO/LNvLRtnpj/oQECGxn8pqtCQCwbu6zv7kvxlAJ0HFXIpRyXQy kGHDYO1M9hLBUArIfuYVrKQj6bJ5reLU52/Hr7xE3TGHFh0OhZFutUgfBvz7ptOG3EQk 4W/yHRtJgrkUGGvmHiHi+nDJ0/ZZ2VDD5m8rmh26yNVIPBULjXfDbh6nlXdXazoRuPzU 9F6i66DKJWjnXvss3SzJ/D/QzUrtJvOIemXVq4e45DRZ4rEAoer/ln1A7eBCyXvuFD0j Ee3A== X-Gm-Message-State: ALoCoQkcZ6fH8ZBzk55i9igKmz8RQRm8mQ892adU1vTW2uSlzFccWSpxIErJJvC0PxexvneLNDfy X-Received: by 10.68.130.163 with SMTP id of3mr231187pbb.181.1376329970494; Mon, 12 Aug 2013 10:52:50 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id xl3sm38615816pbb.17.2013.08.12.10.52.46 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:52:49 -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" , sparclinux@vger.kernel.org Subject: [PATCH 28/31] cpufreq: sparc: Covert to light weight ->target() routine Date: Mon, 12 Aug 2013 23:19:04 +0530 Message-Id: <36eec7d0f42117c867940f15cf994551de378dd6.1376329128.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org This patch converts existing .target_old() to newly defined light weight .target() 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 Cc: sparclinux@vger.kernel.org Signed-off-by: Viresh Kumar --- drivers/cpufreq/sparc-us2e-cpufreq.c | 21 +++------------------ drivers/cpufreq/sparc-us3-cpufreq.c | 23 +++-------------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/drivers/cpufreq/sparc-us2e-cpufreq.c b/drivers/cpufreq/sparc-us2e-cpufreq.c index 95db9c1..8ee1c19 100644 --- a/drivers/cpufreq/sparc-us2e-cpufreq.c +++ b/drivers/cpufreq/sparc-us2e-cpufreq.c @@ -245,8 +245,7 @@ static unsigned int us2e_freq_get(unsigned int cpu) return clock_tick / estar_to_divisor(estar); } -static void us2e_set_cpu_divider_index(struct cpufreq_policy *policy, - unsigned int index) +static int us2e_freq_target(struct cpufreq_policy *policy, unsigned int index) { unsigned int cpu = policy->cpu; unsigned long new_bits, new_freq; @@ -277,20 +276,6 @@ static void us2e_set_cpu_divider_index(struct cpufreq_policy *policy, cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); set_cpus_allowed_ptr(current, &cpus_allowed); -} - -static int us2e_freq_target(struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) -{ - unsigned int new_index = 0; - - if (cpufreq_frequency_table_target(policy, - &us2e_freq_table[policy->cpu].table[0], - target_freq, relation, &new_index)) - return -EINVAL; - - us2e_set_cpu_divider_index(policy, new_index); return 0; } @@ -325,7 +310,7 @@ static int us2e_freq_cpu_exit(struct cpufreq_policy *policy) { if (cpufreq_us2e_driver) { cpufreq_frequency_table_put_attr(policy->cpu); - us2e_set_cpu_divider_index(policy, 0); + us2e_freq_target(policy, 0); } return 0; @@ -358,7 +343,7 @@ static int __init us2e_freq_init(void) driver->init = us2e_freq_cpu_init; driver->verify = cpufreq_generic_frequency_table_verify; - driver->target_old = us2e_freq_target; + driver->target = us2e_freq_target; driver->get = us2e_freq_get; driver->exit = us2e_freq_cpu_exit; strcpy(driver->name, "UltraSPARC-IIe"); diff --git a/drivers/cpufreq/sparc-us3-cpufreq.c b/drivers/cpufreq/sparc-us3-cpufreq.c index 75f58c0..2a54011 100644 --- a/drivers/cpufreq/sparc-us3-cpufreq.c +++ b/drivers/cpufreq/sparc-us3-cpufreq.c @@ -93,8 +93,7 @@ static unsigned int us3_freq_get(unsigned int cpu) return ret; } -static void us3_set_cpu_divider_index(struct cpufreq_policy *policy, - unsigned int index) +static int us3_freq_target(struct cpufreq_policy *policy, unsigned int index) { unsigned int cpu = policy->cpu; unsigned long new_bits, new_freq, reg; @@ -136,22 +135,6 @@ static void us3_set_cpu_divider_index(struct cpufreq_policy *policy, cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); set_cpus_allowed_ptr(current, &cpus_allowed); -} - -static int us3_freq_target(struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) -{ - unsigned int new_index = 0; - - if (cpufreq_frequency_table_target(policy, - &us3_freq_table[policy->cpu].table[0], - target_freq, - relation, - &new_index)) - return -EINVAL; - - us3_set_cpu_divider_index(policy, new_index); return 0; } @@ -182,7 +165,7 @@ static int us3_freq_cpu_exit(struct cpufreq_policy *policy) { if (cpufreq_us3_driver) { cpufreq_frequency_table_put_attr(policy->cpu); - us3_set_cpu_divider_index(policy, 0); + us3_freq_target(policy, 0); } return 0; @@ -219,7 +202,7 @@ static int __init us3_freq_init(void) driver->init = us3_freq_cpu_init; driver->verify = cpufreq_generic_frequency_table_verify; - driver->target_old = us3_freq_target; + driver->target = us3_freq_target; driver->get = us3_freq_get; driver->exit = us3_freq_cpu_exit; strcpy(driver->name, "UltraSPARC-III");