]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
gpio: omap: simplify bank->level_mask
authorRussell King <rmk+kernel@armlinux.org.uk>
Mon, 10 Jun 2019 17:10:54 +0000 (20:10 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 12 Jun 2019 09:14:16 +0000 (11:14 +0200)
bank->level_mask is merely the bitwise or of the level detection
context which we have already read in this function.  Rather than
repeating additional reads, compute it from the values already
read.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-omap.c

index 8fdac6e4a929f4313c274b921d25db94d4c00579..369ce46e2b09fd51934b3801f6fbc47b5bd8579e 100644 (file)
@@ -325,6 +325,9 @@ static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio,
        bank->context.fallingdetect =
                        readl_relaxed(bank->base + bank->regs->fallingdetect);
 
+       bank->level_mask = bank->context.leveldetect0 |
+                          bank->context.leveldetect1;
+
        if (likely(!(bank->non_wakeup_gpios & gpio_bit))) {
                omap_gpio_rmw(base, bank->regs->wkup_en, gpio_bit, trigger != 0);
                bank->context.wake_en =
@@ -344,10 +347,6 @@ static inline void omap_set_gpio_trigger(struct gpio_bank *bank, int gpio,
                else
                        bank->enabled_non_wakeup_gpios &= ~gpio_bit;
        }
-
-       bank->level_mask =
-               readl_relaxed(bank->base + bank->regs->leveldetect0) |
-               readl_relaxed(bank->base + bank->regs->leveldetect1);
 }
 
 #ifdef CONFIG_ARCH_OMAP1