From patchwork Sat Apr 9 14:13:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 65430 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp588393lbl; Sat, 9 Apr 2016 07:13:33 -0700 (PDT) X-Received: by 10.50.73.164 with SMTP id m4mr8654641igv.30.1460211213250; Sat, 09 Apr 2016 07:13:33 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si9561138iol.108.2016.04.09.07.13.33; Sat, 09 Apr 2016 07:13:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751522AbcDIONb (ORCPT + 4 others); Sat, 9 Apr 2016 10:13:31 -0400 Received: from mail-lf0-f43.google.com ([209.85.215.43]:33832 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751244AbcDIONb (ORCPT ); Sat, 9 Apr 2016 10:13:31 -0400 Received: by mail-lf0-f43.google.com with SMTP id j11so107761212lfb.1 for ; Sat, 09 Apr 2016 07:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=oWy2RMgiSOo/GAYywpeTCbxPb9G5OfkUU+r1gOR1Ft4=; b=GVTukgwWemtPXFKvXOiKTV6dI4zFZEW1FPLOleDTfo3xAa5Yrdv0/Z0oYr0KgVZxJu KdVRnufaZVaGqdQ/+GUgdiqEPYLO2umtQ8eyUEwl9/sTDWO4N1fyXMP3Tesv0wNpzuWG PcO1/6Ns6B78pOyWc4oKIMAP4i4STQVW95zrE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oWy2RMgiSOo/GAYywpeTCbxPb9G5OfkUU+r1gOR1Ft4=; b=b1XBFsuojptly3wqojYLj8SVNvr7z+NXbwNeCqkEJUCP5sBK5rMRzXA3Rk1By6kWT5 6NIJiaXBOxCKfVWh4lbt6kmgNviMBke2t1NFF4UNbUc1RFPjFLHol4TMaOTLHDDClGHZ WDvQpf+uMwoF42el5Q9CAGxXvDYvdT8ttOv/nOLO++BS57IE/J4aZp1QNn2IW/0rJl1u XiXGbhPMenbFISLW/3VH7PXEyrmOrXbqlBlJTICdYWYySjauZdAHfjFuOcPBd8gA7quS Sp9g7vBLFGDawme2KfR+2GJSU/2TCbNRW8sTRLN5mbtVRBsRrfauzcIWb0H4+1RMIfpy jaOQ== X-Gm-Message-State: AOPr4FU0mpYZaIm1jCtNCKMADtqQSnwiDrrC8B3dfapCDfqI9UO4D2h71Bz8REjvUzM0Ajfd X-Received: by 10.25.196.195 with SMTP id u186mr2697388lff.164.1460211208865; Sat, 09 Apr 2016 07:13:28 -0700 (PDT) Received: from localhost.localdomain.localdomain (c-927b71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.123.146]) by smtp.gmail.com with ESMTPSA id hw7sm2773259lbb.40.2016.04.09.07.13.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Apr 2016 07:13:27 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot Cc: Linus Walleij , Peter Hung , Andreas Bofjall , Simon Guinot Subject: [PATCH 1/2] gpio: f7188x: use BIT() macro Date: Sat, 9 Apr 2016 16:13:24 +0200 Message-Id: <1460211204-2761-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Align to how we handle bitmasks in most drivers in the subsystem: using the BIT(n) macro over (1 << n). Cc: Peter Hung Cc: Andreas Bofjall Cc: Simon Guinot Signed-off-by: Linus Walleij --- drivers/gpio/gpio-f7188x.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c index daac2d480db1..8b10fbf787f8 100644 --- a/drivers/gpio/gpio-f7188x.c +++ b/drivers/gpio/gpio-f7188x.c @@ -15,7 +15,8 @@ #include #include #include -#include +#include +#include #define DRVNAME "gpio-f7188x" @@ -217,7 +218,7 @@ static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset) superio_select(sio->addr, SIO_LD_GPIO); dir = superio_inb(sio->addr, gpio_dir(bank->regbase)); - dir &= ~(1 << offset); + dir &= ~BIT(offset); superio_outb(sio->addr, gpio_dir(bank->regbase), dir); superio_exit(sio->addr); @@ -238,7 +239,7 @@ static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset) superio_select(sio->addr, SIO_LD_GPIO); dir = superio_inb(sio->addr, gpio_dir(bank->regbase)); - dir = !!(dir & (1 << offset)); + dir = !!(dir & BIT(offset)); if (dir) data = superio_inb(sio->addr, gpio_data_out(bank->regbase)); else @@ -246,7 +247,7 @@ static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset) superio_exit(sio->addr); - return !!(data & 1 << offset); + return !!(data & BIT(offset)); } static int f7188x_gpio_direction_out(struct gpio_chip *chip, @@ -264,13 +265,13 @@ static int f7188x_gpio_direction_out(struct gpio_chip *chip, data_out = superio_inb(sio->addr, gpio_data_out(bank->regbase)); if (value) - data_out |= (1 << offset); + data_out |= BIT(offset); else - data_out &= ~(1 << offset); + data_out &= ~BIT(offset); superio_outb(sio->addr, gpio_data_out(bank->regbase), data_out); dir = superio_inb(sio->addr, gpio_dir(bank->regbase)); - dir |= (1 << offset); + dir |= BIT(offset); superio_outb(sio->addr, gpio_dir(bank->regbase), dir); superio_exit(sio->addr); @@ -292,9 +293,9 @@ static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) data_out = superio_inb(sio->addr, gpio_data_out(bank->regbase)); if (value) - data_out |= (1 << offset); + data_out |= BIT(offset); else - data_out &= ~(1 << offset); + data_out &= ~BIT(offset); superio_outb(sio->addr, gpio_data_out(bank->regbase), data_out); superio_exit(sio->addr);