regulator: hi655x: Remove ctrl_mask field from struct hi655x_regulator
authorAxel Lin <axel.lin@ingics.com>
Mon, 8 Apr 2019 12:09:33 +0000 (20:09 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 10 Apr 2019 11:22:32 +0000 (12:22 +0100)
The rdev->desc->enable_mask setting is always the same as
BIT(regulator->ctrl_mask), so just use rdev->desc->enable_mask instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/hi655x-regulator.c

index 460ae70d8b043c6ba3b95376af4ba9816d3c3666..6f6635daa026946ffd695fc4eb2a0f5f2129fbeb 100644 (file)
@@ -28,7 +28,6 @@
 struct hi655x_regulator {
        unsigned int disable_reg;
        unsigned int status_reg;
-       unsigned int ctrl_mask;
        struct regulator_desc rdesc;
 };
 
@@ -77,22 +76,18 @@ enum hi655x_regulator_id {
 static int hi655x_is_enabled(struct regulator_dev *rdev)
 {
        unsigned int value = 0;
-
        struct hi655x_regulator *regulator = rdev_get_drvdata(rdev);
 
        regmap_read(rdev->regmap, regulator->status_reg, &value);
-       return (value & BIT(regulator->ctrl_mask));
+       return (value & rdev->desc->enable_mask);
 }
 
 static int hi655x_disable(struct regulator_dev *rdev)
 {
-       int ret = 0;
-
        struct hi655x_regulator *regulator = rdev_get_drvdata(rdev);
 
-       ret = regmap_write(rdev->regmap, regulator->disable_reg,
-                          BIT(regulator->ctrl_mask));
-       return ret;
+       return regmap_write(rdev->regmap, regulator->disable_reg,
+                           rdev->desc->enable_mask);
 }
 
 static const struct regulator_ops hi655x_regulator_ops = {
@@ -132,7 +127,6 @@ static const struct regulator_ops hi655x_ldo_linear_ops = {
        },                                                       \
        .disable_reg = HI655X_BUS_ADDR(dreg),                    \
        .status_reg = HI655X_BUS_ADDR(sreg),                     \
-       .ctrl_mask = cmask,                                      \
 }
 
 #define HI655X_LDO_LINEAR(_ID, vreg, vmask, ereg, dreg,          \
@@ -155,7 +149,6 @@ static const struct regulator_ops hi655x_ldo_linear_ops = {
        },                                                       \
        .disable_reg = HI655X_BUS_ADDR(dreg),                    \
        .status_reg = HI655X_BUS_ADDR(sreg),                     \
-       .ctrl_mask = cmask,                                      \
 }
 
 static const struct hi655x_regulator regulators[] = {