aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-03-25 08:06:47 -0400
committerIngo Molnar <mingo@kernel.org>2015-04-01 08:22:58 -0400
commitb7475eb599ddb2e8cab2dc86ff38a9507463ad6b (patch)
tree2fe390d7e2444e71297445230006dde7da24dce2 /kernel/time
parentbfb83b27519aa7ed9510f601a8f825a2c1484bc2 (diff)
tick: Simplify tick-internal.h
tick-internal.h is pretty confusing as a lot of the stub inlines are there several times. Distangle the maze and make clear functional sections. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> [ rjw: Subject ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/16068264.vcNp79HLaT@vostro.rjw.lan Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/tick-internal.h145
1 files changed, 49 insertions, 96 deletions
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index cba52140a298..d86eb8d485e9 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -27,14 +27,19 @@ extern bool tick_check_replacement(struct clock_event_device *curdev,
27 struct clock_event_device *newdev); 27 struct clock_event_device *newdev);
28extern void tick_install_replacement(struct clock_event_device *dev); 28extern void tick_install_replacement(struct clock_event_device *dev);
29 29
30extern void clockevents_shutdown(struct clock_event_device *dev);
31extern int clockevents_tick_resume(struct clock_event_device *dev); 30extern int clockevents_tick_resume(struct clock_event_device *dev);
31/* Check, if the device is functional or a dummy for broadcast */
32static inline int tick_device_is_functional(struct clock_event_device *dev)
33{
34 return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
35}
32 36
37extern void clockevents_shutdown(struct clock_event_device *dev);
38extern int __clockevents_update_freq(struct clock_event_device *dev, u32 freq);
33extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt); 39extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt);
40#endif /* GENERIC_CLOCKEVENTS */
34 41
35/* 42/* Oneshot related functions */
36 * NO_HZ / high resolution timer shared code
37 */
38#ifdef CONFIG_TICK_ONESHOT 43#ifdef CONFIG_TICK_ONESHOT
39extern void tick_setup_oneshot(struct clock_event_device *newdev, 44extern void tick_setup_oneshot(struct clock_event_device *newdev,
40 void (*handler)(struct clock_event_device *), 45 void (*handler)(struct clock_event_device *),
@@ -43,69 +48,19 @@ extern int tick_program_event(ktime_t expires, int force);
43extern void tick_oneshot_notify(void); 48extern void tick_oneshot_notify(void);
44extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); 49extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
45extern void tick_resume_oneshot(void); 50extern void tick_resume_oneshot(void);
46# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 51static inline bool tick_oneshot_possible(void) { return true; }
47extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
48extern int tick_broadcast_oneshot_control(unsigned long reason);
49extern void tick_broadcast_switch_to_oneshot(void);
50extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
51extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
52extern int tick_broadcast_oneshot_active(void);
53extern void tick_check_oneshot_broadcast_this_cpu(void);
54bool tick_broadcast_oneshot_available(void);
55# else /* BROADCAST */
56static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
57{
58 BUG();
59}
60static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
61static inline void tick_broadcast_switch_to_oneshot(void) { }
62static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
63static inline int tick_broadcast_oneshot_active(void) { return 0; }
64static inline void tick_check_oneshot_broadcast_this_cpu(void) { }
65static inline bool tick_broadcast_oneshot_available(void) { return true; }
66# endif /* !BROADCAST */
67
68#else /* !ONESHOT */ 52#else /* !ONESHOT */
69static inline 53static inline
70void tick_setup_oneshot(struct clock_event_device *newdev, 54void tick_setup_oneshot(struct clock_event_device *newdev,
71 void (*handler)(struct clock_event_device *), 55 void (*handler)(struct clock_event_device *),
72 ktime_t nextevt) 56 ktime_t nextevt) { BUG(); }
73{ 57static inline void tick_resume_oneshot(void) { BUG(); }
74 BUG(); 58static inline int tick_program_event(ktime_t expires, int force) { return 0; }
75}
76static inline void tick_resume_oneshot(void)
77{
78 BUG();
79}
80static inline int tick_program_event(ktime_t expires, int force)
81{
82 return 0;
83}
84static inline void tick_oneshot_notify(void) { } 59static inline void tick_oneshot_notify(void) { }
85static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) 60static inline bool tick_oneshot_possible(void) { return false; }
86{
87 BUG();
88}
89static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
90static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
91static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
92{
93 return 0;
94}
95static inline int tick_broadcast_oneshot_active(void) { return 0; }
96static inline bool tick_broadcast_oneshot_available(void) { return false; }
97#endif /* !TICK_ONESHOT */ 61#endif /* !TICK_ONESHOT */
98 62
99/* NO_HZ_FULL internal */ 63/* Broadcasting support */
100#ifdef CONFIG_NO_HZ_FULL
101extern void tick_nohz_init(void);
102# else
103static inline void tick_nohz_init(void) { }
104#endif
105
106/*
107 * Broadcasting support
108 */
109#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 64#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
110extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu); 65extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
111extern void tick_install_broadcast_device(struct clock_event_device *dev); 66extern void tick_install_broadcast_device(struct clock_event_device *dev);
@@ -115,53 +70,51 @@ extern void tick_shutdown_broadcast(unsigned int *cpup);
115extern void tick_suspend_broadcast(void); 70extern void tick_suspend_broadcast(void);
116extern int tick_resume_broadcast(void); 71extern int tick_resume_broadcast(void);
117extern void tick_broadcast_init(void); 72extern void tick_broadcast_init(void);
118extern void 73extern void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast);
119tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); 74extern int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq);
120int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq);
121
122#else /* !BROADCAST */ 75#else /* !BROADCAST */
123 76static inline void tick_install_broadcast_device(struct clock_event_device *dev) { }
124static inline void tick_install_broadcast_device(struct clock_event_device *dev) 77static inline int tick_is_broadcast_device(struct clock_event_device *dev) { return 0; }
125{ 78static inline int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu) { return 0; }
126}
127
128static inline int tick_is_broadcast_device(struct clock_event_device *dev)
129{
130 return 0;
131}
132static inline int tick_device_uses_broadcast(struct clock_event_device *dev,
133 int cpu)
134{
135 return 0;
136}
137static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { } 79static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { }
138static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { } 80static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { }
139static inline void tick_shutdown_broadcast(unsigned int *cpup) { } 81static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
140static inline void tick_suspend_broadcast(void) { } 82static inline void tick_suspend_broadcast(void) { }
141static inline int tick_resume_broadcast(void) { return 0; } 83static inline int tick_resume_broadcast(void) { return 0; }
142static inline void tick_broadcast_init(void) { } 84static inline void tick_broadcast_init(void) { }
143static inline int tick_broadcast_update_freq(struct clock_event_device *dev, 85static inline int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq) { return -ENODEV; }
144 u32 freq) { return -ENODEV; }
145 86
146/* 87/* Set the periodic handler in non broadcast mode */
147 * Set the periodic handler in non broadcast mode 88static inline void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
148 */
149static inline void tick_set_periodic_handler(struct clock_event_device *dev,
150 int broadcast)
151{ 89{
152 dev->event_handler = tick_handle_periodic; 90 dev->event_handler = tick_handle_periodic;
153} 91}
154#endif /* !BROADCAST */ 92#endif /* !BROADCAST */
155 93
156/* 94/* Functions related to oneshot broadcasting */
157 * Check, if the device is functional or a dummy for broadcast 95#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
158 */ 96extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
159static inline int tick_device_is_functional(struct clock_event_device *dev) 97extern int tick_broadcast_oneshot_control(unsigned long reason);
160{ 98extern void tick_broadcast_switch_to_oneshot(void);
161 return !(dev->features & CLOCK_EVT_FEAT_DUMMY); 99extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
162} 100extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
163 101extern int tick_broadcast_oneshot_active(void);
164int __clockevents_update_freq(struct clock_event_device *dev, u32 freq); 102extern void tick_check_oneshot_broadcast_this_cpu(void);
165 103bool tick_broadcast_oneshot_available(void);
166#endif /* GENERIC_CLOCKEVENTS */ 104#else /* BROADCAST && ONESHOT */
105static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); }
106static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
107static inline void tick_broadcast_switch_to_oneshot(void) { }
108static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
109static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) { return 0; }
110static inline int tick_broadcast_oneshot_active(void) { return 0; }
111static inline void tick_check_oneshot_broadcast_this_cpu(void) { }
112static inline bool tick_broadcast_oneshot_available(void) { return tick_oneshot_possible(); }
113#endif /* !BROADCAST && ONESHOT */
167 114
115/* NO_HZ_FULL internal */
116#ifdef CONFIG_NO_HZ_FULL
117extern void tick_nohz_init(void);
118# else
119static inline void tick_nohz_init(void) { }
120#endif