From: Kazuki Hashimoto <kazukih0205@gmail.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Hector Martin <marcan@marcan.st>,
Kazuki Hashimoto <kazukih0205@gmail.com>
Subject: [PATCH 1/2] cpuidle: Don't pass any values to cpuidle_not_available
Date: Tue, 11 Jul 2023 14:54:21 +0900 [thread overview]
Message-ID: <20230711-cpuidle-v1-1-f391224b3140@gmail.com> (raw)
In-Reply-To: <20230711-cpuidle-v1-0-f391224b3140@gmail.com>
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 Hashimoto <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(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 737a026ef58a..c9ba51e0fa38 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -49,9 +49,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;
}
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 3183aeb7f5b4..a0ce9b6d16ce 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -169,8 +169,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,
@@ -204,8 +203,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)
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index 342f58a329f5..865674d2e420 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -164,7 +164,7 @@ static void cpuidle_idle_call(void)
* step to the grace period
*/
- if (cpuidle_not_available(drv, dev)) {
+ if (cpuidle_not_available()) {
tick_nohz_idle_stop_tick();
default_idle_call();
--
2.41.0
next prev parent reply other threads:[~2023-07-11 5:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 5:54 [PATCH 0/2] s2idle fixes for systems without cpuidle Kazuki Hashimoto
2023-07-11 5:54 ` Kazuki Hashimoto [this message]
2023-07-11 7:42 ` [PATCH 1/2] cpuidle: Don't pass any values to cpuidle_not_available Peter Zijlstra
2023-07-11 18:48 ` Kazuki Hashimoto
2023-07-11 5:54 ` [PATCH 2/2] PM: s2idle: Fully prevent the system from entering s2idle when cpuidle isn't supported Kazuki Hashimoto
2023-07-11 17:55 ` Rafael J. Wysocki
2023-07-11 18:38 ` Kazuki H
-- strict thread matches above, loose matches on Subject: below --
2023-03-16 6:37 [PATCH 1/2] cpuidle: Don't pass any values to cpuidle_not_available Kazuki H
2023-03-16 7:43 ` Kazuki H
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=20230711-cpuidle-v1-1-f391224b3140@gmail.com \
--to=kazukih0205@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=mingo@redhat.com \
--cc=pavel@ucw.cz \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).