From patchwork Mon Jun 1 23:09:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 479223 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 5F0C01412F5 for ; Tue, 2 Jun 2015 09:17:24 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753906AbbFAXRW (ORCPT ); Mon, 1 Jun 2015 19:17:22 -0400 Received: from li271-223.members.linode.com ([178.79.152.223]:53692 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbbFAXRU (ORCPT ); Mon, 1 Jun 2015 19:17:20 -0400 Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id F41029AE69; Tue, 2 Jun 2015 00:12:17 +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 5/7] ASoC: wm5100: remove bitwise operations involving GPIO level value Date: Tue, 2 Jun 2015 02:09:16 +0300 Message-Id: <1433200158-6890-5-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_001218_022833_2C637A28 X-CRM114-Status: GOOD ( 12.79 ) 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/wm5100.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 4c10cd8..fae9d13 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -2244,26 +2244,27 @@ static inline struct wm5100_priv *gpio_to_wm5100(struct gpio_chip *chip) static void wm5100_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); + unsigned int val = 0; + + if (value) + val = 0x1 << WM5100_GP1_LVL_SHIFT; regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, - WM5100_GP1_LVL, !!value << WM5100_GP1_LVL_SHIFT); + WM5100_GP1_LVL, val); } static int wm5100_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); - int val, ret; + unsigned int val = 0x1 << WM5100_GP1_FN_SHIFT; - val = (1 << WM5100_GP1_FN_SHIFT) | (!!value << WM5100_GP1_LVL_SHIFT); + if (value) + val |= 0x1 << WM5100_GP1_LVL_SHIFT; - ret = regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, - WM5100_GP1_FN_MASK | WM5100_GP1_DIR | - WM5100_GP1_LVL, val); - if (ret < 0) - return ret; - else - return 0; + return regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, + WM5100_GP1_FN_MASK | WM5100_GP1_DIR | + WM5100_GP1_LVL, val); } static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset)