diff options
Diffstat (limited to 'drivers/regulator/anatop-regulator.c')
-rw-r--r-- | drivers/regulator/anatop-regulator.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index e9c2085f9dfb..ce0fe72a428e 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
@@ -64,14 +64,15 @@ static int anatop_set_voltage_sel(struct regulator_dev *reg, unsigned selector) | |||
64 | static int anatop_get_voltage_sel(struct regulator_dev *reg) | 64 | static int anatop_get_voltage_sel(struct regulator_dev *reg) |
65 | { | 65 | { |
66 | struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); | 66 | struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); |
67 | u32 val; | 67 | u32 val, mask; |
68 | 68 | ||
69 | if (!anatop_reg->control_reg) | 69 | if (!anatop_reg->control_reg) |
70 | return -ENOTSUPP; | 70 | return -ENOTSUPP; |
71 | 71 | ||
72 | val = anatop_read_reg(anatop_reg->mfd, anatop_reg->control_reg); | 72 | val = anatop_read_reg(anatop_reg->mfd, anatop_reg->control_reg); |
73 | val = (val & ((1 << anatop_reg->vol_bit_width) - 1)) >> | 73 | mask = ((1 << anatop_reg->vol_bit_width) - 1) << |
74 | anatop_reg->vol_bit_shift; | 74 | anatop_reg->vol_bit_shift; |
75 | val = (val & mask) >> anatop_reg->vol_bit_shift; | ||
75 | 76 | ||
76 | return val - anatop_reg->min_bit_val; | 77 | return val - anatop_reg->min_bit_val; |
77 | } | 78 | } |