regulator: s5m8767: Define symbol for buck control mask
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Tue, 10 Dec 2013 09:09:42 +0000 (10:09 +0100)
committerMark Brown <broonie@linaro.org>
Wed, 11 Dec 2013 22:47:45 +0000 (22:47 +0000)
Replace hard-coded value for mask used in BUCKX_CTRL registers (for
BUCKX_EN field) with a symbol. This also removes two local variables.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/s5m8767.c
include/linux/mfd/samsung/s5m8767.h

index cbf91e25cf7ff2a632270caed53d05533fcf81db..ef4da4442fa78b0c4e60dd422d76ad70b997677e 100644 (file)
@@ -217,7 +217,7 @@ static int s5m8767_reg_is_enabled(struct regulator_dev *rdev)
 {
        struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
        int ret, reg;
-       int mask = 0xc0, enable_ctrl;
+       int enable_ctrl;
        unsigned int val;
 
        ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
@@ -230,27 +230,28 @@ static int s5m8767_reg_is_enabled(struct regulator_dev *rdev)
        if (ret)
                return ret;
 
-       return (val & mask) == enable_ctrl;
+       return (val & S5M8767_ENCTRL_MASK) == enable_ctrl;
 }
 
 static int s5m8767_reg_enable(struct regulator_dev *rdev)
 {
        struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
        int ret, reg;
-       int mask = 0xc0, enable_ctrl;
+       int enable_ctrl;
 
        ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
        if (ret)
                return ret;
 
-       return sec_reg_update(s5m8767->iodev, reg, enable_ctrl, mask);
+       return sec_reg_update(s5m8767->iodev, reg, enable_ctrl,
+                       S5M8767_ENCTRL_MASK);
 }
 
 static int s5m8767_reg_disable(struct regulator_dev *rdev)
 {
        struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
        int ret, reg;
-       int  mask = 0xc0, enable_ctrl;
+       int mask = S5M8767_ENCTRL_MASK, enable_ctrl;
 
        ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
        if (ret)
index 306a95fc558ccc1676e7816c41f4109a65074a96..9198377ee859cde80e67085c3fc3d09db7ec0b7f 100644 (file)
@@ -183,6 +183,7 @@ enum s5m8767_regulators {
        S5M8767_REG_MAX,
 };
 
-#define S5M8767_ENCTRL_SHIFT  6
+#define S5M8767_ENCTRL_SHIFT           6
+#define S5M8767_ENCTRL_MASK            (0x3 << S5M8767_ENCTRL_SHIFT)
 
 #endif /* __LINUX_MFD_S5M8767_H */