mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-02 10:23:55 +08:00
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>
This commit is contained in:
parent
17e5246429
commit
496940c102
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user