Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40bb2273 authored by Russell King's avatar Russell King Committed by Linus Walleij
Browse files

gpio: omap: simplify omap_gpio_get_direction()



Architectures are single-copy atomic, which means that simply reading
a register is an inherently atomic operation.  There is no need to
take a spinlock here.

Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Tested-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent dfbc6c7a
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -953,17 +953,10 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)

static int omap_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
{
	struct gpio_bank *bank;
	unsigned long flags;
	void __iomem *reg;
	int dir;
	struct gpio_bank *bank = gpiochip_get_data(chip);

	bank = gpiochip_get_data(chip);
	reg = bank->base + bank->regs->direction;
	raw_spin_lock_irqsave(&bank->lock, flags);
	dir = !!(readl_relaxed(reg) & BIT(offset));
	raw_spin_unlock_irqrestore(&bank->lock, flags);
	return dir;
	return !!(readl_relaxed(bank->base + bank->regs->direction) &
		  BIT(offset));
}

static int omap_gpio_input(struct gpio_chip *chip, unsigned offset)