[PATCH 54/89] sched/headers: Make the include/linux/sched/*.h headers build standalone

From: Ingo Molnar
Date: Mon Feb 06 2017 - 08:31:19 EST


Make each header self-sufficient, so that it can be built successfully
both in an allnoconfig and allyesconfig kernel.

Also standardize the naming of their header guards.

Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Mike Galbraith <efault@xxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
include/linux/sched/autogroup.h | 1 +
include/linux/sched/clock.h | 2 ++
include/linux/sched/cpufreq.h | 2 ++
include/linux/sched/deadline.h | 8 +++++---
include/linux/sched/idle.h | 2 ++
include/linux/sched/jobctl.h | 4 ++++
include/linux/sched/prio.h | 6 +++---
include/linux/sched/rt.h | 10 ++++++----
include/linux/sched/stat.h | 2 ++
include/linux/sched/sysctl.h | 10 +++++++---
include/linux/sched/user.h | 1 +
include/linux/sched/wake_q.h | 3 +++
12 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/include/linux/sched/autogroup.h b/include/linux/sched/autogroup.h
index d4dc91da7479..c0810fe196f4 100644
--- a/include/linux/sched/autogroup.h
+++ b/include/linux/sched/autogroup.h
@@ -2,6 +2,7 @@
#define _LINUX_SCHED_AUTOGROUP_H

struct signal_struct;
+struct task_struct;
struct seq_file;

#ifdef CONFIG_SCHED_AUTOGROUP
diff --git a/include/linux/sched/clock.h b/include/linux/sched/clock.h
index 18677fc2ffb3..4a68c6791207 100644
--- a/include/linux/sched/clock.h
+++ b/include/linux/sched/clock.h
@@ -1,6 +1,8 @@
#ifndef _LINUX_SCHED_CLOCK_H
#define _LINUX_SCHED_CLOCK_H

+#include <linux/smp.h>
+
/*
* Do not use outside of architecture code which knows its limitations.
*
diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h
index 9b846476d812..d2be2ccbb372 100644
--- a/include/linux/sched/cpufreq.h
+++ b/include/linux/sched/cpufreq.h
@@ -1,6 +1,8 @@
#ifndef _LINUX_SCHED_CPUFREQ_H
#define _LINUX_SCHED_CPUFREQ_H

+#include <linux/types.h>
+
/*
* Interface between cpufreq drivers and the scheduler:
*/
diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h
index 9089a2ae913d..975be862e083 100644
--- a/include/linux/sched/deadline.h
+++ b/include/linux/sched/deadline.h
@@ -1,5 +1,7 @@
-#ifndef _SCHED_DEADLINE_H
-#define _SCHED_DEADLINE_H
+#ifndef _LINUX_SCHED_DEADLINE_H
+#define _LINUX_SCHED_DEADLINE_H
+
+#include <linux/sched.h>

/*
* SCHED_DEADLINE tasks has negative priorities, reflecting
@@ -26,4 +28,4 @@ static inline bool dl_time_before(u64 a, u64 b)
return (s64)(a - b) < 0;
}

-#endif /* _SCHED_DEADLINE_H */
+#endif /* _LINUX_SCHED_DEADLINE_H */
diff --git a/include/linux/sched/idle.h b/include/linux/sched/idle.h
index dabd62394af4..5ca63ebad6b4 100644
--- a/include/linux/sched/idle.h
+++ b/include/linux/sched/idle.h
@@ -1,6 +1,8 @@
#ifndef _LINUX_SCHED_IDLE_H
#define _LINUX_SCHED_IDLE_H

+#include <linux/sched.h>
+
enum cpu_idle_type {
CPU_IDLE,
CPU_NOT_IDLE,
diff --git a/include/linux/sched/jobctl.h b/include/linux/sched/jobctl.h
index d8cbf44fe16b..016afa0fb3bb 100644
--- a/include/linux/sched/jobctl.h
+++ b/include/linux/sched/jobctl.h
@@ -1,6 +1,10 @@
#ifndef _LINUX_SCHED_JOBCTL_H
#define _LINUX_SCHED_JOBCTL_H

+#include <linux/types.h>
+
+struct task_struct;
+
/*
* task->jobctl flags
*/
diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
index d9cf5a5762d9..2cc450f6ec54 100644
--- a/include/linux/sched/prio.h
+++ b/include/linux/sched/prio.h
@@ -1,5 +1,5 @@
-#ifndef _SCHED_PRIO_H
-#define _SCHED_PRIO_H
+#ifndef _LINUX_SCHED_PRIO_H
+#define _LINUX_SCHED_PRIO_H

#define MAX_NICE 19
#define MIN_NICE -20
@@ -57,4 +57,4 @@ static inline long rlimit_to_nice(long prio)
return (MAX_NICE - prio + 1);
}

-#endif /* _SCHED_PRIO_H */
+#endif /* _LINUX_SCHED_PRIO_H */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index a30b172df6e1..3bd668414f61 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -1,7 +1,9 @@
-#ifndef _SCHED_RT_H
-#define _SCHED_RT_H
+#ifndef _LINUX_SCHED_RT_H
+#define _LINUX_SCHED_RT_H

-#include <linux/sched/prio.h>
+#include <linux/sched.h>
+
+struct task_struct;

static inline int rt_prio(int prio)
{
@@ -57,4 +59,4 @@ extern void normalize_rt_tasks(void);
*/
#define RR_TIMESLICE (100 * HZ / 1000)

-#endif /* _SCHED_RT_H */
+#endif /* _LINUX_SCHED_RT_H */
diff --git a/include/linux/sched/stat.h b/include/linux/sched/stat.h
index 1a1df11d1d70..851bc8639620 100644
--- a/include/linux/sched/stat.h
+++ b/include/linux/sched/stat.h
@@ -1,6 +1,8 @@
#ifndef _LINUX_SCHED_STAT_H
#define _LINUX_SCHED_STAT_H

+#include <linux/percpu.h>
+
/*
* Various counters maintained by the scheduler and fork(),
* exposed via /proc, sys.c or used by drivers via these APIs.
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 49308e142aae..0f5ecd4d298e 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -1,5 +1,9 @@
-#ifndef _SCHED_SYSCTL_H
-#define _SCHED_SYSCTL_H
+#ifndef _LINUX_SCHED_SYSCTL_H
+#define _LINUX_SCHED_SYSCTL_H
+
+#include <linux/types.h>
+
+struct ctl_table;

#ifdef CONFIG_DETECT_HUNG_TASK
extern int sysctl_hung_task_check_count;
@@ -78,4 +82,4 @@ extern int sysctl_schedstats(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos);

-#endif /* _SCHED_SYSCTL_H */
+#endif /* _LINUX_SCHED_SYSCTL_H */
diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h
index 7b615b61a0dc..47600dd62ded 100644
--- a/include/linux/sched/user.h
+++ b/include/linux/sched/user.h
@@ -2,6 +2,7 @@
#define _LINUX_SCHED_USER_H

#include <linux/uidgid.h>
+#include <linux/atomic.h>

struct key;

diff --git a/include/linux/sched/wake_q.h b/include/linux/sched/wake_q.h
index 9a32f17b6a5e..e6774a0385fb 100644
--- a/include/linux/sched/wake_q.h
+++ b/include/linux/sched/wake_q.h
@@ -27,6 +27,9 @@
* must ensure the call is done inside a loop, confirming that the
* wakeup condition has in fact occurred.
*/
+
+struct task_struct;
+
struct wake_q_node {
struct wake_q_node *next;
};
--
2.7.4