From patchwork Fri Sep 13 13:02:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20275 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B5EE220358 for ; Fri, 13 Sep 2013 13:29:20 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id hf12sf1209481vcb.11 for ; Fri, 13 Sep 2013 06:29:20 -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=VXsuShxji3H3vI8aRjXFUp9Ofb+pANKU+mYrik5BR9exclFMgZKmQbdoyYsjWn2TKE NvA9zofGKnWPrUIvqTiFYmw2cGsl62jE8WAo6hVJcWWgMOcSWJHADDdLhqwF5fmoaLy4 Ih9yeOoqHUIb4rnMhRo+6WTybCdsWUzgpcmYHV8JURtlZzj0tXtiKJj6iBS9bMNWHo2n aoqmuniG7cBQmP3ImGyLBENog4Kv9hI/qfn9Jz/67/2zY29D7WYzWa0C8IwCLZZOQxtp S7K6yYEI8be0BhnHl5rLhu/V0ixjewQ3GUWZKQACE2+8LQKX7BAFK5CR9zTBs6c8VZ+4 e2ZQ== X-Gm-Message-State: ALoCoQnCAXpxI1pAxGUD086LyK+brX4m7mPt9YFlobaf1U7u3apJ88egyoCuC9nrcjW/rMa7NRKB X-Received: by 10.236.167.138 with SMTP id i10mr5443578yhl.9.1379078960413; Fri, 13 Sep 2013 06:29:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.87.36 with SMTP id u4ls1159355qez.56.gmail; Fri, 13 Sep 2013 06:29:20 -0700 (PDT) X-Received: by 10.52.98.131 with SMTP id ei3mr10097924vdb.4.1379078960204; Fri, 13 Sep 2013 06:29:20 -0700 (PDT) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id dh7si3119184vcb.113.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:29:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.49 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.49; Received: by mail-vb0-f49.google.com with SMTP id w16so894739vbb.22 for ; Fri, 13 Sep 2013 06:29:20 -0700 (PDT) X-Received: by 10.220.145.75 with SMTP id c11mr337224vcv.30.1379078960122; Fri, 13 Sep 2013 06:29:20 -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 u4csp80806vcz; Fri, 13 Sep 2013 06:29:19 -0700 (PDT) X-Received: by 10.68.253.227 with SMTP id ad3mr2118269pbd.189.1379078959227; Fri, 13 Sep 2013 06:29:19 -0700 (PDT) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id ct5si7491687pbb.101.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:29:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.47; Received: by mail-pa0-f47.google.com with SMTP id kl13so2518759pab.6 for ; Fri, 13 Sep 2013 06:29:18 -0700 (PDT) X-Received: by 10.68.134.98 with SMTP id pj2mr13495960pbb.110.1379078958843; Fri, 13 Sep 2013 06:29:18 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id wp8sm11777717pbc.26.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:29:18 -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 221/228] cpufreq: loongson2: use cpufreq_generic_get() routine Date: Fri, 13 Sep 2013 18:32:47 +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.49 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, };