Skip to content

Commit da7e6f4

Browse files
Preeti U MurthyKAGA-KOKO
authored andcommitted
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 <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent fe79a9b commit da7e6f4

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

include/linux/clockchips.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,17 @@ static inline int tick_check_broadcast_expired(void) { return 0; }
186186
#endif
187187

188188
#ifdef CONFIG_GENERIC_CLOCKEVENTS
189-
extern void clockevents_notify(unsigned long reason, void *arg);
189+
extern int clockevents_notify(unsigned long reason, void *arg);
190190
#else
191-
static inline void clockevents_notify(unsigned long reason, void *arg) {}
191+
static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
192192
#endif
193193

194194
#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
195195

196196
static inline void clockevents_suspend(void) {}
197197
static inline void clockevents_resume(void) {}
198198

199-
static inline void clockevents_notify(unsigned long reason, void *arg) {}
199+
static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
200200
static inline int tick_check_broadcast_expired(void) { return 0; }
201201

202202
#endif

kernel/time/clockevents.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,13 @@ void clockevents_resume(void)
542542
#ifdef CONFIG_GENERIC_CLOCKEVENTS
543543
/**
544544
* clockevents_notify - notification about relevant events
545+
* Returns 0 on success, any other value on error
545546
*/
546-
void clockevents_notify(unsigned long reason, void *arg)
547+
int clockevents_notify(unsigned long reason, void *arg)
547548
{
548549
struct clock_event_device *dev, *tmp;
549550
unsigned long flags;
550-
int cpu;
551+
int cpu, ret = 0;
551552

552553
raw_spin_lock_irqsave(&clockevents_lock, flags);
553554

@@ -560,7 +561,7 @@ void clockevents_notify(unsigned long reason, void *arg)
560561

561562
case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
562563
case CLOCK_EVT_NOTIFY_BROADCAST_EXIT:
563-
tick_broadcast_oneshot_control(reason);
564+
ret = tick_broadcast_oneshot_control(reason);
564565
break;
565566

566567
case CLOCK_EVT_NOTIFY_CPU_DYING:
@@ -603,6 +604,7 @@ void clockevents_notify(unsigned long reason, void *arg)
603604
break;
604605
}
605606
raw_spin_unlock_irqrestore(&clockevents_lock, flags);
607+
return ret;
606608
}
607609
EXPORT_SYMBOL_GPL(clockevents_notify);
608610

kernel/time/tick-broadcast.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,15 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
646646
/*
647647
* Powerstate information: The system enters/leaves a state, where
648648
* affected devices might stop
649+
* Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups.
649650
*/
650-
void tick_broadcast_oneshot_control(unsigned long reason)
651+
int tick_broadcast_oneshot_control(unsigned long reason)
651652
{
652653
struct clock_event_device *bc, *dev;
653654
struct tick_device *td;
654655
unsigned long flags;
655656
ktime_t now;
656-
int cpu;
657+
int cpu, ret = 0;
657658

658659
/*
659660
* Periodic mode does not care about the enter/exit of power
@@ -759,6 +760,7 @@ void tick_broadcast_oneshot_control(unsigned long reason)
759760
}
760761
out:
761762
raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
763+
return ret;
762764
}
763765

764766
/*

kernel/time/tick-internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
4646
extern void tick_resume_oneshot(void);
4747
# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
4848
extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
49-
extern void tick_broadcast_oneshot_control(unsigned long reason);
49+
extern int tick_broadcast_oneshot_control(unsigned long reason);
5050
extern void tick_broadcast_switch_to_oneshot(void);
5151
extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
5252
extern 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)
5858
{
5959
BUG();
6060
}
61-
static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
61+
static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
6262
static inline void tick_broadcast_switch_to_oneshot(void) { }
6363
static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
6464
static 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)
8787
{
8888
BUG();
8989
}
90-
static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
90+
static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
9191
static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
9292
static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
9393
{

0 commit comments

Comments
 (0)