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/wm8962.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index c5748fd..ad619e6 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3341,9 +3341,13 @@ static void wm8962_gpio_set(struct gpio_chip *chip, 
unsigned offset, int value)
 {
        struct wm8962_priv *wm8962 = gpio_to_wm8962(chip);
        struct snd_soc_codec *codec = wm8962->codec;
+       unsigned int val = 0;
+
+       if (value)
+               val = 0x1 << WM8962_GP2_LVL_SHIFT;
 
        snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset,
-                           WM8962_GP2_LVL, !!value << WM8962_GP2_LVL_SHIFT);
+                           WM8962_GP2_LVL, val);
 }
 
 static int wm8962_gpio_direction_out(struct gpio_chip *chip,
@@ -3351,10 +3355,11 @@ static int wm8962_gpio_direction_out(struct gpio_chip 
*chip,
 {
        struct wm8962_priv *wm8962 = gpio_to_wm8962(chip);
        struct snd_soc_codec *codec = wm8962->codec;
-       int ret, val;
+       unsigned int val = 0x1 << WM8962_GP2_FN_SHIFT;
+       int ret;
 
-       /* Force function 1 (logic output) */
-       val = (1 << WM8962_GP2_FN_SHIFT) | (value << WM8962_GP2_LVL_SHIFT);
+       if (value)
+               val |= 0x1 << WM8962_GP2_LVL_SHIFT;
 
        ret = snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset,
                                  WM8962_GP2_FN_MASK | WM8962_GP2_LVL, val);
-- 
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