aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq_governor.h
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-02-09 09:01:31 +0530
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-03-09 14:40:57 +0100
commitd0684d3b8934cfb8171755cdb1fc87f4c0335655 (patch)
treec0fd5e5e119c87f38e66c89cef5a879f40d12d80 /drivers/cpufreq/cpufreq_governor.h
parentcpufreq: governor: Drop pointless goto from cpufreq_governor_init() (diff)
downloadlinux-dev-d0684d3b8934cfb8171755cdb1fc87f4c0335655.tar.xz
linux-dev-d0684d3b8934cfb8171755cdb1fc87f4c0335655.zip
cpufreq: governor: Create generic macro for common tunables
Some tunables are present in governor-specific structures, whereas one (min_sampling_rate) is located directly in struct dbs_data. There is a special macro for creating its sysfs attribute and the show/store callbacks, but since more tunables are going to be moved to struct dbs_data, a new generic macro for such cases will be useful, so add it and use it for min_sampling_rate. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Juri Lelli <juri.lelli@arm.com> Tested-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> [ rjw: Subject & changelog ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_governor.h')
-rw-r--r--drivers/cpufreq/cpufreq_governor.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index 37537220e48c..cdf7536ac5fb 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -110,6 +110,26 @@ static ssize_t store_##file_name##_gov_pol \
show_one(_gov, file_name); \
store_one(_gov, file_name)
+#define show_one_common(_gov, file_name) \
+static ssize_t show_##file_name##_gov_sys \
+(struct kobject *kobj, struct attribute *attr, char *buf) \
+{ \
+ struct dbs_data *dbs_data = _gov##_dbs_gov.gdbs_data; \
+ return sprintf(buf, "%u\n", dbs_data->file_name); \
+} \
+ \
+static ssize_t show_##file_name##_gov_pol \
+(struct cpufreq_policy *policy, char *buf) \
+{ \
+ struct policy_dbs_info *policy_dbs = policy->governor_data; \
+ struct dbs_data *dbs_data = policy_dbs->dbs_data; \
+ return sprintf(buf, "%u\n", dbs_data->file_name); \
+}
+
+#define show_store_one_common(_gov, file_name) \
+show_one_common(_gov, file_name); \
+store_one(_gov, file_name)
+
/* create helper routines */
#define define_get_cpu_dbs_routines(_dbs_info) \
static struct cpu_dbs_info *get_cpu_cdbs(int cpu) \
@@ -264,22 +284,6 @@ static inline int delay_for_sampling_rate(unsigned int sampling_rate)
return delay;
}
-#define declare_show_sampling_rate_min(_gov) \
-static ssize_t show_sampling_rate_min_gov_sys \
-(struct kobject *kobj, struct attribute *attr, char *buf) \
-{ \
- struct dbs_data *dbs_data = _gov##_dbs_gov.gdbs_data; \
- return sprintf(buf, "%u\n", dbs_data->min_sampling_rate); \
-} \
- \
-static ssize_t show_sampling_rate_min_gov_pol \
-(struct cpufreq_policy *policy, char *buf) \
-{ \
- struct policy_dbs_info *policy_dbs = policy->governor_data; \
- struct dbs_data *dbs_data = policy_dbs->dbs_data; \
- return sprintf(buf, "%u\n", dbs_data->min_sampling_rate); \
-}
-
extern struct mutex dbs_data_mutex;
extern struct mutex cpufreq_governor_lock;
void dbs_check_cpu(struct cpufreq_policy *policy);