[v2,09/14] gpio: dwapb: Switch to more usual pattern of RMW in dwapb_gpio_set_debounce()

Message ID 20200415141534.31240-10-andriy.shevchenko@linux.intel.com
State Superseded
Headers show
  • gpio: dwapb: Clean up the driver and a fix
Related show

Commit Message

Andy Shevchenko April 15, 2020, 2:15 p.m.
More usual pattern is to prepare value and then write it in a single place.
Switch code in dwapb_gpio_set_debounce() to it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
 drivers/gpio/gpio-dwapb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 4edac592c253..0b073cbc003b 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -327,9 +327,10 @@  static int dwapb_gpio_set_debounce(struct gpio_chip *gc,
 	val_deb = dwapb_read(gpio, GPIO_PORTA_DEBOUNCE);
 	if (debounce)
-		dwapb_write(gpio, GPIO_PORTA_DEBOUNCE, val_deb | mask);
+		val_deb |= mask;
-		dwapb_write(gpio, GPIO_PORTA_DEBOUNCE, val_deb & ~mask);
+		val_deb &= ~mask;
+	dwapb_write(gpio, GPIO_PORTA_DEBOUNCE, val_deb);
 	spin_unlock_irqrestore(&gc->bgpio_lock, flags);