From patchwork Mon Mar 19 00:50:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 131984 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2139764ljb; Sun, 18 Mar 2018 17:51:31 -0700 (PDT) X-Google-Smtp-Source: AG47ELviPwGrB41ANOkq/1bl3KNC2QMo78JLALC19trOq3epNi8OwSKE8E58lqVk8jU8z3wpbZMN X-Received: by 2002:a17:902:6e8c:: with SMTP id v12-v6mr10369332plk.24.1521420690889; Sun, 18 Mar 2018 17:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521420690; cv=none; d=google.com; s=arc-20160816; b=cTl2s88zxWjI8O//Bu5oYd9LDNMRHfuOcnS/rt+jYIRgFzbSK7MJHVvCAzV1AVqq8Q sGTy8r/BW/yYZY/9/wDQZsZP1Bu7PtK6dpFUMd6o+KI4tvkiSJlT0w/UrvJ1AwLDZ6bo He8a9s+9UGOp7BOyUOR0l2A9Z/gt21tGTuCb9N0gxRDunmIsM2ZkCIH1GA7S1XJpG+MR YD6t7GDDqXyC9u2xDPEha1UTb6y8NPUoBJxmBvZw7S56CqHoWJTu+qXUgxmp1OXeqSB4 9rqM3jsX1OZfCLmM/Rxdu9mstaQ7nB+BSxHxyj8jL5/L23D+4oNG8l6QutD3Z7t8NvbW zthQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Yz/gl5JElJKUWU5dINhhYPvGy3jFT9XaP3E33bnof9c=; b=qafomSuLf9jtIdnOA5DjAJwxz5emH80UAK1UDp908b8btg4GKYbnuihGHp5i0e+urY D4qNpj/AtEXLB3gGQJPmnWqv4eawqoHwdAZWqAHIehec7bSpGTMCgrbW6WJ9rL6UzyC7 oZqG1VKpj0Lt5z+5T1hMH2du6pIrSD3hNJZKPRqCLcJD3LraCPLmeOuJT20Cqqz3DAnK 0WP7Ky6de/U4sWQVomspAyFmE0FavEfY2Vd7NY8RnZuMfH7d4AXn/iMHFr/5C/4c/URi UfhwfZQ8u9PfTmEDsP0A9XPLMNh2AOSkn0xHvSvPitjOh8yUPcfd1Bg5UK/zS27RiuQc mNhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bswFytv5; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si4038677pgo.720.2018.03.18.17.51.30; Sun, 18 Mar 2018 17:51:30 -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 header.s=google header.b=bswFytv5; 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754673AbeCSAva (ORCPT + 5 others); Sun, 18 Mar 2018 20:51:30 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:41252 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754805AbeCSAv3 (ORCPT ); Sun, 18 Mar 2018 20:51:29 -0400 Received: by mail-pl0-f67.google.com with SMTP id b7-v6so5160099plr.8 for ; Sun, 18 Mar 2018 17:51:29 -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:in-reply-to:references; bh=EfDXCwCIz6wmicITuiUftRqZLL/4iUs0SbEMRQhU69c=; b=bswFytv5QL+dHDStfBSIfYhQeS3kFjtu56WMOnUjh7Gp3R07Daac33NuhVVpVggEw2 ropKKtETBiFvNY+XYNOLvlwmK+FsTqXekmNqVNcfvr0NRxbtce7ReXqN1KxfXdsHERMe 0jiMxqX5G4xRmoYlWr6XElBTDQCbASWX1Leg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EfDXCwCIz6wmicITuiUftRqZLL/4iUs0SbEMRQhU69c=; b=PH/tAURixSs/6QPttNy1nX6v27QBypXIUdcFzLYSB9CSsqrpbYlzrV7d75zG5TRPTL c5u+wqpiGfI2uM67LzutOWPjgCxQbnkOif27rPTdCGbet7FANJklFeRi3IOhzXKKgnKS zZkagi8z54NVgzDjdX4Zd6VaUwUu1hUKYsYrxjFv2Pfi51K6Yq1+8roVLXs8Ecj4gT/J 7RnPV9F3C3UoFMPQiOZfCnmGRrsPTNehQBNdlj3FV/ZWCYQmF7tqAFggdN2l5rjkQqSo K1TisHbecHtYkzh11RqBlgvZUbadSfo7NEjvaEqCnd53M+zY6iAp0j4J/B8N8x2CEAnG PeJw== X-Gm-Message-State: AElRT7FCZqdD9Mn6ijlV2oZ+MX600BBQWTMe8kB2BwFJj1VqCAyMTLgb se5Sfbjy9xKX/dGu19tZhuxtlADvkJs7Gw== X-Received: by 2002:a17:902:24:: with SMTP id 33-v6mr10446780pla.341.1521420689024; Sun, 18 Mar 2018 17:51:29 -0700 (PDT) Received: from localhost.localdomain ([218.255.99.6]) by smtp.gmail.com with ESMTPSA id z15sm21766373pgr.68.2018.03.18.17.51.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Mar 2018 17:51:28 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij Subject: [PATCH 11/13] gpio: janz-ttl: Use BIT() macro Date: Mon, 19 Mar 2018 01:50:54 +0100 Message-Id: <20180319005056.7380-11-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180319005056.7380-1-linus.walleij@linaro.org> References: <20180319005056.7380-1-linus.walleij@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This makes the code more readable by using the BIT() macro. Signed-off-by: Linus Walleij --- drivers/gpio/gpio-janz-ttl.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- 2.14.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-janz-ttl.c b/drivers/gpio/gpio-janz-ttl.c index e9f4612cd2cc..6b9bf8b7bf16 100644 --- a/drivers/gpio/gpio-janz-ttl.c +++ b/drivers/gpio/gpio-janz-ttl.c @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -33,9 +34,9 @@ #define MASTER_INT_CTL 0x00 #define MASTER_CONF_CTL 0x01 -#define CONF_PAE (1 << 2) -#define CONF_PBE (1 << 7) -#define CONF_PCE (1 << 4) +#define CONF_PAE BIT(2) +#define CONF_PBE BIT(7) +#define CONF_PCE BIT(4) struct ttl_control_regs { __be16 portc; @@ -74,7 +75,7 @@ static int ttl_get_value(struct gpio_chip *gpio, unsigned offset) } spin_lock(&mod->lock); - ret = *shadow & (1 << offset); + ret = *shadow & BIT(offset); spin_unlock(&mod->lock); return !!ret; } @@ -100,9 +101,9 @@ static void ttl_set_value(struct gpio_chip *gpio, unsigned offset, int value) spin_lock(&mod->lock); if (value) - *shadow |= (1 << offset); + *shadow |= BIT(offset); else - *shadow &= ~(1 << offset); + *shadow &= ~BIT(offset); iowrite16be(*shadow, port); spin_unlock(&mod->lock);