Commit 496940c10278599528cfbde0e05208bf4ef0c7c0

Authored by Andy Shevchenko
Committed by Linus Walleij
1 parent 17e5246429

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>

Showing 1 changed file with 8 additions and 4 deletions Side-by-side Diff

drivers/pinctrl/pinctrl-baytrail.c
... ... @@ -245,7 +245,7 @@
245 245 spin_lock_irqsave(&vg->lock, flags);
246 246  
247 247 value = readl(reg) | BYT_DIR_MASK;
248   - value = value & (~BYT_INPUT_EN); /* active low */
  248 + value &= ~BYT_INPUT_EN; /* active low */
249 249 writel(value, reg);
250 250  
251 251 spin_unlock_irqrestore(&vg->lock, flags);
... ... @@ -263,9 +263,13 @@
263 263  
264 264 spin_lock_irqsave(&vg->lock, flags);
265 265  
266   - reg_val = readl(reg) | (BYT_DIR_MASK | !!value);
267   - reg_val &= ~(BYT_OUTPUT_EN | !value);
268   - writel(reg_val, reg);
  266 + reg_val = readl(reg) | BYT_DIR_MASK;
  267 + reg_val &= ~BYT_OUTPUT_EN;
  268 +
  269 + if (value)
  270 + writel(reg_val | BYT_LEVEL, reg);
  271 + else
  272 + writel(reg_val & ~BYT_LEVEL, reg);
269 273  
270 274 spin_unlock_irqrestore(&vg->lock, flags);
271 275