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

cpufreq: Clean up header files included in the core

This patch addresses the following issues in the header files in the
cpufreq core:
- Include headers in ascending order, so that we don't add same
many times by mistake.
- <asm/> must be included after <linux/>, so that they override
whatever they need to.
- Remove unnecessary includes.
- Don't include files already included by cpufreq.h or
cpufreq_governor.h.

[rjw: Changelog]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Viresh Kumar and committed by
Rafael J. Wysocki
5ff0a268 1133bfa6

+17 -69
+6 -13
drivers/cpufreq/cpufreq.c
··· 17 17 18 18 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 19 19 20 - #include <asm/cputime.h> 21 - #include <linux/kernel.h> 22 - #include <linux/kernel_stat.h> 23 - #include <linux/module.h> 24 - #include <linux/init.h> 25 - #include <linux/notifier.h> 20 + #include <linux/cpu.h> 26 21 #include <linux/cpufreq.h> 27 22 #include <linux/delay.h> 28 - #include <linux/interrupt.h> 29 - #include <linux/spinlock.h> 30 - #include <linux/tick.h> 31 23 #include <linux/device.h> 32 - #include <linux/slab.h> 33 - #include <linux/cpu.h> 34 - #include <linux/completion.h> 24 + #include <linux/init.h> 25 + #include <linux/kernel_stat.h> 26 + #include <linux/module.h> 35 27 #include <linux/mutex.h> 28 + #include <linux/slab.h> 36 29 #include <linux/syscore_ops.h> 37 - 30 + #include <linux/tick.h> 38 31 #include <trace/events/power.h> 39 32 40 33 /**
-12
drivers/cpufreq/cpufreq_conservative.c
··· 11 11 * published by the Free Software Foundation. 12 12 */ 13 13 14 - #include <linux/cpufreq.h> 15 - #include <linux/init.h> 16 - #include <linux/kernel.h> 17 - #include <linux/kernel_stat.h> 18 - #include <linux/kobject.h> 19 - #include <linux/module.h> 20 - #include <linux/mutex.h> 21 - #include <linux/notifier.h> 22 - #include <linux/percpu-defs.h> 23 14 #include <linux/slab.h> 24 - #include <linux/sysfs.h> 25 - #include <linux/types.h> 26 - 27 15 #include "cpufreq_governor.h" 28 16 29 17 /* Conservative governor macros */
-6
drivers/cpufreq/cpufreq_governor.c
··· 16 16 17 17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 18 18 19 - #include <asm/cputime.h> 20 - #include <linux/cpufreq.h> 21 - #include <linux/cpumask.h> 22 19 #include <linux/export.h> 23 20 #include <linux/kernel_stat.h> 24 - #include <linux/mutex.h> 25 21 #include <linux/slab.h> 26 - #include <linux/types.h> 27 - #include <linux/workqueue.h> 28 22 29 23 #include "cpufreq_governor.h" 30 24
+2 -3
drivers/cpufreq/cpufreq_governor.h
··· 18 18 #define _CPUFREQ_GOVERNOR_H 19 19 20 20 #include <linux/cpufreq.h> 21 - #include <linux/kobject.h> 21 + #include <linux/kernel_stat.h> 22 + #include <linux/module.h> 22 23 #include <linux/mutex.h> 23 - #include <linux/workqueue.h> 24 - #include <linux/sysfs.h> 25 24 26 25 /* 27 26 * The polling frequency depends on the capability of the processor. Default
+1 -11
drivers/cpufreq/cpufreq_ondemand.c
··· 12 12 13 13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 14 14 15 - #include <linux/cpufreq.h> 16 - #include <linux/init.h> 17 - #include <linux/kernel.h> 18 - #include <linux/kernel_stat.h> 19 - #include <linux/kobject.h> 20 - #include <linux/module.h> 21 - #include <linux/mutex.h> 15 + #include <linux/cpu.h> 22 16 #include <linux/percpu-defs.h> 23 17 #include <linux/slab.h> 24 - #include <linux/sysfs.h> 25 18 #include <linux/tick.h> 26 - #include <linux/types.h> 27 - #include <linux/cpu.h> 28 - 29 19 #include "cpufreq_governor.h" 30 20 31 21 /* On-demand governor macros */
+1 -2
drivers/cpufreq/cpufreq_performance.c
··· 12 12 13 13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 14 14 15 - #include <linux/kernel.h> 16 - #include <linux/module.h> 17 15 #include <linux/cpufreq.h> 18 16 #include <linux/init.h> 17 + #include <linux/module.h> 19 18 20 19 static int cpufreq_governor_performance(struct cpufreq_policy *policy, 21 20 unsigned int event)
+1 -2
drivers/cpufreq/cpufreq_powersave.c
··· 12 12 13 13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 14 14 15 - #include <linux/kernel.h> 16 - #include <linux/module.h> 17 15 #include <linux/cpufreq.h> 18 16 #include <linux/init.h> 17 + #include <linux/module.h> 19 18 20 19 static int cpufreq_governor_powersave(struct cpufreq_policy *policy, 21 20 unsigned int event)
+1 -8
drivers/cpufreq/cpufreq_stats.c
··· 9 9 * published by the Free Software Foundation. 10 10 */ 11 11 12 - #include <linux/kernel.h> 13 - #include <linux/slab.h> 14 12 #include <linux/cpu.h> 15 - #include <linux/sysfs.h> 16 13 #include <linux/cpufreq.h> 17 14 #include <linux/module.h> 18 - #include <linux/jiffies.h> 19 - #include <linux/percpu.h> 20 - #include <linux/kobject.h> 21 - #include <linux/spinlock.h> 22 - #include <linux/notifier.h> 15 + #include <linux/slab.h> 23 16 #include <asm/cputime.h> 24 17 25 18 static spinlock_t cpufreq_stats_lock;
+1 -3
drivers/cpufreq/freq_table.c
··· 11 11 12 12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 13 13 14 - #include <linux/kernel.h> 15 - #include <linux/module.h> 16 - #include <linux/init.h> 17 14 #include <linux/cpufreq.h> 15 + #include <linux/module.h> 18 16 19 17 /********************************************************************* 20 18 * FREQUENCY TABLE HELPERS *
+4 -9
include/linux/cpufreq.h
··· 11 11 #ifndef _LINUX_CPUFREQ_H 12 12 #define _LINUX_CPUFREQ_H 13 13 14 - #include <asm/cputime.h> 15 - #include <linux/mutex.h> 16 - #include <linux/notifier.h> 17 - #include <linux/threads.h> 18 - #include <linux/kobject.h> 19 - #include <linux/sysfs.h> 20 - #include <linux/completion.h> 21 - #include <linux/workqueue.h> 22 14 #include <linux/cpumask.h> 23 - #include <asm/div64.h> 15 + #include <linux/completion.h> 16 + #include <linux/kobject.h> 17 + #include <linux/notifier.h> 18 + #include <linux/sysfs.h> 24 19 25 20 #define CPUFREQ_NAME_LEN 16 26 21 /* Print length for names. Extra 1 space for accomodating '\n' in prints */