[alsa-devel] [PATCH 7/7] ASoC: wm8996: remove bitwise operations involving GPIO level value

Vladimir Zapolskiy vz at mleia.com
Tue Jun 2 01:09:18 CEST 2015


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 at mleia.com>
Cc: Charles Keepax <ckeepax at opensource.wolfsonmicro.com>
Cc: Lars-Peter Clausen <lars at metafoo.de>
Cc: Axel Lin <axel.lin at ingics.com>
Cc: patches at opensource.wolfsonmicro.com
---
 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



More information about the Alsa-devel mailing list