lkml.org 
[lkml]   [2013]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFT][PATCH 2/2] regulator: as3722: Fix off-by-one n_voltages setting for SDx
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>



\
 
 \ /
  Last update: 2013-10-02 14:41    [W:0.059 / U:1.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site