The main intention of the change is to remove bitwise operations on
GPIO level value as a preceding change before updating gpiolib
callbacks to utilize bool type to represent GPIO level.

No functional change.

Signed-off-by: Vladimir Zapolskiy <[email protected]>
Cc: Charles Keepax <[email protected]>
Cc: Lars-Peter Clausen <[email protected]>
Cc: Axel Lin <[email protected]>
Cc: [email protected]
---
 sound/soc/codecs/wm5100.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 4c10cd8..fae9d13 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -2244,26 +2244,27 @@ static inline struct wm5100_priv *gpio_to_wm5100(struct 
gpio_chip *chip)
 static void wm5100_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
        struct wm5100_priv *wm5100 = gpio_to_wm5100(chip);
+       unsigned int val = 0;
+
+       if (value)
+               val = 0x1 << WM5100_GP1_LVL_SHIFT;
 
        regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset,
-                          WM5100_GP1_LVL, !!value << WM5100_GP1_LVL_SHIFT);
+                          WM5100_GP1_LVL, val);
 }
 
 static int wm5100_gpio_direction_out(struct gpio_chip *chip,
                                     unsigned offset, int value)
 {
        struct wm5100_priv *wm5100 = gpio_to_wm5100(chip);
-       int val, ret;
+       unsigned int val = 0x1 << WM5100_GP1_FN_SHIFT;
 
-       val = (1 << WM5100_GP1_FN_SHIFT) | (!!value << WM5100_GP1_LVL_SHIFT);
+       if (value)
+               val |= 0x1 << WM5100_GP1_LVL_SHIFT;
 
-       ret = regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset,
-                                WM5100_GP1_FN_MASK | WM5100_GP1_DIR |
-                                WM5100_GP1_LVL, val);
-       if (ret < 0)
-               return ret;
-       else
-               return 0;
+       return regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset,
+                                 WM5100_GP1_FN_MASK | WM5100_GP1_DIR |
+                                 WM5100_GP1_LVL, val);
 }
 
 static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset)
-- 
2.1.4

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

Reply via email to