@@ -48,9 +48,11 @@ void disable_cpuidle(void)
off = 1;
}
-bool cpuidle_not_available(struct cpuidle_driver *drv,
- struct cpuidle_device *dev)
+bool cpuidle_not_available(void)
{
+ struct cpuidle_device *dev = cpuidle_get_device();
+ struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
+
return off || !initialized || !drv || !dev || !dev->enabled;
}
@@ -139,8 +139,7 @@ struct cpuidle_driver {
#ifdef CONFIG_CPU_IDLE
extern void disable_cpuidle(void);
-extern bool cpuidle_not_available(struct cpuidle_driver *drv,
- struct cpuidle_device *dev);
+extern bool cpuidle_not_available(void);
extern int cpuidle_select(struct cpuidle_driver *drv,
struct cpuidle_device *dev,
@@ -174,8 +173,7 @@ static inline struct cpuidle_device *cpuidle_get_device(void)
{return __this_cpu_read(cpuidle_devices); }
#else
static inline void disable_cpuidle(void) { }
-static inline bool cpuidle_not_available(struct cpuidle_driver *drv,
- struct cpuidle_device *dev)
+static inline bool cpuidle_not_available(void)
{return true; }
static inline int cpuidle_select(struct cpuidle_driver *drv,
struct cpuidle_device *dev, bool *stop_tick)
@@ -179,7 +179,7 @@ static void cpuidle_idle_call(void)
return;
}
- if (cpuidle_not_available(drv, dev)) {
+ if (cpuidle_not_available()) {
tick_nohz_idle_stop_tick();
default_idle_call();
There's no reason to pass any values to cpuidle_not_available() as the function works standalone. Since we're planning to use the function in other places, make it so to avoid code duplication. Signed-off-by: Kazuki H <kazukih0205@gmail.com> --- drivers/cpuidle/cpuidle.c | 6 ++++-- include/linux/cpuidle.h | 6 ++---- kernel/sched/idle.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)