From: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [RFC 4/4] cpuidle: replace the 'disable' field by a flag
Date: Fri, 8 Jun 2012 18:02:45 +0200 [thread overview]
Message-ID: <1339171365-4098-4-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1339171365-4098-1-git-send-email-daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
We have a flag field for each cpuidle state but we don't use it
for the 'disabled' states. Let's remove the integer field and use
the flag field.
Signed-off-by: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
drivers/cpuidle/cpuidle.c | 1 -
| 5 +++--
drivers/cpuidle/sysfs.c | 4 ++--
include/linux/cpuidle.h | 4 +++-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 68bf115..3068b65 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -267,7 +267,6 @@ static void poll_idle_init(struct cpuidle_driver *drv)
state->power_usage = -1;
state->flags = 0;
state->enter = poll_idle;
- state->disable = 0;
}
#else
static void poll_idle_init(struct cpuidle_driver *drv) {}
--git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 0633575..c1fe87b 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -281,7 +281,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
* unless the timer is happening really really soon.
*/
if (data->expected_us > 5 &&
- drv->states[CPUIDLE_DRIVER_STATE_START].disable == 0)
+ !(drv->states[CPUIDLE_DRIVER_STATE_START].flags &
+ CPUIDLE_FLAG_DISABLED))
data->last_state_idx = CPUIDLE_DRIVER_STATE_START;
/*
@@ -291,7 +292,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) {
struct cpuidle_state *s = &drv->states[i];
- if (s->disable)
+ if (s->flags & CPUIDLE_FLAG_DISABLED)
continue;
if (s->target_residency > data->predicted_us)
continue;
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 88032b4..a9a5f05 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -245,9 +245,9 @@ static ssize_t store_state_##_name(struct cpuidle_state *state, \
if (err) \
return err; \
if (value) \
- state->disable = 1; \
+ state->flags |= CPUIDLE_FLAG_DISABLED; \
else \
- state->disable = 0; \
+ state->flags &= ~CPUIDLE_FLAG_DISABLED; \
return size; \
}
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index aafacd4..65f4c52 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -46,7 +46,6 @@ struct cpuidle_state {
unsigned int exit_latency; /* in US */
int power_usage; /* in mW */
unsigned int target_residency; /* in US */
- unsigned int disable;
int (*enter) (struct cpuidle_device *dev,
struct cpuidle_driver *drv,
@@ -70,10 +69,13 @@ struct cpuidle_state {
* flushes the TLB, so even if the HW doesn't do the *
* flushing, this flag is safe to use. *
* *
+ * CPUIDLE_FLAG_DISABLE : the state is disabled if this flag is set *
+ * *
*******************************************************************************/
#define CPUIDLE_FLAG_TIME_VALID 0x01
#define CPUIDLE_FLAG_DEAD_VALID 0x02
#define CPUIDLE_FLAG_TLB_FLUSHED 0x04
+#define CPUIDLE_FLAG_DISABLED 0x08
/**
* cpuidle_get_statedata - retrieves private driver state data
--
1.7.5.4
next prev parent reply other threads:[~2012-06-08 16:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-08 16:02 [RFC 1/4] cpuidle: define the enter function in the driver structure Daniel Lezcano
2012-06-08 16:02 ` [RFC 2/4] cpuidle: move enter_dead to " Daniel Lezcano
2012-06-08 16:02 ` [RFC 3/4] cpuidle : move tlb flag to the cpuidle header Daniel Lezcano
[not found] ` <1339171365-4098-1-git-send-email-daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-06-08 16:02 ` Daniel Lezcano [this message]
2012-06-08 17:33 ` [linux-pm] [RFC 1/4] cpuidle: define the enter function in the driver structure Deepthi Dharwar
2012-06-08 21:34 ` Daniel Lezcano
[not found] ` <4FD27000.7000208-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-06-13 12:44 ` [linux-pm] " Jean Pihet
2012-06-13 13:10 ` Daniel Lezcano
2012-06-14 7:49 ` Namhyung Kim
2012-06-14 8:16 ` Daniel Lezcano
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=1339171365-4098-4-git-send-email-daniel.lezcano@linaro.org \
--to=daniel.lezcano-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.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).