Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: use cpufreq_driver->flags to mark CPUFREQ_HAVE_GOVERNOR_PER_POLICY

Use cpufreq_driver->flags to mark CPUFREQ_HAVE_GOVERNOR_PER_POLICY instead
of a separate field within cpufreq_driver. This will save some bytes of
memory.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Viresh Kumar and committed by
Rafael J. Wysocki
0b981e70 6461f018

+15 -11
+2 -2
drivers/cpufreq/arm_big_little.c
··· 213 213 214 214 static struct cpufreq_driver bL_cpufreq_driver = { 215 215 .name = "arm-big-little", 216 - .flags = CPUFREQ_STICKY, 216 + .flags = CPUFREQ_STICKY | 217 + CPUFREQ_HAVE_GOVERNOR_PER_POLICY, 217 218 .verify = bL_cpufreq_verify_policy, 218 219 .target = bL_cpufreq_set_target, 219 220 .get = bL_cpufreq_get, 220 221 .init = bL_cpufreq_init, 221 222 .exit = bL_cpufreq_exit, 222 - .have_governor_per_policy = true, 223 223 .attr = bL_cpufreq_attr, 224 224 }; 225 225
+1 -1
drivers/cpufreq/cpufreq.c
··· 133 133 134 134 bool have_governor_per_policy(void) 135 135 { 136 - return cpufreq_driver->have_governor_per_policy; 136 + return !!(cpufreq_driver->flags & CPUFREQ_HAVE_GOVERNOR_PER_POLICY); 137 137 } 138 138 EXPORT_SYMBOL_GPL(have_governor_per_policy); 139 139
+4 -1
drivers/cpufreq/cpufreq_governor.h
··· 191 191 struct attribute_group *attr_group_gov_sys; /* one governor - system */ 192 192 struct attribute_group *attr_group_gov_pol; /* one governor - policy */ 193 193 194 - /* Common data for platforms that don't set have_governor_per_policy */ 194 + /* 195 + * Common data for platforms that don't set 196 + * CPUFREQ_HAVE_GOVERNOR_PER_POLICY 197 + */ 195 198 struct dbs_data *gdbs_data; 196 199 197 200 struct cpu_dbs_common_info *(*get_cpu_cdbs)(int cpu);
+8 -7
include/linux/cpufreq.h
··· 180 180 struct cpufreq_driver { 181 181 char name[CPUFREQ_NAME_LEN]; 182 182 u8 flags; 183 - /* 184 - * This should be set by platforms having multiple clock-domains, i.e. 185 - * supporting multiple policies. With this sysfs directories of governor 186 - * would be created in cpu/cpu<num>/cpufreq/ directory and so they can 187 - * use the same governor with different tunables for different clusters. 188 - */ 189 - bool have_governor_per_policy; 190 183 191 184 /* needed by all drivers */ 192 185 int (*init) (struct cpufreq_policy *policy); ··· 212 219 transitions */ 213 220 #define CPUFREQ_PM_NO_WARN (1 << 2) /* don't warn on suspend/resume 214 221 speed mismatches */ 222 + 223 + /* 224 + * This should be set by platforms having multiple clock-domains, i.e. 225 + * supporting multiple policies. With this sysfs directories of governor would 226 + * be created in cpu/cpu<num>/cpufreq/ directory and so they can use the same 227 + * governor with different tunables for different clusters. 228 + */ 229 + #define CPUFREQ_HAVE_GOVERNOR_PER_POLICY (1 << 3) 215 230 216 231 int cpufreq_register_driver(struct cpufreq_driver *driver_data); 217 232 int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);