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/wm8996.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 3dd063f..0dce3a0 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -2147,18 +2147,23 @@ static inline struct wm8996_priv *gpio_to_wm8996(struct 
gpio_chip *chip)
 static void wm8996_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
        struct wm8996_priv *wm8996 = gpio_to_wm8996(chip);
+       unsigned int val = 0;
+
+       if (value)
+               val = 0x1 << WM8996_GP1_LVL_SHIFT;
 
        regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset,
-                          WM8996_GP1_LVL, !!value << WM8996_GP1_LVL_SHIFT);
+                          WM8996_GP1_LVL, val);
 }
 
 static int wm8996_gpio_direction_out(struct gpio_chip *chip,
                                     unsigned offset, int value)
 {
        struct wm8996_priv *wm8996 = gpio_to_wm8996(chip);
-       int val;
+       unsigned int val = 0x1 << WM8996_GP1_FN_SHIFT;
 
-       val = (1 << WM8996_GP1_FN_SHIFT) | (!!value << WM8996_GP1_LVL_SHIFT);
+       if (value)
+               val |= 0x1 << WM8996_GP1_LVL_SHIFT;
 
        return regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset,
                                  WM8996_GP1_FN_MASK | WM8996_GP1_DIR |
-- 
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