[PATCH 29/35] tick/timekeeping: Make PM_SLEEP related code conditional

From: Peter Zijlstra
Date: Mon Feb 16 2015 - 08:10:28 EST


From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

No point in compiling this in if PM_SLEEP=n

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: John Stultz <john.stultz@xxxxxxxxxx>
---
include/linux/clockchips.h | 6 ------
include/linux/clocksource.h | 2 --
kernel/time/clockevents.c | 2 ++
kernel/time/clocksource.c | 2 ++
kernel/time/tick-broadcast.c | 12 ++++++------
kernel/time/tick-common.c | 2 ++
kernel/time/tick-internal.h | 4 ++++
kernel/time/timekeeping.c | 2 ++
kernel/time/timekeeping.h | 3 +++
9 files changed, 21 insertions(+), 14 deletions(-)

Index: linux/include/linux/clockchips.h
===================================================================
--- linux.orig/include/linux/clockchips.h
+++ linux/include/linux/clockchips.h
@@ -156,9 +156,6 @@ extern void clockevents_set_mode(struct
extern int clockevents_program_event(struct clock_event_device *dev,
ktime_t expires, bool force);

-extern void clockevents_suspend(void);
-extern void clockevents_resume(void);
-
#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
#ifdef CONFIG_ARCH_HAS_TICK_BROADCAST
extern void tick_broadcast(const struct cpumask *mask);
@@ -178,9 +175,6 @@ static inline void tick_setup_hrtimer_br

#else /* CONFIG_GENERIC_CLOCKEVENTS */

-static inline void clockevents_suspend(void) {}
-static inline void clockevents_resume(void) {}
-
static inline int tick_check_broadcast_expired(void) { return 0; }
static inline void tick_setup_hrtimer_broadcast(void) {};

Index: linux/include/linux/clocksource.h
===================================================================
--- linux.orig/include/linux/clocksource.h
+++ linux/include/linux/clocksource.h
@@ -285,8 +285,6 @@ extern int clocksource_unregister(struct
extern void clocksource_touch_watchdog(void);
extern struct clocksource* clocksource_get_next(void);
extern void clocksource_change_rating(struct clocksource *cs, int rating);
-extern void clocksource_suspend(void);
-extern void clocksource_resume(void);
extern struct clocksource * __init clocksource_default_clock(void);
extern void clocksource_mark_unstable(struct clocksource *cs);

Index: linux/kernel/time/clockevents.c
===================================================================
--- linux.orig/kernel/time/clockevents.c
+++ linux/kernel/time/clockevents.c
@@ -514,6 +514,7 @@ void clockevents_exchange_device(struct
}
}

+#ifdef CONFIG_PM_SLEEP
/**
* clockevents_suspend - suspend clock devices
*/
@@ -537,6 +538,7 @@ void clockevents_resume(void)
if (dev->resume)
dev->resume(dev);
}
+#endif

#ifdef CONFIG_HOTPLUG_CPU
/**
Index: linux/kernel/time/clocksource.c
===================================================================
--- linux.orig/kernel/time/clocksource.c
+++ linux/kernel/time/clocksource.c
@@ -485,6 +485,7 @@ void clocksource_mark_unstable(struct cl

#endif /* CONFIG_CLOCKSOURCE_WATCHDOG */

+#ifdef CONFIG_PM_SLEEP
/**
* clocksource_suspend - suspend the clocksource(s)
*/
@@ -510,6 +511,7 @@ void clocksource_resume(void)

clocksource_resume_watchdog();
}
+#endif

/**
* clocksource_touch_watchdog - Update watchdog
Index: linux/kernel/time/tick-broadcast.c
===================================================================
--- linux.orig/kernel/time/tick-broadcast.c
+++ linux/kernel/time/tick-broadcast.c
@@ -37,7 +37,10 @@ static int tick_broadcast_forced;

#ifdef CONFIG_TICK_ONESHOT
static void tick_broadcast_clear_oneshot(int cpu);
-static void tick_resume_broadcast_oneshot(struct clock_event_device *bc);
+static inline void tick_resume_broadcast_oneshot(struct clock_event_device *bc)
+{
+ clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
+}
#else
static inline void tick_broadcast_clear_oneshot(int cpu) { }
static inline void tick_resume_broadcast_oneshot(struct clock_event_device *bc) { }
@@ -434,6 +437,7 @@ void tick_shutdown_broadcast(unsigned in
}
#endif

+#ifdef CONFIG_PM_SLEEP
void tick_suspend_broadcast(void)
{
struct clock_event_device *bc;
@@ -492,6 +496,7 @@ void tick_resume_broadcast(void)
}
raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
}
+#endif

#ifdef CONFIG_TICK_ONESHOT

@@ -549,11 +554,6 @@ static int tick_broadcast_set_event(stru
return ret;
}

-static void tick_resume_broadcast_oneshot(struct clock_event_device *bc)
-{
- clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
-}
-
/*
* Called from irq_enter() when idle was interrupted to reenable the
* per cpu device.
Index: linux/kernel/time/tick-common.c
===================================================================
--- linux.orig/kernel/time/tick-common.c
+++ linux/kernel/time/tick-common.c
@@ -375,6 +375,7 @@ void tick_shutdown(unsigned int cpu)
}
#endif

+#ifdef CONFIG_PM_SLEEP
/**
* tick_suspend - Suspend the tick and the broadcast device
*
@@ -425,6 +426,7 @@ void tick_resume(void)
tick_resume_broadcast();
tick_resume_local();
}
+#endif

/**
* tick_init - initialize the tick control
Index: linux/kernel/time/tick-internal.h
===================================================================
--- linux.orig/kernel/time/tick-internal.h
+++ linux/kernel/time/tick-internal.h
@@ -39,10 +39,14 @@ extern void clockevents_exchange_device(
struct clock_event_device *new);
extern void clockevents_handle_noop(struct clock_event_device *dev);
extern int __clockevents_update_freq(struct clock_event_device *dev, u32 freq);
+extern void clockevents_suspend(void);
+extern void clockevents_resume(void);
extern ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt);
#else
static inline void tick_suspend(void) { }
static inline void tick_resume(void) { }
+static inline void clockevents_suspend(void) {}
+static inline void clockevents_resume(void) {}
#endif /* GENERIC_CLOCKEVENTS */

/* Oneshot related functions */
Index: linux/kernel/time/timekeeping.c
===================================================================
--- linux.orig/kernel/time/timekeeping.c
+++ linux/kernel/time/timekeeping.c
@@ -1100,6 +1100,7 @@ void __init timekeeping_init(void)
raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
}

+#ifdef CONFIG_PM_SLEEP
/* time in seconds when suspend began */
static struct timespec64 timekeeping_suspend_time;

@@ -1316,6 +1317,7 @@ static int __init timekeeping_init_ops(v
return 0;
}
device_initcall(timekeeping_init_ops);
+#endif

/*
* Apply a multiplier adjustment to the timekeeper
Index: linux/kernel/time/timekeeping.h
===================================================================
--- linux.orig/kernel/time/timekeeping.h
+++ linux/kernel/time/timekeeping.h
@@ -20,6 +20,9 @@ extern void timekeeping_clocktai(struct
extern void do_timer(unsigned long ticks);
extern void update_wall_time(void);

+extern void clocksource_suspend(void);
+extern void clocksource_resume(void);
+
extern seqlock_t jiffies_lock;

#define CS_NAME_LEN 32


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/