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: 6525021 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A99709F1CC for ; Mon, 1 Jun 2015 23:13:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA27D20397 for ; Mon, 1 Jun 2015 23:13:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 859D82037C for ; Mon, 1 Jun 2015 23:13:05 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6167F261B14; Tue, 2 Jun 2015 01:13:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 93FA7264F50; Tue, 2 Jun 2015 01:11:10 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5BD91264F53; Tue, 2 Jun 2015 01:11:09 +0200 (CEST) Received: from mail.mleia.com (li271-223.members.linode.com [178.79.152.223]) by alsa0.perex.cz (Postfix) with ESMTP id 3E5442604B5 for ; Tue, 2 Jun 2015 01:09:49 +0200 (CEST) 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 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 ) Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen , Axel Lin , Takashi Iwai , patches@opensource.wolfsonmicro.com, linux-gpio@vger.kernel.org, Charles Keepax Subject: [alsa-devel] [PATCH 7/7] ASoC: wm8996: remove bitwise operations involving GPIO level value X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 |