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

Commit 5ca5f92c authored by Russell King's avatar Russell King Committed by Linus Walleij
Browse files

gpio: omap: simplify get() method



omap_gpio_get() calls omap_get_gpio_datain() or omap_get_gpio_dataout()
to read the GPIO state. These two functions are only called from this
method, so they don't add much value.  Move their contents into
omap_gpio_get() method and simplify.

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 40bb2273
Loading
Loading
Loading
Loading
+6 −19
Original line number Diff line number Diff line
@@ -146,20 +146,6 @@ static void omap_set_gpio_dataout_mask(struct gpio_bank *bank, unsigned offset,
	bank->context.dataout = l;
}

static int omap_get_gpio_datain(struct gpio_bank *bank, int offset)
{
	void __iomem *reg = bank->base + bank->regs->datain;

	return (readl_relaxed(reg) & (BIT(offset))) != 0;
}

static int omap_get_gpio_dataout(struct gpio_bank *bank, int offset)
{
	void __iomem *reg = bank->base + bank->regs->dataout;

	return (readl_relaxed(reg) & (BIT(offset))) != 0;
}

/* set multiple data out values using dedicate set/clear register */
static void omap_set_gpio_dataout_reg_multiple(struct gpio_bank *bank,
					       unsigned long *mask,
@@ -973,14 +959,15 @@ static int omap_gpio_input(struct gpio_chip *chip, unsigned offset)

static int omap_gpio_get(struct gpio_chip *chip, unsigned offset)
{
	struct gpio_bank *bank;

	bank = gpiochip_get_data(chip);
	struct gpio_bank *bank = gpiochip_get_data(chip);
	void __iomem *reg;

	if (omap_gpio_is_input(bank, offset))
		return omap_get_gpio_datain(bank, offset);
		reg = bank->base + bank->regs->datain;
	else
		return omap_get_gpio_dataout(bank, offset);
		reg = bank->base + bank->regs->dataout;

	return (readl_relaxed(reg) & BIT(offset)) != 0;
}

static int omap_gpio_output(struct gpio_chip *chip, unsigned offset, int value)