public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Cc: linux-kernel@vger.kernel.org,
	broonie@opensource.wolfsonmicro.com, sameo@linux.intel.com,
	lrg@ti.com, Graeme Gregory <gg@slimlogic.co.uk>,
	grant.likely@secretlab.ca
Subject: Re: [PATCH 2/5] regulator: tps65911: Add new chip version
Date: Tue, 03 May 2011 09:31:16 -0700	[thread overview]
Message-ID: <4DC02DD4.9000505@codeaurora.org> (raw)
In-Reply-To: <91D0C3C1-66A6-4642-8F78-EFE99236D1A7@slimlogic.co.uk>

On 05/03/2011 09:18 AM, Jorge Eduardo Candelaria wrote:
> @@ -419,17 +541,21 @@ static int tps65910_get_voltage_dcdc(struct regulator_dev *dev)
>  		mult=1;
>  
>  	if (sr) {
> -		/* Valid range is 3-75 so normalise */
> -		if (srvsel < 3) srvsel = 3;
> -		if (srvsel > 75) srvsel = 75;
> +		/* normalise to valid range */
> +		if (srvsel < 3)
> +			srvsel = 3;
> +		if (srvsel > vselmax)
> +			srvsel = vselmax;
>  		srvsel -= 3;
>  
>  		voltage = (srvsel * VDD1_2_OFFSET + VDD1_2_MIN_VOLT) * 100;
>  	} else {
>  
> -		/* Valid range is 3-75 so normalise */
> -		if (opvsel < 3) opvsel = 3;
> -		if (opvsel > 75) opvsel = 75;
> +		/* normalise to valid range*/
> +		if (opvsel < 3)
> +			opvsel = 3;
> +		if (opvsel > vselmax)
> +			opvsel = vselmax;

Can we use clamp() instead?

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


  reply	other threads:[~2011-05-03 16:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03 16:18 [PATCH 2/5] regulator: tps65911: Add new chip version Jorge Eduardo Candelaria
2011-05-03 16:31 ` Stephen Boyd [this message]
2011-05-03 17:40 ` Mark Brown

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=4DC02DD4.9000505@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=gg@slimlogic.co.uk \
    --cc=grant.likely@secretlab.ca \
    --cc=jedu@slimlogic.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=sameo@linux.intel.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