From patchwork Wed May 18 12:25:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 68043 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2604739qge; Wed, 18 May 2016 05:26:14 -0700 (PDT) X-Received: by 10.67.22.168 with SMTP id ht8mr10671294pad.50.1463574370017; Wed, 18 May 2016 05:26:10 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 74si11901390pfp.87.2016.05.18.05.26.09; Wed, 18 May 2016 05:26:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753272AbcERM0A (ORCPT + 14 others); Wed, 18 May 2016 08:26:00 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:33383 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753222AbcERMZy (ORCPT ); Wed, 18 May 2016 08:25:54 -0400 Received: by mail-pa0-f42.google.com with SMTP id xk12so17579432pac.0 for ; Wed, 18 May 2016 05:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=uh4m/eOv4+WB3XY7vrtGvU4p8bT5M5vVjKXJFgIAp7Y=; b=EQU7fCNyuSv41v920Q26z6I4oF2E2iPG+ny/YD6Vln0FkB9Z0qlv0khkjO0AZspT4Y DlD1zXgzDXhZBYQc8v22vRcw8liqXNa6vXu3lCcgShirMdxp3JJyfGT05tYg4L58lc8M OkKsAgG6AcfXV33O521tNmTWf6/hKVBmeTmVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=uh4m/eOv4+WB3XY7vrtGvU4p8bT5M5vVjKXJFgIAp7Y=; b=SyQJdu4NK/rd2/LEk+N52w/mZbuRI2q90e6PoYM21xJ722CAUUgDE62x8MxWfqldP3 9dG1oZiefUAEy351JI76y1xSunJA45fEYv1G8Afwb3jdOndvkcBMcyNc/muktwgAJJ6A bK5yp6IpVpt7xLLXT4XkhICAeMapIXO1leFNkrZ/hogYg7hmnHiS4+azy+b6Efa9MHcJ be4ezAF4ycxRzGh7ADizYARx7hr/dtNR99m00VpRDRzpGkmgBcc/wmzrhTHvpZBIqfWx Kiu0kbEOZvcaF7y7QdI4sLZKpCecCGhfO048yP9waJR2z2AGGG7LxzhRBdxyUG69+MjW zbeg== X-Gm-Message-State: AOPr4FUdlcsOWMo2cbPkwc6R32xmOBBgfphodkXwpKkYq51s2Ygmm7eNWSmENIA5VbtIbo1n X-Received: by 10.67.1.233 with SMTP id bj9mr10601429pad.46.1463574354023; Wed, 18 May 2016 05:25:54 -0700 (PDT) Received: from localhost ([122.172.42.124]) by smtp.gmail.com with ESMTPSA id ry2sm12130713pac.9.2016.05.18.05.25.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 May 2016 05:25:53 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Ingo Molnar , Peter Zijlstra Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] cpufreq: Reuse gov_attr_* macros in schedutil governor Date: Wed, 18 May 2016 17:55:30 +0530 Message-Id: <8db591e521218af3c4b21ccc0d50606bfbde106b.1463574213.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org These macros can be used by governors which don't use the common governor code present in cpufreq_governor.c and should be moved to the relevant header. Now that they are getting moved to the right header file, reuse them in schedutil governor as well (that required rename of show/store routines). Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_governor.h | 8 -------- include/linux/cpufreq.h | 8 ++++++++ kernel/sched/cpufreq_schedutil.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 34eb214b6d57..e2bc5281d3b7 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -70,14 +70,6 @@ static ssize_t show_##file_name \ return sprintf(buf, "%u\n", dbs_data->file_name); \ } -#define gov_attr_ro(_name) \ -static struct governor_attr _name = \ -__ATTR(_name, 0444, show_##_name, NULL) - -#define gov_attr_rw(_name) \ -static struct governor_attr _name = \ -__ATTR(_name, 0644, show_##_name, store_##_name) - /* Common to all CPUs of a policy */ struct policy_dbs_info { struct cpufreq_policy *policy; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 4e81e08db752..fe4c48b0fa40 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -501,6 +501,14 @@ struct gov_attr_set { int usage_count; }; +#define gov_attr_ro(_name) \ +static struct governor_attr _name = \ +__ATTR(_name, 0444, show_##_name, NULL) + +#define gov_attr_rw(_name) \ +static struct governor_attr _name = \ +__ATTR(_name, 0644, show_##_name, store_##_name) + /* sysfs ops for cpufreq governors */ extern const struct sysfs_ops governor_sysfs_ops; diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 14c4aa25cc45..4035765deafc 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -243,15 +243,15 @@ static inline struct sugov_tunables *to_sugov_tunables(struct gov_attr_set *attr return container_of(attr_set, struct sugov_tunables, attr_set); } -static ssize_t rate_limit_us_show(struct gov_attr_set *attr_set, char *buf) +static ssize_t show_rate_limit_us(struct gov_attr_set *attr_set, char *buf) { struct sugov_tunables *tunables = to_sugov_tunables(attr_set); return sprintf(buf, "%u\n", tunables->rate_limit_us); } -static ssize_t rate_limit_us_store(struct gov_attr_set *attr_set, const char *buf, - size_t count) +static ssize_t store_rate_limit_us(struct gov_attr_set *attr_set, + const char *buf, size_t count) { struct sugov_tunables *tunables = to_sugov_tunables(attr_set); struct sugov_policy *sg_policy; @@ -268,7 +268,7 @@ static ssize_t rate_limit_us_store(struct gov_attr_set *attr_set, const char *bu return count; } -static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us); +gov_attr_rw(rate_limit_us); static struct attribute *sugov_attributes[] = { &rate_limit_us.attr,