From patchwork Fri Oct 18 13:59:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21148 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f197.google.com (mail-ye0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6CCA4202FF for ; Fri, 18 Oct 2013 14:02:23 +0000 (UTC) Received: by mail-ye0-f197.google.com with SMTP id q8sf5818053yen.4 for ; Fri, 18 Oct 2013 07:02:23 -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=puYpn/BopN3KlaSHgZF6EVflGIhVx9JGeNCte5Sd2QA=; b=SKbamWm9hhArxQW5Jp7xZjJ6V2Iv22zWD0I+f5Aq5OU2UFsXWD+Zk8JsctH4EFxNT9 /FVEKmWerh7pIGO93XrRvEc6ZuoImC1MMfHSQQhKbgHzuBBUBc0/npowNxhQpD0fo3DA n//4iVR2MyA7gKMxskgtbzeDlI6wlhj35fW0zD0s7BZjxi6LyGCxE+PmD835kibe8d5z ljOMnr9uECBtojylK6knIj9qSfYbu4mVEGiBWln1r3K2w4xJVlh4WmAgMMrJVQZSxYBp xW7yJBQdxrsh/CC490jE8S4LCo/H8Qps+HObuvvY3plEAyC3aiVKodOWcD9ECmPUeeiF WdBw== X-Received: by 10.236.90.67 with SMTP id d43mr2979506yhf.36.1382104943200; Fri, 18 Oct 2013 07:02:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.81.210 with SMTP id c18ls1422832qey.37.gmail; Fri, 18 Oct 2013 07:02:23 -0700 (PDT) X-Received: by 10.220.174.200 with SMTP id u8mr2237933vcz.6.1382104943096; Fri, 18 Oct 2013 07:02:23 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id ip2si328430vcb.116.2013.10.18.07.02.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.46 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.46; Received: by mail-vb0-f46.google.com with SMTP id 10so1555357vbe.19 for ; Fri, 18 Oct 2013 07:02:23 -0700 (PDT) X-Gm-Message-State: ALoCoQnCJYKZKKIHKURbx9VS716K1CpVcG1oNaYXQK6sXakfa4hVYlg10A/An4yCPiVh37Lgu1a1 X-Received: by 10.52.27.243 with SMTP id w19mr1780144vdg.3.1382104943000; Fri, 18 Oct 2013 07:02:23 -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 u4csp38031vcz; Fri, 18 Oct 2013 07:02:22 -0700 (PDT) X-Received: by 10.68.180.5 with SMTP id dk5mr3272327pbc.176.1382104942106; Fri, 18 Oct 2013 07:02:22 -0700 (PDT) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx.google.com with ESMTPS id l8si1011807pbi.61.2013.10.18.07.02.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.46 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id fa1so4612483pad.33 for ; Fri, 18 Oct 2013 07:02:21 -0700 (PDT) X-Received: by 10.66.228.38 with SMTP id sf6mr3695747pac.21.1382104941709; Fri, 18 Oct 2013 07:02:21 -0700 (PDT) Received: from localhost ([120.56.197.189]) by mx.google.com with ESMTPSA id be1sm2615322pbb.28.2013.10.18.07.02.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:21 -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 , John Crispin Subject: [PATCH V2 Resend 17/34] cpufreq: loongson2: Convert to light weight ->target_index() routine Date: Fri, 18 Oct 2013 19:29:40 +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.46 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: John Crispin Signed-off-by: Viresh Kumar --- drivers/cpufreq/loongson2_cpufreq.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index 2c8ec8e..41a8e2c 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c @@ -53,11 +53,9 @@ static unsigned int loongson2_cpufreq_get(unsigned int cpu) * Here we notify other drivers of the proposed change and the final change. */ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) + unsigned int index) { unsigned int cpu = policy->cpu; - unsigned int newstate = 0; cpumask_t cpus_allowed; struct cpufreq_freqs freqs; unsigned int freq; @@ -65,26 +63,17 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, cpus_allowed = current->cpus_allowed; set_cpus_allowed_ptr(current, cpumask_of(cpu)); - if (cpufreq_frequency_table_target - (policy, &loongson2_clockmod_table[0], target_freq, relation, - &newstate)) - return -EINVAL; - freq = ((cpu_clock_freq / 1000) * - loongson2_clockmod_table[newstate].driver_data) / 8; - if (freq < policy->min || freq > policy->max) - return -EINVAL; + loongson2_clockmod_table[index].driver_data) / 8; - pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000); + pr_debug("cpufreq: requested frequency %u Hz\n", + loongson2_clockmod_table[index].frequency * 1000); freqs.old = loongson2_cpufreq_get(cpu); freqs.new = freq; freqs.flags = 0; - if (freqs.new == freqs.old) - return 0; - /* notifiers */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); @@ -145,7 +134,7 @@ static struct cpufreq_driver loongson2_cpufreq_driver = { .name = "loongson2", .init = loongson2_cpufreq_cpu_init, .verify = cpufreq_generic_frequency_table_verify, - .target = loongson2_cpufreq_target, + .target_index = loongson2_cpufreq_target, .get = loongson2_cpufreq_get, .exit = loongson2_cpufreq_exit, .attr = cpufreq_generic_attr,