diff mbox

[6/7] ASoC: wm8962: remove bitwise operations involving GPIO level value

Message ID 1433200158-6890-6-git-send-email-vz@mleia.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vladimir Zapolskiy June 1, 2015, 11:09 p.m. UTC
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(-)

Comments

Charles Keepax June 2, 2015, 8:41 a.m. UTC | #1
On Tue, Jun 02, 2015 at 02:09:17AM +0300, Vladimir Zapolskiy wrote:
> 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
> ---

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Thanks,
Charles
diff mbox

Patch

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);