From patchwork Fri Aug 23 15:50:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19485 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 53491248E6 for ; Fri, 23 Aug 2013 15:53:48 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id 1sf610461qee.10 for ; Fri, 23 Aug 2013 08:53: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=KG0r62oBVMCdSyq39R9ChYkYWL6FSbzvH1ym0lIo+lA=; b=hk5i0YU4OqB97j06xlS6BmhEmebWkitYtBUw6DeWSqRzcAuTmUYCAY+n8owiUJlTte ZdTkmm7Fsw4hYVvCwotOKjjqO3RGSQApCqxO980mde7RMidulgTKqyqG0AL3yUsQNApb 42eBylzEIpHqTtx6pkSnv8j5RIdMZmnCUljrdaWxyBFK37YnUFHaKMAwbwF7O7/xUbUz j6X9kzAGZ3Vrs1aQASAevu0ZEduSifDnhAJ8BWMBs3N9Cn4rUcrHRAC0TXgfLjPdMKEn KJxGXR+lHcGJ6Ssig4Elpf+AGOct/hrlZixChYQiJ7PMB/ZX7JMUuhn8qHlMbby3wQpr 5k6A== X-Received: by 10.236.223.130 with SMTP id v2mr105097yhp.34.1377273227903; Fri, 23 Aug 2013 08:53:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.231 with SMTP id n7ls1561598qen.14.gmail; Fri, 23 Aug 2013 08:53:47 -0700 (PDT) X-Received: by 10.58.196.132 with SMTP id im4mr144994vec.28.1377273227738; Fri, 23 Aug 2013 08:53:47 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id xe6si126169vdb.87.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:53:47 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.172 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.172; Received: by mail-vc0-f172.google.com with SMTP id m17so573064vca.3 for ; Fri, 23 Aug 2013 08:53:47 -0700 (PDT) X-Gm-Message-State: ALoCoQmYLg+uzMPOMdDBoRAIeVaW8zLO1qmXBP3DP0JlYSsx+ceY7O8bnUi3sRI0LTBSUON4M0lP X-Received: by 10.52.164.201 with SMTP id ys9mr120893vdb.39.1377273227660; Fri, 23 Aug 2013 08:53: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 u4csp100718vcz; Fri, 23 Aug 2013 08:53:47 -0700 (PDT) X-Received: by 10.68.59.73 with SMTP id x9mr357109pbq.131.1377273226720; Fri, 23 Aug 2013 08:53:46 -0700 (PDT) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by mx.google.com with ESMTPS id hg4si261830pbc.45.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:53:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.42 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.42; Received: by mail-pa0-f42.google.com with SMTP id lj1so839194pab.1 for ; Fri, 23 Aug 2013 08:53:46 -0700 (PDT) X-Received: by 10.68.234.41 with SMTP id ub9mr257247pbc.201.1377273226242; Fri, 23 Aug 2013 08:53:46 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id jf4sm543976pbb.19.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:53: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, Viresh Kumar , John Crispin Subject: [PATCH 09/16] cpufreq: loongson2: use cpufreq_generic_get() routine Date: Fri, 23 Aug 2013 21:20:44 +0530 Message-Id: <6b52aaf5430637af26b2948d3ced4ae07580cc01.1377272740.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.172 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: , We have common infrastructure available with us for getting a CPUs clk rate. Lets use it for this driver. We don't need a global variable to hold clock anymore. Cc: John Crispin Signed-off-by: Viresh Kumar --- drivers/cpufreq/loongson2_cpufreq.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index 6232d29..58a018a 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c @@ -24,8 +24,6 @@ static uint nowait; -static struct clk *cpuclk; - static void (*saved_cpu_wait) (void); static int loongson2_cpu_freq_notifier(struct notifier_block *nb, @@ -44,11 +42,6 @@ static int loongson2_cpu_freq_notifier(struct notifier_block *nb, return 0; } -static unsigned int loongson2_cpufreq_get(unsigned int cpu) -{ - return clk_get_rate(cpuclk); -} - /* * Here we notify other drivers of the proposed change and the final change. */ @@ -69,13 +62,14 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, set_cpus_allowed_ptr(current, &cpus_allowed); /* setting the cpu frequency */ - clk_set_rate(cpuclk, freq); + clk_set_rate(policy->clk, freq); return 0; } static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) { + static struct clk *cpuclk; int i; unsigned long rate; int ret; @@ -104,6 +98,7 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) return ret; } + policy->clk = cpuclk; return cpufreq_table_validate_and_show(policy, &loongson2_clockmod_table[0]); } @@ -111,7 +106,7 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) static int loongson2_cpufreq_exit(struct cpufreq_policy *policy) { cpufreq_frequency_table_put_attr(policy->cpu); - clk_put(cpuclk); + clk_put(policy->clk); return 0; } @@ -120,7 +115,7 @@ static struct cpufreq_driver loongson2_cpufreq_driver = { .init = loongson2_cpufreq_cpu_init, .verify = cpufreq_generic_frequency_table_verify, .target_index = loongson2_cpufreq_target, - .get = loongson2_cpufreq_get, + .get = cpufreq_generic_get, .exit = loongson2_cpufreq_exit, .attr = cpufreq_generic_attr, };