From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH 5/5] pinctrl-baytrail: fix to avoid sparse warnings
Date: Wed, 10 Jul 2013 14:55:40 +0300 [thread overview]
Message-ID: <1373457340-16666-6-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <1373457340-16666-1-git-send-email-andriy.shevchenko@linux.intel.com>
There are couple of sparse warnings we could avoid if we use a bit verbose
version of the code in byt_gpio_direction_output().
drivers/pinctrl/pinctrl-baytrail.c:266:45: warning: dubious: x | !y
drivers/pinctrl/pinctrl-baytrail.c:267:36: warning: dubious: x | !y
Additionally simplify a bit the code in byt_gpio_direction_input().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/pinctrl-baytrail.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
index 14e1e22..f808b4b 100644
--- a/drivers/pinctrl/pinctrl-baytrail.c
+++ b/drivers/pinctrl/pinctrl-baytrail.c
@@ -245,7 +245,7 @@ static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
spin_lock_irqsave(&vg->lock, flags);
value = readl(reg) | BYT_DIR_MASK;
- value = value & (~BYT_INPUT_EN); /* active low */
+ value &= ~BYT_INPUT_EN; /* active low */
writel(value, reg);
spin_unlock_irqrestore(&vg->lock, flags);
@@ -263,9 +263,13 @@ static int byt_gpio_direction_output(struct gpio_chip *chip,
spin_lock_irqsave(&vg->lock, flags);
- reg_val = readl(reg) | (BYT_DIR_MASK | !!value);
- reg_val &= ~(BYT_OUTPUT_EN | !value);
- writel(reg_val, reg);
+ reg_val = readl(reg) | BYT_DIR_MASK;
+ reg_val &= ~BYT_OUTPUT_EN;
+
+ if (value)
+ writel(reg_val | BYT_LEVEL, reg);
+ else
+ writel(reg_val & ~BYT_LEVEL, reg);
spin_unlock_irqrestore(&vg->lock, flags);
--
1.8.3.2
next prev parent reply other threads:[~2013-07-10 11:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-10 11:55 [PATCH 0/5] pinctrl-baytrail: miscellaneous minor fixes Andy Shevchenko
2013-07-10 11:55 ` [PATCH 1/5] pinctrl-baytrail: fix indentations Andy Shevchenko
2013-07-22 20:47 ` Linus Walleij
2013-07-10 11:55 ` [PATCH 2/5] pinctrl-baytrail: change lvl to level Andy Shevchenko
2013-07-10 13:42 ` [PATCH v1.5] " Andy Shevchenko
2013-07-22 20:48 ` Linus Walleij
2013-07-10 11:55 ` [PATCH 3/5] pinctrl-baytrail: remove redundant ptr variable Andy Shevchenko
2013-07-22 20:49 ` Linus Walleij
2013-07-10 11:55 ` [PATCH 4/5] pinctrl-baytrail: introduce to_byt_gpio() macro Andy Shevchenko
2013-07-22 20:50 ` Linus Walleij
2013-07-10 11:55 ` Andy Shevchenko [this message]
2013-07-22 20:51 ` [PATCH 5/5] pinctrl-baytrail: fix to avoid sparse warnings Linus Walleij
2013-07-15 10:24 ` [PATCH 0/5] pinctrl-baytrail: miscellaneous minor fixes Andy Shevchenko
2013-07-15 18:34 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1373457340-16666-6-git-send-email-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox