From patchwork Tue Aug 13 13:31:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2843630 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 79C7FBF546 for ; Tue, 13 Aug 2013 13:33:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4085320466 for ; Tue, 13 Aug 2013 13:33:44 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F17062045B for ; Tue, 13 Aug 2013 13:33:42 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9EiP-0004bY-GU; Tue, 13 Aug 2013 13:32:50 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Ei2-0007Wm-VE; Tue, 13 Aug 2013 13:32:26 +0000 Received: from mail-pd0-f178.google.com ([209.85.192.178]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Ehi-0007Rw-Ib for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2013 13:32:09 +0000 Received: by mail-pd0-f178.google.com with SMTP id w10so4931935pde.9 for ; Tue, 13 Aug 2013 06:31:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=3C8reJWp+66mJWgMJzvXUOaesJrZe9BYAG6kZy0uXVc=; b=XYAMx8ESupO0ZZrXnpukG0pqnG0izHRWhgz8on/PAC3bDFeY24YsTX4ezIR2AlMRvi 8iPsSUR9pKKOOwPh+pakdl/Ika41QjkSnhG01y1Fg47HFLjkJct3MXsHZO79/5nH9pjg EdpngvNeOIW1vyLad3sEjdtXGGsyRBxtEm3mWrHhyAWDVmzY+Ehs8eXjFVjxkJRFTgbw wQjFypOWQWxhkk/wOXfaZWh8BRnU3SCHina+9bqQPxmCrDupAR2RqTkEICq596nOeT5d Z5e6vCv/p8y3F3qeYgIvLzsyW9kbwEiVEorIkr4pFSyeRqbSZYqt00nWhPxyU93dvhsS ycMg== X-Gm-Message-State: ALoCoQke1MF9ARZpruGNbbAMnt4YxpQnw4KEa38m5j4Z3N27wAqxIrg49643QQAsI/GBW+nl2nM+ X-Received: by 10.66.218.98 with SMTP id pf2mr4623986pac.120.1376400705644; Tue, 13 Aug 2013 06:31:45 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id kd1sm46829552pab.20.2013.08.13.06.31.41 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:31:44 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH 3/3] cpufreq: sa11x0: Use generic cpufreq routines Date: Tue, 13 Aug 2013 19:01:07 +0530 Message-Id: <5b91eb45e3ee5517565d819ed2aa69f97b0fe351.1376392060.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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130813_093206_946412_C131D2E7 X-CRM114-Status: GOOD ( 14.27 ) X-Spam-Score: -1.9 (-) Cc: linaro-kernel@lists.linaro.org, linux@arm.linux.org.uk, linux-pm@vger.kernel.org, Viresh Kumar , patches@linaro.org, linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Most of the CPUFreq drivers do similar things in .exit() and .verify() routines and .attr. So its better if we have generic routines for them which can be used by cpufreq drivers then. This patch uses these generic routines for this driver. Signed-off-by: Viresh Kumar --- arch/arm/mach-sa1100/generic.c | 22 ---------------------- arch/arm/mach-sa1100/generic.h | 1 - drivers/cpufreq/sa1100-cpufreq.c | 2 +- drivers/cpufreq/sa1110-cpufreq.c | 2 +- 4 files changed, 2 insertions(+), 25 deletions(-) diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index 5c8167b..cb4b2ca 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c @@ -82,28 +82,6 @@ unsigned int sa11x0_ppcr_to_freq(unsigned int idx) return freq; } - -/* make sure that only the "userspace" governor is run -- anything else wouldn't make sense on - * this platform, anyway. - */ -int sa11x0_verify_speed(struct cpufreq_policy *policy) -{ - unsigned int tmp; - if (policy->cpu) - return -EINVAL; - - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); - - /* make sure that at least one frequency is within the policy */ - tmp = sa11x0_freq_table[sa11x0_freq_to_ppcr(policy->min)].frequency; - if (tmp > policy->max) - policy->max = tmp; - - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); - - return 0; -} - unsigned int sa11x0_getspeed(unsigned int cpu) { if (cpu) diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h index f5214ce..39d56a67 100644 --- a/arch/arm/mach-sa1100/generic.h +++ b/arch/arm/mach-sa1100/generic.h @@ -23,7 +23,6 @@ struct cpufreq_policy; extern struct cpufreq_frequency_table sa11x0_freq_table[]; extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz); -extern int sa11x0_verify_speed(struct cpufreq_policy *policy); extern unsigned int sa11x0_getspeed(unsigned int cpu); extern unsigned int sa11x0_ppcr_to_freq(unsigned int idx); diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c index 235500c..02fe8b2 100644 --- a/drivers/cpufreq/sa1100-cpufreq.c +++ b/drivers/cpufreq/sa1100-cpufreq.c @@ -228,7 +228,7 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver sa1100_driver __refdata = { .flags = CPUFREQ_STICKY, - .verify = sa11x0_verify_speed, + .verify = cpufreq_generic_frequency_table_verify, .target = sa1100_target, .get = sa11x0_getspeed, .init = sa1100_cpu_init, diff --git a/drivers/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c index 13760fc..a38d904 100644 --- a/drivers/cpufreq/sa1110-cpufreq.c +++ b/drivers/cpufreq/sa1110-cpufreq.c @@ -344,7 +344,7 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy) * it with cpufreq_register_driver() */ static struct cpufreq_driver sa1110_driver __refdata = { .flags = CPUFREQ_STICKY, - .verify = sa11x0_verify_speed, + .verify = cpufreq_generic_frequency_table_verify, .target = sa1110_target, .get = sa11x0_getspeed, .init = sa1110_cpu_init,