aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-04-02 05:26:06 -0400
committerIngo Molnar <mingo@kernel.org>2015-04-02 05:26:35 -0400
commit3ae7a939165c6159afb3c09e1d7405b6d1807f2b (patch)
treec01c29975001cbe24d2d9dd17d3f0b3ad90cd8ae /kernel
parent7270d11c56f594af4d166b2988421cd8ed933dc1 (diff)
tick: Further simplify tick-internal.h
Move the broadcasting related section to the GENERIC_CLOCKEVENTS=y section - this also solves build failures on architectures that don't use generic clockevents yet. Also standardize include file style to make it easier to read, and use nesting depth aware preprocessor directives to make future merges easier. Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/tick-internal.h79
1 files changed, 40 insertions, 39 deletions
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 5fc2dafabd58..b6ba0a44e740 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -9,8 +9,8 @@
9 9
10#ifdef CONFIG_GENERIC_CLOCKEVENTS 10#ifdef CONFIG_GENERIC_CLOCKEVENTS
11 11
12#define TICK_DO_TIMER_NONE -1 12# define TICK_DO_TIMER_NONE -1
13#define TICK_DO_TIMER_BOOT -2 13# define TICK_DO_TIMER_BOOT -2
14 14
15DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 15DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
16extern ktime_t tick_next_period; 16extern ktime_t tick_next_period;
@@ -47,41 +47,9 @@ extern int clockevents_program_event(struct clock_event_device *dev,
47extern void clockevents_handle_noop(struct clock_event_device *dev); 47extern void clockevents_handle_noop(struct clock_event_device *dev);
48extern int __clockevents_update_freq(struct clock_event_device *dev, u32 freq); 48extern int __clockevents_update_freq(struct clock_event_device *dev, u32 freq);
49extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt); 49extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt);
50#else
51static inline void tick_suspend(void) { }
52static inline void tick_resume(void) { }
53#endif /* GENERIC_CLOCKEVENTS */
54
55/* Oneshot related functions */
56#ifdef CONFIG_TICK_ONESHOT
57extern void tick_setup_oneshot(struct clock_event_device *newdev,
58 void (*handler)(struct clock_event_device *),
59 ktime_t nextevt);
60extern int tick_program_event(ktime_t expires, int force);
61extern void tick_oneshot_notify(void);
62extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
63extern void tick_resume_oneshot(void);
64static inline bool tick_oneshot_possible(void) { return true; }
65extern int tick_oneshot_mode_active(void);
66extern void tick_clock_notify(void);
67extern int tick_check_oneshot_change(int allow_nohz);
68extern int tick_init_highres(void);
69#else /* !ONESHOT */
70static inline
71void tick_setup_oneshot(struct clock_event_device *newdev,
72 void (*handler)(struct clock_event_device *),
73 ktime_t nextevt) { BUG(); }
74static inline void tick_resume_oneshot(void) { BUG(); }
75static inline int tick_program_event(ktime_t expires, int force) { return 0; }
76static inline void tick_oneshot_notify(void) { }
77static inline bool tick_oneshot_possible(void) { return false; }
78static inline int tick_oneshot_mode_active(void) { return 0; }
79static inline void tick_clock_notify(void) { }
80static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
81#endif /* !TICK_ONESHOT */
82 50
83/* Broadcasting support */ 51/* Broadcasting support */
84#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 52# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
85extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu); 53extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
86extern void tick_install_broadcast_device(struct clock_event_device *dev); 54extern void tick_install_broadcast_device(struct clock_event_device *dev);
87extern int tick_is_broadcast_device(struct clock_event_device *dev); 55extern int tick_is_broadcast_device(struct clock_event_device *dev);
@@ -95,7 +63,7 @@ extern void tick_set_periodic_handler(struct clock_event_device *dev, int broadc
95extern int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq); 63extern int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq);
96extern struct tick_device *tick_get_broadcast_device(void); 64extern struct tick_device *tick_get_broadcast_device(void);
97extern struct cpumask *tick_get_broadcast_mask(void); 65extern struct cpumask *tick_get_broadcast_mask(void);
98#else /* !BROADCAST */ 66# else /* !CONFIG_GENERIC_CLOCKEVENTS_BROADCAST: */
99static inline void tick_install_broadcast_device(struct clock_event_device *dev) { } 67static inline void tick_install_broadcast_device(struct clock_event_device *dev) { }
100static inline int tick_is_broadcast_device(struct clock_event_device *dev) { return 0; } 68static inline int tick_is_broadcast_device(struct clock_event_device *dev) { return 0; }
101static inline int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu) { return 0; } 69static inline int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu) { return 0; }
@@ -113,7 +81,40 @@ static inline void tick_set_periodic_handler(struct clock_event_device *dev, int
113{ 81{
114 dev->event_handler = tick_handle_periodic; 82 dev->event_handler = tick_handle_periodic;
115} 83}
116#endif /* !BROADCAST */ 84# endif /* !CONFIG_GENERIC_CLOCKEVENTS_BROADCAST */
85
86#else /* !GENERIC_CLOCKEVENTS: */
87static inline void tick_suspend(void) { }
88static inline void tick_resume(void) { }
89#endif /* !GENERIC_CLOCKEVENTS */
90
91/* Oneshot related functions */
92#ifdef CONFIG_TICK_ONESHOT
93extern void tick_setup_oneshot(struct clock_event_device *newdev,
94 void (*handler)(struct clock_event_device *),
95 ktime_t nextevt);
96extern int tick_program_event(ktime_t expires, int force);
97extern void tick_oneshot_notify(void);
98extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
99extern void tick_resume_oneshot(void);
100static inline bool tick_oneshot_possible(void) { return true; }
101extern int tick_oneshot_mode_active(void);
102extern void tick_clock_notify(void);
103extern int tick_check_oneshot_change(int allow_nohz);
104extern int tick_init_highres(void);
105#else /* !CONFIG_TICK_ONESHOT: */
106static inline
107void tick_setup_oneshot(struct clock_event_device *newdev,
108 void (*handler)(struct clock_event_device *),
109 ktime_t nextevt) { BUG(); }
110static inline void tick_resume_oneshot(void) { BUG(); }
111static inline int tick_program_event(ktime_t expires, int force) { return 0; }
112static inline void tick_oneshot_notify(void) { }
113static inline bool tick_oneshot_possible(void) { return false; }
114static inline int tick_oneshot_mode_active(void) { return 0; }
115static inline void tick_clock_notify(void) { }
116static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
117#endif /* !CONFIG_TICK_ONESHOT */
117 118
118/* Functions related to oneshot broadcasting */ 119/* Functions related to oneshot broadcasting */
119#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) 120#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
@@ -125,7 +126,7 @@ extern int tick_broadcast_oneshot_active(void);
125extern void tick_check_oneshot_broadcast_this_cpu(void); 126extern void tick_check_oneshot_broadcast_this_cpu(void);
126bool tick_broadcast_oneshot_available(void); 127bool tick_broadcast_oneshot_available(void);
127extern struct cpumask *tick_get_broadcast_oneshot_mask(void); 128extern struct cpumask *tick_get_broadcast_oneshot_mask(void);
128#else /* BROADCAST && ONESHOT */ 129#else /* !(BROADCAST && ONESHOT): */
129static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } 130static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); }
130static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; } 131static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
131static inline void tick_broadcast_switch_to_oneshot(void) { } 132static inline void tick_broadcast_switch_to_oneshot(void) { }
@@ -133,7 +134,7 @@ static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
133static inline int tick_broadcast_oneshot_active(void) { return 0; } 134static inline int tick_broadcast_oneshot_active(void) { return 0; }
134static inline void tick_check_oneshot_broadcast_this_cpu(void) { } 135static inline void tick_check_oneshot_broadcast_this_cpu(void) { }
135static inline bool tick_broadcast_oneshot_available(void) { return tick_oneshot_possible(); } 136static inline bool tick_broadcast_oneshot_available(void) { return tick_oneshot_possible(); }
136#endif /* !BROADCAST && ONESHOT */ 137#endif /* !(BROADCAST && ONESHOT) */
137 138
138/* NO_HZ_FULL internal */ 139/* NO_HZ_FULL internal */
139#ifdef CONFIG_NO_HZ_FULL 140#ifdef CONFIG_NO_HZ_FULL