@@ -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);
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 <vz@mleia.com> Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Axel Lin <axel.lin@ingics.com> Cc: patches@opensource.wolfsonmicro.com --- sound/soc/codecs/wm8962.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)