From patchwork Fri Aug 23 15:50:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19487 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f200.google.com (mail-ye0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 25BAF248E6 for ; Fri, 23 Aug 2013 15:54:07 +0000 (UTC) Received: by mail-ye0-f200.google.com with SMTP id r5sf586296yen.11 for ; Fri, 23 Aug 2013 08:54:06 -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=1uqk1jioRISR4M36RUuf85rdY8QR3bdMQPBUhHYnpxw=; b=IBK9l83EjWlVFU0vbj6v+DMsSNZk+io4KIWyboZNo9CRGgRwdL2MGx79as6/cZGX4b gn3WZ0Du6Knsve1H/ZThzx45rihMnxTtFNC9KYh1H9TBrDJi5qxNhriwvTN/6aCpS1pN vKQbNEWFaxvGxCAZNBd3C1bb4a9u9QP4RBX7IGUt5Gy+8Y7WpsrqpcdajhvAH3X1HCHf zRodya2yHbYpweAUUjJzuxuRe+NVHojXWpL5cHPjfTp4PlzAnfskVW3t4CYu+rY/YpXf 1r000vK43+jxgF95pWOM8LM76GTEjorIdgvKTV6+AUpFGx1y6ctZpPm8Sn4Yyi7Mqeht Gqsw== X-Received: by 10.236.6.134 with SMTP id 6mr144926yhn.7.1377273246839; Fri, 23 Aug 2013 08:54:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.169 with SMTP id d9ls1595739qeo.21.gmail; Fri, 23 Aug 2013 08:54:06 -0700 (PDT) X-Received: by 10.220.182.137 with SMTP id cc9mr118752vcb.62.1377273246716; Fri, 23 Aug 2013 08:54:06 -0700 (PDT) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id vr9si133324vcb.51.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:54:06 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.50 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.50; Received: by mail-vb0-f50.google.com with SMTP id x14so567265vbb.9 for ; Fri, 23 Aug 2013 08:54:06 -0700 (PDT) X-Gm-Message-State: ALoCoQkUDerRiX6LEtgq9QDg7C2mvQGMwzdPgl4XCJ1YkbUsBsijHN0Ht/stPlEjAeGnix9mNbjP X-Received: by 10.220.181.136 with SMTP id by8mr165537vcb.11.1377273246631; Fri, 23 Aug 2013 08:54:06 -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 u4csp100733vcz; Fri, 23 Aug 2013 08:54:06 -0700 (PDT) X-Received: by 10.66.154.169 with SMTP id vp9mr2210701pab.190.1377273245589; Fri, 23 Aug 2013 08:54:05 -0700 (PDT) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by mx.google.com with ESMTPS id jq4si206588pbc.317.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:54:05 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.174 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.174; Received: by mail-pd0-f174.google.com with SMTP id y13so837229pdi.33 for ; Fri, 23 Aug 2013 08:54:05 -0700 (PDT) X-Received: by 10.67.23.199 with SMTP id ic7mr21854565pad.73.1377273245081; Fri, 23 Aug 2013 08:54:05 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id tz3sm542316pbc.20.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:54:04 -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 Subject: [PATCH 11/16] cpufreq: ppc: use cpufreq_generic_get() routine Date: Fri, 23 Aug 2013 21:20:46 +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.50 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 variable to hold clock anymore in struct cpu_data. Signed-off-by: Viresh Kumar --- drivers/cpufreq/ppc-corenet-cpufreq.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c index 3f7be46..051000f 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c @@ -24,12 +24,10 @@ /** * struct cpu_data - per CPU data struct - * @clk: the clk of CPU * @parent: the parent node of cpu clock * @table: frequency table */ struct cpu_data { - struct clk *clk; struct device_node *parent; struct cpufreq_frequency_table *table; }; @@ -81,13 +79,6 @@ static inline const struct cpumask *cpu_core_mask(int cpu) } #endif -static unsigned int corenet_cpufreq_get_speed(unsigned int cpu) -{ - struct cpu_data *data = per_cpu(cpu_data, cpu); - - return clk_get_rate(data->clk) / 1000; -} - /* reduce the duplicated frequencies in frequency table */ static void freq_table_redup(struct cpufreq_frequency_table *freq_table, int count) @@ -158,8 +149,8 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) goto err_np; } - data->clk = of_clk_get(np, 0); - if (IS_ERR(data->clk)) { + policy->clk = of_clk_get(np, 0); + if (IS_ERR(policy->clk)) { pr_err("%s: no clock information\n", __func__); goto err_nomem2; } @@ -255,7 +246,7 @@ static int corenet_cpufreq_target(struct cpufreq_policy *policy, struct cpu_data *data = per_cpu(cpu_data, policy->cpu); parent = of_clk_get(data->parent, data->table[index].driver_data); - return clk_set_parent(data->clk, parent); + return clk_set_parent(policy->clk, parent); } static struct cpufreq_driver ppc_corenet_cpufreq_driver = { @@ -265,7 +256,7 @@ static struct cpufreq_driver ppc_corenet_cpufreq_driver = { .exit = __exit_p(corenet_cpufreq_cpu_exit), .verify = cpufreq_generic_frequency_table_verify, .target_index = corenet_cpufreq_target, - .get = corenet_cpufreq_get_speed, + .get = cpufreq_generic_get, .attr = cpufreq_generic_attr, };