From patchwork Mon Mar 4 07:37:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2211001 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id ACF45DF2F2 for ; Mon, 4 Mar 2013 07:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755052Ab3CDHi5 (ORCPT ); Mon, 4 Mar 2013 02:38:57 -0500 Received: from mail-da0-f47.google.com ([209.85.210.47]:58691 "EHLO mail-da0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755155Ab3CDHi2 (ORCPT ); Mon, 4 Mar 2013 02:38:28 -0500 Received: by mail-da0-f47.google.com with SMTP id s35so2411169dak.34 for ; Sun, 03 Mar 2013 23:38:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-gm-message-state; bh=GwjjxKpxNUuFxMyFoSuWGO7hl2R8TBK7588ZUUdewfE=; b=E9XKYZC0+M2OyntDe8KkXYuxCqr3Mp/vZCJJcNrZ4XwXcpD6YlNZIeVXQJ52cwsKNp sgZRsZkzNXz+L0OzK4HcSsoY9u6vjiO2xQQBtN89oEuNt0MCvRXIWmV/vFOSiiBBc7pX 5/QxsQd4pCHEPiMquANySqr7np9x2DzQtoPP7VAeYncVoQ/IjXpzZYuLOWGfR6OBnOaL Dwo39MSTk1dWC2Es+huKS1tgZNzS8Ez+HL1MII0RwRkSC1ZZHHpRQ7HUJx8npc6ZHdXY uKRhwA1rR+gWPPZE3NLKiy0URK/8fcZYdSadbiswMsDo/vC1o6rMyHjs6etiMPcMTkCH gY5w== X-Received: by 10.68.25.201 with SMTP id e9mr26570253pbg.145.1362382707890; Sun, 03 Mar 2013 23:38:27 -0800 (PST) Received: from localhost ([118.143.64.134]) by mx.google.com with ESMTPS id e6sm22941066paw.16.2013.03.03.23.38.23 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 03 Mar 2013 23:38:27 -0800 (PST) From: Viresh Kumar To: rjw@sisk.pl Cc: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, robin.randhawa@arm.com, Steve.Bannister@arm.com, Liviu.Dudau@arm.com, charles.garcia-tobin@arm.com, Viresh Kumar Subject: [PATCH V3 3/4] cpufreq: Get rid of "struct global_attr" Date: Mon, 4 Mar 2013 15:37:55 +0800 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQnN4UPUJPQY3+M6lLpvnVbwz7S/+ZQGFFrMG8/2n0g59UI/q2gVuLEWRkE1MMwkmzzIDOWj Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org We don't need to keep two structures for file attributes, global_attr and freq_attr. Lets use freq_attr only for cpufreq core and drivers. Signed-off-by: Viresh Kumar --- drivers/cpufreq/acpi-cpufreq.c | 9 ++++----- drivers/cpufreq/intel_pstate.c | 20 ++++++++++---------- include/linux/cpufreq.h | 16 ---------------- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 937bc28..14219c3 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -160,19 +160,18 @@ static ssize_t _store_boost(const char *buf, size_t count) return count; } -static ssize_t store_global_boost(struct kobject *kobj, struct attribute *attr, - const char *buf, size_t count) +static ssize_t store_global_boost(struct cpufreq_policy *policy, + const char *buf, size_t count) { return _store_boost(buf, count); } -static ssize_t show_global_boost(struct kobject *kobj, - struct attribute *attr, char *buf) +static ssize_t show_global_boost(struct cpufreq_policy *policy, char *buf) { return sprintf(buf, "%u\n", boost_enabled); } -static struct global_attr global_boost = __ATTR(boost, 0644, +static struct freq_attr global_boost = __ATTR(boost, 0644, show_global_boost, store_global_boost); diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 096fde0..49846b9 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -275,13 +275,13 @@ static void intel_pstate_debug_expose_params(void) /************************** sysfs begin ************************/ #define show_one(file_name, object) \ static ssize_t show_##file_name \ - (struct kobject *kobj, struct attribute *attr, char *buf) \ + (struct cpufreq_policy *policy, char *buf) \ { \ return sprintf(buf, "%u\n", limits.object); \ } -static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, - const char *buf, size_t count) +static ssize_t store_no_turbo(struct cpufreq_policy *policy, const char *buf, + size_t count) { unsigned int input; int ret; @@ -293,8 +293,8 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, return count; } -static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, - const char *buf, size_t count) +static ssize_t store_max_perf_pct(struct cpufreq_policy *policy, + const char *buf, size_t count) { unsigned int input; int ret; @@ -307,8 +307,8 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, return count; } -static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, - const char *buf, size_t count) +static ssize_t store_min_perf_pct(struct cpufreq_policy *policy, + const char *buf, size_t count) { unsigned int input; int ret; @@ -325,9 +325,9 @@ show_one(no_turbo, no_turbo); show_one(max_perf_pct, max_perf_pct); show_one(min_perf_pct, min_perf_pct); -define_one_global_rw(no_turbo); -define_one_global_rw(max_perf_pct); -define_one_global_rw(min_perf_pct); +cpufreq_freq_attr_rw(no_turbo); +cpufreq_freq_attr_rw(max_perf_pct); +cpufreq_freq_attr_rw(min_perf_pct); static struct attribute *intel_pstate_attributes[] = { &no_turbo.attr, diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index c5ac9a5..6e1abd2 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -320,22 +320,6 @@ __ATTR(_name, _perm, show_##_name, NULL) static struct freq_attr _name = \ __ATTR(_name, 0644, show_##_name, store_##_name) -struct global_attr { - struct attribute attr; - ssize_t (*show)(struct kobject *kobj, - struct attribute *attr, char *buf); - ssize_t (*store)(struct kobject *a, struct attribute *b, - const char *c, size_t count); -}; - -#define define_one_global_ro(_name) \ -static struct global_attr _name = \ -__ATTR(_name, 0444, show_##_name, NULL) - -#define define_one_global_rw(_name) \ -static struct global_attr _name = \ -__ATTR(_name, 0644, show_##_name, store_##_name) - struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); void cpufreq_cpu_put(struct cpufreq_policy *data); const char *cpufreq_get_current_driver(void);