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 <[email protected]>
---
  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 <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to