From patchwork Wed Oct 30 22:52:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21286 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0DB2C244A4 for ; Wed, 30 Oct 2013 22:52:37 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id fb1sf2679560pad.5 for ; Wed, 30 Oct 2013 15:52:37 -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=1uqk1jioRISR4M36RUuf85rdY8QR3bdMQPBUhHYnpxw=; b=Lqoc2KjyonKcu64Wurl1WMZ2+hsUlE6SpaSOwdk/7gTLsbCIeD78+f/+rkbRrcrSMe OASKBgnnXhnr7ibdYIrLltOIM5XmDlSbl8S6QQMi6Nw1tSaYm43LZoRtggJt8NYuwwFd VEYxdF0fA0A8Ik26T9YqSK/xc5lJeXBnO83VdSBmi8ST2whyEI7vK8tZXY8UHVoX6xcN X+O+Vz68ZKDeK8NGphGxYmeDkqIFK/zjoKI29CrMP7BAMlcixwIx1HPfyd7NcIhacFLw nfU9Wi8dGu8rb0/e3dmKDEORVfFjvV5u/F9NjhvnZOvyFWVanIxKpMU+wxsDXNROtDMU WvrA== X-Gm-Message-State: ALoCoQl4Q7TEB0A0zr+JkVo3PICjYLzb4nt0eTn+gc+xK3nzBQgerdcNy1LnRZEYowNQ4hmqSmwQ X-Received: by 10.67.3.34 with SMTP id bt2mr327353pad.41.1383173557222; Wed, 30 Oct 2013 15:52:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.53.2 with SMTP id x2ls721610qeo.34.gmail; Wed, 30 Oct 2013 15:52:37 -0700 (PDT) X-Received: by 10.220.2.138 with SMTP id 10mr3620vcj.77.1383173557006; Wed, 30 Oct 2013 15:52:37 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id gu4si89975vdc.7.2013.10.30.15.52.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 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.180; Received: by mail-vc0-f180.google.com with SMTP id lc6so1394735vcb.39 for ; Wed, 30 Oct 2013 15:52:36 -0700 (PDT) X-Received: by 10.58.22.33 with SMTP id a1mr15282vef.55.1383173556925; Wed, 30 Oct 2013 15:52:36 -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 u4csp316058vcz; Wed, 30 Oct 2013 15:52:36 -0700 (PDT) X-Received: by 10.182.48.166 with SMTP id m6mr26957obn.65.1383173556404; Wed, 30 Oct 2013 15:52:36 -0700 (PDT) Received: from mail-oa0-f42.google.com (mail-oa0-f42.google.com [209.85.219.42]) by mx.google.com with ESMTPS id pu10si120437obb.87.2013.10.30.15.52.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.219.42 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.219.42; Received: by mail-oa0-f42.google.com with SMTP id k14so2270543oag.15 for ; Wed, 30 Oct 2013 15:52:35 -0700 (PDT) X-Received: by 10.182.28.134 with SMTP id b6mr52847obh.27.1383173555689; Wed, 30 Oct 2013 15:52:35 -0700 (PDT) Received: from localhost (sccc-66-78-236-243.smartcity.com. [66.78.236.243]) by mx.google.com with ESMTPSA id b5sm617465obj.8.2013.10.30.15.52.34 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:35 -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 10/16] cpufreq: ppc: use cpufreq_generic_get() routine Date: Thu, 31 Oct 2013 04:22:08 +0530 Message-Id: <15f2831ad3604c70f37ceb60590c18e11a1ea84e.1383173230.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.180 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, };