From patchwork Mon Jun 1 23:09:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 479221 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 69F791412F4 for ; Tue, 2 Jun 2015 09:17:22 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754004AbbFAXRV (ORCPT ); Mon, 1 Jun 2015 19:17:21 -0400 Received: from li271-223.members.linode.com ([178.79.152.223]:53691 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753911AbbFAXRT (ORCPT ); Mon, 1 Jun 2015 19:17:19 -0400 Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id D41449AE6D; Tue, 2 Jun 2015 00:12:19 +0100 (BST) From: Vladimir Zapolskiy To: Mark Brown , Liam Girdwood , Linus Walleij , Alexandre Courbot Cc: Jaroslav Kysela , Takashi Iwai , linux-gpio@vger.kernel.org, alsa-devel@alsa-project.org, Charles Keepax , Lars-Peter Clausen , Axel Lin , patches@opensource.wolfsonmicro.com Subject: [PATCH 7/7] ASoC: wm8996: remove bitwise operations involving GPIO level value Date: Tue, 2 Jun 2015 02:09:18 +0300 Message-Id: <1433200158-6890-7-git-send-email-vz@mleia.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433200031-6748-1-git-send-email-vz@mleia.com> References: <1433200031-6748-1-git-send-email-vz@mleia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20150602_001219_892433_C3F4DD06 X-CRM114-Status: GOOD ( 11.27 ) Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 Cc: Charles Keepax Cc: Lars-Peter Clausen Cc: Axel Lin Cc: patches@opensource.wolfsonmicro.com Acked-by: Charles Keepax --- 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 |