提交 642a8604 编写于 作者: M Michal Simek

gpio: xilinx: Simplify logic in xilinx_gpio_set_value

There is no reason to do read/write for if/else separately.
Reported-by: NStefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Signed-off-by: NMichal Simek <michal.simek@xilinx.com>
Reviewed-by: NStefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
上级 bf2a69de
...@@ -61,18 +61,17 @@ static int xilinx_gpio_set_value(struct udevice *dev, unsigned offset, ...@@ -61,18 +61,17 @@ static int xilinx_gpio_set_value(struct udevice *dev, unsigned offset,
if (ret) if (ret)
return ret; return ret;
val = readl(&platdata->regs->gpiodata + bank * 2);
debug("%s: regs: %lx, value: %x, gpio: %x, bank %x, pin %x\n", debug("%s: regs: %lx, value: %x, gpio: %x, bank %x, pin %x\n",
__func__, (ulong)platdata->regs, value, offset, bank, pin); __func__, (ulong)platdata->regs, value, offset, bank, pin);
if (value) { if (value)
val = readl(&platdata->regs->gpiodata + bank * 2);
val = val | (1 << pin); val = val | (1 << pin);
writel(val, &platdata->regs->gpiodata + bank * 2); else
} else {
val = readl(&platdata->regs->gpiodata + bank * 2);
val = val & ~(1 << pin); val = val & ~(1 << pin);
writel(val, &platdata->regs->gpiodata + bank * 2);
} writel(val, &platdata->regs->gpiodata + bank * 2);
return val; return val;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册