public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laxman Dewangan <ldewangan@nvidia.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Mark Brown <broonie@kernel.org>,
	Florian Lobmaier <florian.lobmaier@ams.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFT][PATCH 2/2] regulator: as3722: Fix off-by-one n_voltages setting for SDx
Date: Wed, 2 Oct 2013 17:45:07 +0530	[thread overview]
Message-ID: <524C0E4B.4050603@nvidia.com> (raw)
In-Reply-To: <1380641753.19681.5.camel@phoenix>

On Tuesday 01 October 2013 09:05 PM, Axel Lin wrote:
> AS3722_SDx_VSEL_MAX means the maximum selector, the n_voltages should be
> AS3722_SDx_VSEL_MAX + 1.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>   drivers/regulator/as3722-regulator.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c
> index c6a1fc6..91b0abe 100644
> --- a/drivers/regulator/as3722-regulator.c
> +++ b/drivers/regulator/as3722-regulator.c
> @@ -99,7 +99,7 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = {
>   		.sleep_ctrl_mask = AS3722_SD0_EXT_ENABLE_MASK,
>   		.control_reg = AS3722_SD0_CONTROL_REG,
>   		.mode_mask = AS3722_SD0_MODE_FAST,
> -		.n_voltages = AS3722_SD0_VSEL_MAX,
> +		.n_voltages = AS3722_SD0_VSEL_MAX + 1,
>   	},

Agree, to allow the VSEL_MAX as valid value, it need to be +1 in n_voltages.

         if (selector >= rdev->desc->n_voltages)
                 return -EINVAL;


Originally, I offset this because of min_sel is  1 as thinking that 
n_voltages are number of voltages but it become MAX_VSEL. Seems my 
interpretation issue.

In header, it is defined as
#define AS3722_SD0_VSEL_MIN                             0x01
#define AS3722_SD0_VSEL_MAX                             0x5A
#define AS3722_SD2_VSEL_MIN                             0x01
#define AS3722_SD2_VSEL_MAX                             0x7F


Acked-by: Laxman Dewangan <ldewangan@nvidia.com>


  reply	other threads:[~2013-10-02 11:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-01 15:33 [RFT][PATCH 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro Axel Lin
2013-10-01 15:35 ` [RFT][PATCH 2/2] regulator: as3722: Fix off-by-one n_voltages setting for SDx Axel Lin
2013-10-02 12:15   ` Laxman Dewangan [this message]
2013-10-02 11:56 ` [RFT][PATCH 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro Laxman Dewangan
2013-10-02 11:56   ` Axel Lin
2013-10-02 12:32     ` Laxman Dewangan

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=524C0E4B.4050603@nvidia.com \
    --to=ldewangan@nvidia.com \
    --cc=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=florian.lobmaier@ams.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.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