diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-07-10 14:55:40 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-07-23 01:23:27 +0200 |
commit | 496940c10278599528cfbde0e05208bf4ef0c7c0 (patch) | |
tree | 46e30538c372f5d1e335c6096b0bfb12e61f258a /drivers/pinctrl/pinctrl-baytrail.c | |
parent | 17e52464292320d0de260b146605d93326a9014c (diff) | |
download | linux-496940c10278599528cfbde0e05208bf4ef0c7c0.tar.bz2 |
pinctrl-baytrail: fix to avoid sparse warnings
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>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-baytrail.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-baytrail.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index 3bf7c948b7fc..2832576d8b12 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); |