From: Preeti U Murthy <preeti@linux.vnet.ibm.com>
To: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Anton Blanchard <anton@samba.org>
Cc: "Shreyas B. Prabhu" <shreyas@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/cpuidle: Fix parsing of idle state flags from device-tree
Date: Sun, 03 Aug 2014 18:31:07 +0530 [thread overview]
Message-ID: <53DE3293.2050604@linux.vnet.ibm.com> (raw)
In-Reply-To: <20140803075119.10152.52685.stgit@drishya>
On 08/03/2014 01:23 PM, Vaidyanathan Srinivasan wrote:
> Flags from device-tree need to be parsed with accessors for
> interpreting correct value in little-endian.
>
> Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
> ---
> drivers/cpuidle/cpuidle-powernv.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
> index 74f5788..a64be57 100644
> --- a/drivers/cpuidle/cpuidle-powernv.c
> +++ b/drivers/cpuidle/cpuidle-powernv.c
> @@ -160,10 +160,10 @@ static int powernv_cpuidle_driver_init(void)
> static int powernv_add_idle_states(void)
> {
> struct device_node *power_mgt;
> - struct property *prop;
> int nr_idle_states = 1; /* Snooze */
> int dt_idle_states;
> - u32 *flags;
> + const __be32 *idle_state_flags;
> + u32 len_flags, flags;
> int i;
>
> /* Currently we have snooze statically defined */
> @@ -174,18 +174,18 @@ static int powernv_add_idle_states(void)
> return nr_idle_states;
> }
>
> - prop = of_find_property(power_mgt, "ibm,cpu-idle-state-flags", NULL);
> - if (!prop) {
> + idle_state_flags = of_get_property(power_mgt, "ibm,cpu-idle-state-flags", &len_flags);
> + if (!idle_state_flags) {
> pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-flags\n");
> return nr_idle_states;
> }
>
> - dt_idle_states = prop->length / sizeof(u32);
> - flags = (u32 *) prop->value;
> + dt_idle_states = len_flags / sizeof(u32);
>
> for (i = 0; i < dt_idle_states; i++) {
>
> - if (flags[i] & IDLE_USE_INST_NAP) {
> + flags = be32_to_cpu(idle_state_flags[i]);
> + if (flags & IDLE_USE_INST_NAP) {
> /* Add NAP state */
> strcpy(powernv_states[nr_idle_states].name, "Nap");
> strcpy(powernv_states[nr_idle_states].desc, "Nap");
> @@ -196,7 +196,7 @@ static int powernv_add_idle_states(void)
> nr_idle_states++;
> }
>
> - if (flags[i] & IDLE_USE_INST_SLEEP) {
> + if (flags & IDLE_USE_INST_SLEEP) {
> /* Add FASTSLEEP state */
> strcpy(powernv_states[nr_idle_states].name, "FastSleep");
> strcpy(powernv_states[nr_idle_states].desc, "FastSleep");
Reviewed-by: Preeti U. Murthy <preeti@linux.vnet.ibm.com>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
prev parent reply other threads:[~2014-08-03 13:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-03 7:53 [PATCH] powerpc/cpuidle: Fix parsing of idle state flags from device-tree Vaidyanathan Srinivasan
2014-08-03 13:01 ` Preeti U Murthy [this message]
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=53DE3293.2050604@linux.vnet.ibm.com \
--to=preeti@linux.vnet.ibm.com \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=shreyas@linux.vnet.ibm.com \
--cc=svaidy@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).