mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: zhuguangqing83@gmail.com
To: rjw@rjwysocki.net, daniel.lezcano@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhuguangqing <zhuguangqing@xiaomi.com>
Subject: [PATCH] cpuidle: change #ifdef for the declaration of cpuidle_enter_s2idle()
Date: Thu, 24 Sep 2020 16:00:41 +0800	[thread overview]
Message-ID: <20200924080041.2740-1-zhuguangqing83@gmail.com> (raw)

From: zhuguangqing <zhuguangqing@xiaomi.com>

Currently, if CONFIG_SUSPEND=n and CONFIG_CPU_IDLE=y, the function
cpuidle_enter_s2idle() is declared but not defined, it may cause error
when cpuidle_enter_s2idle() is called.

If CONFIG_SUSPEND=y and CONFIG_CPU_IDLE=n, the function
cpuidle_enter_s2idle() is defined as "return -ENODEV;" which is not
supposed to be.

Change #ifdef CONFIG_CPU_IDLE to #ifdef CONFIG_SUSPEND for
cpuidle_enter_s2idle() in cpuidle.h, which is consistent with its
defination in cpuidle.c.

Signed-off-by: zhuguangqing <zhuguangqing@xiaomi.com>
---
 include/linux/cpuidle.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 6175c77bf25e..2aa8cead1727 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -216,22 +216,26 @@ static inline struct cpuidle_device *cpuidle_get_device(void) {return NULL; }
 extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
 				      struct cpuidle_device *dev,
 				      u64 latency_limit_ns);
-extern int cpuidle_enter_s2idle(struct cpuidle_driver *drv,
-				struct cpuidle_device *dev);
 extern void cpuidle_use_deepest_state(u64 latency_limit_ns);
 #else
 static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
 					     struct cpuidle_device *dev,
 					     u64 latency_limit_ns)
 {return -ENODEV; }
-static inline int cpuidle_enter_s2idle(struct cpuidle_driver *drv,
-				       struct cpuidle_device *dev)
-{return -ENODEV; }
 static inline void cpuidle_use_deepest_state(u64 latency_limit_ns)
 {
 }
 #endif
 
+#ifdef CONFIG_SUSPEND
+extern int cpuidle_enter_s2idle(struct cpuidle_driver *drv,
+				struct cpuidle_device *dev);
+#else
+static inline int cpuidle_enter_s2idle(struct cpuidle_driver *drv,
+				       struct cpuidle_device *dev)
+{return -ENODEV; }
+#endif
+
 /* kernel/sched/idle.c */
 extern void sched_idle_set_state(struct cpuidle_state *idle_state);
 extern void default_idle_call(void);
-- 
2.17.1


             reply	other threads:[~2020-09-24  8:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24  8:00 zhuguangqing83 [this message]
2020-09-25 14:41 ` Rafael J. Wysocki
2020-09-26  1:30 zhuguangqing83
2020-09-28 14:10 ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200924080041.2740-1-zhuguangqing83@gmail.com \
    --to=zhuguangqing83@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=zhuguangqing@xiaomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®