From: Thomas Gleixner No point in having 3 global functions in the clockevents code if we can chain them internally. Signed-off-by: Thomas Gleixner --- kernel/time/clockevents.c | 2 -- kernel/time/tick-broadcast.c | 21 ++++++++++++--------- kernel/time/tick-common.c | 3 +++ kernel/time/tick-internal.h | 2 -- 4 files changed, 15 insertions(+), 13 deletions(-) Index: linux/kernel/time/clockevents.c =================================================================== --- linux.orig/kernel/time/clockevents.c +++ linux/kernel/time/clockevents.c @@ -551,8 +551,6 @@ void tick_cleanup_dead_cpu(int cpu) raw_spin_lock_irqsave(&clockevents_lock, flags); - tick_shutdown_broadcast_oneshot(cpu); - tick_shutdown_broadcast(cpu); tick_shutdown(cpu); /* * Unregister the clock event devices which were Index: linux/kernel/time/tick-broadcast.c =================================================================== --- linux.orig/kernel/time/tick-broadcast.c +++ linux/kernel/time/tick-broadcast.c @@ -46,6 +46,12 @@ static inline void tick_broadcast_clear_ static inline void tick_resume_broadcast_oneshot(struct clock_event_device *bc) { } #endif +#if defined(CONFIG_TICK_ONESHOT) && defined (CONFIG_HOTPLUG_CPU) +static void tick_shutdown_broadcast_oneshot(unsigned int cpu); +#else +static inline void tick_shutdown_broadcast_oneshot(unsigned int cpu) { } +#endif + /* * Debugging: see timer_list.c */ @@ -424,15 +430,17 @@ void tick_shutdown_broadcast(unsigned in raw_spin_lock_irqsave(&tick_broadcast_lock, flags); - bc = tick_broadcast_device.evtdev; cpumask_clear_cpu(cpu, tick_broadcast_mask); cpumask_clear_cpu(cpu, tick_broadcast_on); + bc = tick_broadcast_device.evtdev; if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) { if (bc && cpumask_empty(tick_broadcast_mask)) clockevents_shutdown(bc); } + tick_shutdown_broadcast_oneshot(cpu); + raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); } #endif @@ -909,14 +917,11 @@ static void broadcast_move_bc(int deadcp } /* - * Remove a dead CPU from broadcasting + * Remove a dead CPU from broadcasting, called with broadcast lock + * held. */ -void tick_shutdown_broadcast_oneshot(unsigned int cpu) +static void tick_shutdown_broadcast_oneshot(unsigned int cpu) { - unsigned long flags; - - raw_spin_lock_irqsave(&tick_broadcast_lock, flags); - /* * Clear the broadcast masks for the dead cpu, but do not stop * the broadcast device! @@ -926,8 +931,6 @@ void tick_shutdown_broadcast_oneshot(uns cpumask_clear_cpu(cpu, tick_broadcast_force_mask); broadcast_move_bc(cpu); - - raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); } #endif Index: linux/kernel/time/tick-common.c =================================================================== --- linux.orig/kernel/time/tick-common.c +++ linux/kernel/time/tick-common.c @@ -361,6 +361,9 @@ void tick_shutdown(unsigned int cpu) struct tick_device *td = &per_cpu(tick_cpu_device, cpu); struct clock_event_device *dev = td->evtdev; + /* Remove the CPU from the broadcast machinery */ + tick_shutdown_broadcast(cpu); + td->mode = TICKDEV_MODE_PERIODIC; if (dev) { /* Index: linux/kernel/time/tick-internal.h =================================================================== --- linux.orig/kernel/time/tick-internal.h +++ linux/kernel/time/tick-internal.h @@ -114,7 +114,6 @@ static inline void tick_set_periodic_han #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); extern void tick_broadcast_switch_to_oneshot(void); -extern void tick_shutdown_broadcast_oneshot(unsigned int cpu); extern int tick_broadcast_oneshot_active(void); extern void tick_check_oneshot_broadcast_this_cpu(void); bool tick_broadcast_oneshot_available(void); @@ -122,7 +121,6 @@ extern struct cpumask *tick_get_broadcas #else /* BROADCAST && ONESHOT */ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } static inline void tick_broadcast_switch_to_oneshot(void) { } -static inline void tick_shutdown_broadcast_oneshot(unsigned int cpu) { } static inline int tick_broadcast_oneshot_active(void) { return 0; } static inline void tick_check_oneshot_broadcast_this_cpu(void) { } static inline bool tick_broadcast_oneshot_available(void) { return tick_oneshot_possible(); }