From patchwork Tue Aug 13 13:32:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19073 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 508E7246B8 for ; Tue, 13 Aug 2013 13:35:26 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf9421643vbg.3 for ; Tue, 13 Aug 2013 06:35:26 -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=0fxSh5+ers6vJTGNWzGuIohg8I0mbS87Tb38rESzSO0=; b=FUc61DviWD5ixXe7ZKvfhfow3IrMyiA2JOeBjATf2k9mlJsgahnitsF8nfDMMDBwJw P1j9adoZRVOBm41l6Nn5JqOojGDdHsKCvSGhZPsACudAwesvdacqyVl6wk3crErtozY0 8rJKLutEzJkbS77X+/FfkgYyH2TRfG7nimVCSOPTgUdI+bg8UFcN08bjnRsJDXtnOy3w BMu9oqxUZVf1mtSAXRCRphJzg7Wp764D/PMVzk3shyhHZWRTZUCWWjpUNHHKHoSmargV rYWV3JT3BxODCSemcy6ncCmunYeC87poOuaG45/AE3XQh34fidV2tbNkdhDx+xahzDk3 GgRg== X-Received: by 10.236.147.50 with SMTP id s38mr1628366yhj.44.1376400926033; Tue, 13 Aug 2013 06:35:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.105.69 with SMTP id gk5ls1639972qeb.57.gmail; Tue, 13 Aug 2013 06:35:25 -0700 (PDT) X-Received: by 10.52.73.229 with SMTP id o5mr454452vdv.54.1376400925874; Tue, 13 Aug 2013 06:35:25 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id jf10si9752196vdb.11.2013.08.13.06.35.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id id13so3414903vcb.18 for ; Tue, 13 Aug 2013 06:35:25 -0700 (PDT) X-Gm-Message-State: ALoCoQmDXEMefYFmtyaeDx7WhMXaEptNWbv9qzi0fVIDEilBGGmqf+MRrnKuSCkWqMVVCmcrOuC2 X-Received: by 10.220.164.138 with SMTP id e10mr4492296vcy.27.1376400925750; Tue, 13 Aug 2013 06:35:25 -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 u4csp154218vcz; Tue, 13 Aug 2013 06:35:25 -0700 (PDT) X-Received: by 10.68.101.225 with SMTP id fj1mr4646431pbb.8.1376400924835; Tue, 13 Aug 2013 06:35:24 -0700 (PDT) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by mx.google.com with ESMTPS id tw4si25092184pbc.271.2013.08.13.06.35.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.169 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.169; Received: by mail-pd0-f169.google.com with SMTP id r10so4931090pdi.0 for ; Tue, 13 Aug 2013 06:35:24 -0700 (PDT) X-Received: by 10.68.225.195 with SMTP id rm3mr4674434pbc.70.1376400924417; Tue, 13 Aug 2013 06:35:24 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id hk3sm2488095pbb.3.2013.08.13.06.35.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:23 -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 , John Crispin Subject: [PATCH V2 18/35] cpufreq: loongson2: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:31 +0530 Message-Id: <038067a60cebe1bb098393f2d5254417c96a033a.1376392602.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.220.173 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 ed7fbe2..009c29c 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); @@ -148,7 +137,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,