From patchwork Fri Sep 13 13:00:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20131 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 302AA20358 for ; Fri, 13 Sep 2013 13:12:10 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id a41sf1235304yho.6 for ; Fri, 13 Sep 2013 06:12:09 -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=LCBeIZfQiAn7xU6mm4555Itss+piICTbKGdlNZ39wYQ=; b=VvcNHoZAsdGlTNKlMMB6Ug3wujCe5tcb8kpK+7TBrC4iE5FK1PiD2XiPvGgylaHR6A 0nZVat8gIVVypSTioHbgzAdGl2Vl/XxC5Q3VvYdSrkiUYcNsnDjoHCTy4xmdE+tehQOg IwFaPJfE62/q0+Gxh2ZTiRZxWzEdRLGY0Q+fD4HklnkTuXttgYHJwGNn1w9T2k+hhsBL jK1zRKMAd7/eikX2A69z38ddzpyy/V5g82DUc5IspbwXpomoxi0MFJSb0G0V1RF3dKCZ 0j1pmADXeLAxu7z8YT2ZkDAopT7fAoom5WzEHU75cFfxPYPC1L6HEoMx20Dv2zwVMwJa QLyQ== X-Gm-Message-State: ALoCoQkR4LVrlJDWJ5uTWdh91m2ipnRaxuRlHZcutMvm5OQ6istxSJhwg6RCrZi/e45x6HE5MEQL X-Received: by 10.236.223.130 with SMTP id v2mr5147274yhp.34.1379077929927; Fri, 13 Sep 2013 06:12:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.24.172 with SMTP id v12ls1184244qef.91.gmail; Fri, 13 Sep 2013 06:12:09 -0700 (PDT) X-Received: by 10.220.173.134 with SMTP id p6mr23916vcz.36.1379077929723; Fri, 13 Sep 2013 06:12:09 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id h2si3118276vcy.17.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:12:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 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.177; Received: by mail-vc0-f177.google.com with SMTP id gf12so881946vcb.36 for ; Fri, 13 Sep 2013 06:12:09 -0700 (PDT) X-Received: by 10.220.10.194 with SMTP id q2mr11815846vcq.2.1379077929613; Fri, 13 Sep 2013 06:12:09 -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 u4csp79903vcz; Fri, 13 Sep 2013 06:12:08 -0700 (PDT) X-Received: by 10.68.252.135 with SMTP id zs7mr1588121pbc.194.1379077928585; Fri, 13 Sep 2013 06:12:08 -0700 (PDT) Received: from mail-pb0-f51.google.com (mail-pb0-f51.google.com [209.85.160.51]) by mx.google.com with ESMTPS id xx2si11238235pac.24.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:12:08 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.51 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.160.51; Received: by mail-pb0-f51.google.com with SMTP id jt11so1213193pbb.24 for ; Fri, 13 Sep 2013 06:12:08 -0700 (PDT) X-Received: by 10.68.197.229 with SMTP id ix5mr1558520pbc.203.1379077928190; Fri, 13 Sep 2013 06:12:08 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id w6sm11675255pbt.32.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:12:07 -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 Subject: [PATCH 077/228] cpufreq: powernow: Use generic cpufreq routines Date: Fri, 13 Sep 2013 18:30:23 +0530 Message-Id: <8d9aac6f0ef4067fc3a4a51292f4f06b64ecbe24.1379063063.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.177 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: , 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 --- drivers/cpufreq/powernow-k6.c | 22 ++-------------------- drivers/cpufreq/powernow-k7.c | 14 ++------------ drivers/cpufreq/powernow-k8.c | 20 ++------------------ 3 files changed, 6 insertions(+), 50 deletions(-) diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index ab1de0d..ff05d28 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c @@ -105,19 +105,6 @@ static void powernow_k6_set_state(struct cpufreq_policy *policy, /** - * powernow_k6_verify - verifies a new CPUfreq policy - * @policy: new policy - * - * Policy must be within lowest and highest possible CPU Frequency, - * and at least one possible state must be within min and max. - */ -static int powernow_k6_verify(struct cpufreq_policy *policy) -{ - return cpufreq_frequency_table_verify(policy, &clock_ratio[0]); -} - - -/** * powernow_k6_setpolicy - sets a new CPUFreq policy * @policy: new policy * @target_freq: the target frequency @@ -188,19 +175,14 @@ static unsigned int powernow_k6_get(unsigned int cpu) return ret; } -static struct freq_attr *powernow_k6_attr[] = { - &cpufreq_freq_attr_scaling_available_freqs, - NULL, -}; - static struct cpufreq_driver powernow_k6_driver = { - .verify = powernow_k6_verify, + .verify = cpufreq_generic_frequency_table_verify, .target = powernow_k6_target, .init = powernow_k6_cpu_init, .exit = powernow_k6_cpu_exit, .get = powernow_k6_get, .name = "powernow-k6", - .attr = powernow_k6_attr, + .attr = cpufreq_generic_attr, }; static const struct x86_cpu_id powernow_k6_ids[] = { diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c index c863c13..14cd98f 100644 --- a/drivers/cpufreq/powernow-k7.c +++ b/drivers/cpufreq/powernow-k7.c @@ -549,11 +549,6 @@ static int powernow_target(struct cpufreq_policy *policy, } -static int powernow_verify(struct cpufreq_policy *policy) -{ - return cpufreq_frequency_table_verify(policy, powernow_table); -} - /* * We use the fact that the bus frequency is somehow * a multiple of 100000/3 khz, then we compute sgtc according @@ -699,13 +694,8 @@ static int powernow_cpu_exit(struct cpufreq_policy *policy) return 0; } -static struct freq_attr *powernow_table_attr[] = { - &cpufreq_freq_attr_scaling_available_freqs, - NULL, -}; - static struct cpufreq_driver powernow_driver = { - .verify = powernow_verify, + .verify = cpufreq_generic_frequency_table_verify, .target = powernow_target, .get = powernow_get, #ifdef CONFIG_X86_POWERNOW_K7_ACPI @@ -714,7 +704,7 @@ static struct cpufreq_driver powernow_driver = { .init = powernow_cpu_init, .exit = powernow_cpu_exit, .name = "powernow-k7", - .attr = powernow_table_attr, + .attr = cpufreq_generic_attr, }; static int __init powernow_init(void) diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 8bd8cdb..f054d5b 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c @@ -1073,17 +1073,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, return ret; } -/* Driver entry point to verify the policy and range of frequencies */ -static int powernowk8_verify(struct cpufreq_policy *pol) -{ - struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); - - if (!data) - return -EINVAL; - - return cpufreq_frequency_table_verify(pol, data->powernow_table); -} - struct init_on_cpu { struct powernow_k8_data *data; int rc; @@ -1245,21 +1234,16 @@ out: return khz; } -static struct freq_attr *powernow_k8_attr[] = { - &cpufreq_freq_attr_scaling_available_freqs, - NULL, -}; - static struct cpufreq_driver cpufreq_amd64_driver = { .flags = CPUFREQ_ASYNC_NOTIFICATION, - .verify = powernowk8_verify, + .verify = cpufreq_generic_frequency_table_verify, .target = powernowk8_target, .bios_limit = acpi_processor_get_bios_limit, .init = powernowk8_cpu_init, .exit = powernowk8_cpu_exit, .get = powernowk8_get, .name = "powernow-k8", - .attr = powernow_k8_attr, + .attr = cpufreq_generic_attr, }; static void __request_acpi_cpufreq(void)