public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Punit Agrawal <punit.agrawal@arm.com>
To: Wei Ni <wni@nvidia.com>
Cc: edubezval@gmail.com, rui.zhang@intel.com, linux-pm@vger.kernel.org
Subject: Re: [PATCH] thermal: of: fix cooling_spec.args for 64bit
Date: Thu, 07 May 2015 10:51:32 +0100	[thread overview]
Message-ID: <9hha8xg3ecb.fsf@e105922-lin.cambridge.arm.com> (raw)
In-Reply-To: <1430972952-16303-1-git-send-email-wni@nvidia.com> (Wei Ni's message of "Thu, 7 May 2015 12:29:12 +0800")

Wei Ni <wni@nvidia.com> writes:

> The THERMAL_NO_LIMIT is defined as -1UL, when it is set in DT,
> the of-thermal will use of_parse_phandle_with_args() to parse it.
> Since the args is uint32_t, so in 32bit system, the of framework
> will read it as 0xffffffff, it's the expected value "-1".
> But in 64bit system, this value is read as 0x00000000ffffffff,
> it's not a negative value, it will cause problems.
>
> This change can fix this issue.

If I understand the issue correctly, a patch fixing this is already
merged. Does "commit a940cb34f: thermal: Fix cdev registration with
THERMAL_NO_LIMIT on 64bit" not work for you?

>
> Signed-off-by: Wei Ni <wni@nvidia.com>
> ---
>  drivers/thermal/of-thermal.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
> index 9e8c614103ef..8d6b4070dea3 100644
> --- a/drivers/thermal/of-thermal.c
> +++ b/drivers/thermal/of-thermal.c
> @@ -613,8 +613,10 @@ static int thermal_of_populate_bind_params(struct device_node *np,
>  	}
>  	__tbp->cooling_device = cooling_spec.np;
>  	if (cooling_spec.args_count >= 2) { /* at least min and max */
> -		__tbp->min = cooling_spec.args[0];
> -		__tbp->max = cooling_spec.args[1];
> +		__tbp->min = cooling_spec.args[0] == -1U ?
> +			THERMAL_NO_LIMIT : cooling_spec.args[0];
> +		__tbp->max = cooling_spec.args[1] == -1U ?
> +			THERMAL_NO_LIMIT : cooling_spec.args[1];
>  	} else {
>  		pr_err("wrong reference to cooling device, missing limits\n");
>  	}

  reply	other threads:[~2015-05-07 10:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07  4:29 [PATCH] thermal: of: fix cooling_spec.args for 64bit Wei Ni
2015-05-07  9:51 ` Punit Agrawal [this message]
2015-05-07 10:21   ` Wei Ni

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=9hha8xg3ecb.fsf@e105922-lin.cambridge.arm.com \
    --to=punit.agrawal@arm.com \
    --cc=edubezval@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=wni@nvidia.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