aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorPreeti U Murthy <preeti@linux.vnet.ibm.com>2014-02-07 03:06:06 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-02-07 09:34:29 -0500
commitda7e6f45c34d39186b72328bacc4dd86bff60e0a (patch)
tree414a48cd4d8c037c704946e10a7d2e12342214d7 /kernel/time
parentfe79a9ba11962a603fb6af68fcb476e64031e46c (diff)
time: Change the return type of clockevents_notify() to integer
The broadcast framework can potentially be made use of by archs which do not have an external clock device as well. Then, it is required that one of the CPUs need to handle the broadcasting of wakeup IPIs to the CPUs in deep idle. As a result its local timers should remain functional all the time. For such a CPU, the BROADCAST_ENTER notification has to fail indicating that its clock device cannot be shutdown. To make way for this support, change the return type of tick_broadcast_oneshot_control() and hence clockevents_notify() to indicate such scenarios. Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com> Cc: deepthi@linux.vnet.ibm.com Cc: paulmck@linux.vnet.ibm.com Cc: fweisbec@gmail.com Cc: paulus@samba.org Cc: srivatsa.bhat@linux.vnet.ibm.com Cc: svaidy@linux.vnet.ibm.com Cc: peterz@infradead.org Cc: benh@kernel.crashing.org Cc: rafael.j.wysocki@intel.com Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/20140207080606.17187.78306.stgit@preeti.in.ibm.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/clockevents.c8
-rw-r--r--kernel/time/tick-broadcast.c6
-rw-r--r--kernel/time/tick-internal.h6
3 files changed, 12 insertions, 8 deletions
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index f85e5fda9c66..ad362c260ef4 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -542,12 +542,13 @@ void clockevents_resume(void)
542#ifdef CONFIG_GENERIC_CLOCKEVENTS 542#ifdef CONFIG_GENERIC_CLOCKEVENTS
543/** 543/**
544 * clockevents_notify - notification about relevant events 544 * clockevents_notify - notification about relevant events
545 * Returns 0 on success, any other value on error
545 */ 546 */
546void clockevents_notify(unsigned long reason, void *arg) 547int clockevents_notify(unsigned long reason, void *arg)
547{ 548{
548 struct clock_event_device *dev, *tmp; 549 struct clock_event_device *dev, *tmp;
549 unsigned long flags; 550 unsigned long flags;
550 int cpu; 551 int cpu, ret = 0;
551 552
552 raw_spin_lock_irqsave(&clockevents_lock, flags); 553 raw_spin_lock_irqsave(&clockevents_lock, flags);
553 554
@@ -560,7 +561,7 @@ void clockevents_notify(unsigned long reason, void *arg)
560 561
561 case CLOCK_EVT_NOTIFY_BROADCAST_ENTER: 562 case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
562 case CLOCK_EVT_NOTIFY_BROADCAST_EXIT: 563 case CLOCK_EVT_NOTIFY_BROADCAST_EXIT:
563 tick_broadcast_oneshot_control(reason); 564 ret = tick_broadcast_oneshot_control(reason);
564 break; 565 break;
565 566
566 case CLOCK_EVT_NOTIFY_CPU_DYING: 567 case CLOCK_EVT_NOTIFY_CPU_DYING:
@@ -603,6 +604,7 @@ void clockevents_notify(unsigned long reason, void *arg)
603 break; 604 break;
604 } 605 }
605 raw_spin_unlock_irqrestore(&clockevents_lock, flags); 606 raw_spin_unlock_irqrestore(&clockevents_lock, flags);
607 return ret;
606} 608}
607EXPORT_SYMBOL_GPL(clockevents_notify); 609EXPORT_SYMBOL_GPL(clockevents_notify);
608 610
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 003e6c3663b1..84c8fd91d744 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -646,14 +646,15 @@ again:
646/* 646/*
647 * Powerstate information: The system enters/leaves a state, where 647 * Powerstate information: The system enters/leaves a state, where
648 * affected devices might stop 648 * affected devices might stop
649 * Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups.
649 */ 650 */
650void tick_broadcast_oneshot_control(unsigned long reason) 651int tick_broadcast_oneshot_control(unsigned long reason)
651{ 652{
652 struct clock_event_device *bc, *dev; 653 struct clock_event_device *bc, *dev;
653 struct tick_device *td; 654 struct tick_device *td;
654 unsigned long flags; 655 unsigned long flags;
655 ktime_t now; 656 ktime_t now;
656 int cpu; 657 int cpu, ret = 0;
657 658
658 /* 659 /*
659 * Periodic mode does not care about the enter/exit of power 660 * Periodic mode does not care about the enter/exit of power
@@ -759,6 +760,7 @@ void tick_broadcast_oneshot_control(unsigned long reason)
759 } 760 }
760out: 761out:
761 raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); 762 raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
763 return ret;
762} 764}
763 765
764/* 766/*
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 26f1c0ba9d81..0756c62c219a 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -46,7 +46,7 @@ extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
46extern void tick_resume_oneshot(void); 46extern void tick_resume_oneshot(void);
47# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 47# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
48extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); 48extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
49extern void tick_broadcast_oneshot_control(unsigned long reason); 49extern int tick_broadcast_oneshot_control(unsigned long reason);
50extern void tick_broadcast_switch_to_oneshot(void); 50extern void tick_broadcast_switch_to_oneshot(void);
51extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); 51extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
52extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); 52extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
@@ -58,7 +58,7 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
58{ 58{
59 BUG(); 59 BUG();
60} 60}
61static inline void tick_broadcast_oneshot_control(unsigned long reason) { } 61static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
62static inline void tick_broadcast_switch_to_oneshot(void) { } 62static inline void tick_broadcast_switch_to_oneshot(void) { }
63static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } 63static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
64static inline int tick_broadcast_oneshot_active(void) { return 0; } 64static inline int tick_broadcast_oneshot_active(void) { return 0; }
@@ -87,7 +87,7 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
87{ 87{
88 BUG(); 88 BUG();
89} 89}
90static inline void tick_broadcast_oneshot_control(unsigned long reason) { } 90static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
91static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } 91static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
92static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) 92static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
93{ 93{