From patchwork Wed Oct 30 22:52:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21284 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A2F29244A4 for ; Wed, 30 Oct 2013 22:52:30 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id aq17sf5765598iec.3 for ; Wed, 30 Oct 2013 15:52:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=I7yk0XvyF0/fTIPiivl1099G1z6lCbIJP6T/bTS8NO0=; b=mMxa/rwEk0S3W2EdJcjrB3dcPYFopOku0TXVWJqMoVAlaprJALhe+au7BXAzH8krsz sM11iZMO6halbHoPgzUWgxKXQx6Ap3Op0twhdw6lYJoDFqFRz+qWZBCXeKLP/ngFyRPH uzMfdWIgwjr6p2xhzVIDjkP5nPFwqHrL8vK9q0ekULlTYHFRdRzXA+mOJxoyuAKchW+d +4m39WDdRrmGdTk5tpfJdfwHNsv+BeYam6bUSGrsL5OsNOwHNdBRvPwIPhq43cld44eM TQR5Yz7m1K0CteMJQB2cY6a7wF8zluRo+ef2RONT4Use45m1MlVYYo/096dv6wraNjdY 170A== X-Gm-Message-State: ALoCoQlQLvNJwXUY7PsNmlDw+38ICRoG/5Bmoi5CszyNHWp9e+M3cll4GWfVSRIKhdhPCUSAuWCm X-Received: by 10.182.142.9 with SMTP id rs9mr35901obb.27.1383173550371; Wed, 30 Oct 2013 15:52:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.29.229 with SMTP id n5ls709785qeh.73.gmail; Wed, 30 Oct 2013 15:52:30 -0700 (PDT) X-Received: by 10.52.35.169 with SMTP id i9mr30806vdj.100.1383173550252; Wed, 30 Oct 2013 15:52:30 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id g7si84400vcz.45.2013.10.30.15.52.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 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.169; Received: by mail-vc0-f169.google.com with SMTP id hu8so1444284vcb.0 for ; Wed, 30 Oct 2013 15:52:30 -0700 (PDT) X-Received: by 10.58.34.129 with SMTP id z1mr32799vei.96.1383173550172; Wed, 30 Oct 2013 15:52:30 -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 u4csp316053vcz; Wed, 30 Oct 2013 15:52:29 -0700 (PDT) X-Received: by 10.182.165.67 with SMTP id yw3mr87087obb.84.1383173549675; Wed, 30 Oct 2013 15:52:29 -0700 (PDT) Received: from mail-oa0-f46.google.com (mail-oa0-f46.google.com [209.85.219.46]) by mx.google.com with ESMTPS id iz10si122404obb.78.2013.10.30.15.52.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:29 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.219.46 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.219.46; Received: by mail-oa0-f46.google.com with SMTP id g12so2234496oah.5 for ; Wed, 30 Oct 2013 15:52:29 -0700 (PDT) X-Received: by 10.60.68.10 with SMTP id r10mr97811oet.62.1383173549403; Wed, 30 Oct 2013 15:52:29 -0700 (PDT) Received: from localhost (sccc-66-78-236-243.smartcity.com. [66.78.236.243]) by mx.google.com with ESMTPSA id eg8sm629165obd.6.2013.10.30.15.52.28 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:29 -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@linaro.org Subject: [PATCH V2 Resend 08/16] cpufreq: loongson2: use cpufreq_generic_get() routine Date: Thu, 31 Oct 2013 04:22:06 +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.220.169 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 a436092..b6581ab 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,13 +98,14 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) return ret; } + policy->clk = cpuclk; return cpufreq_generic_init(policy, &loongson2_clockmod_table[0], 0); } 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; } @@ -119,7 +114,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, };