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

Commit cc647172 authored by Thomas Kunze's avatar Thomas Kunze Committed by Thomas Kunze
Browse files

SA1100: make gpio_to_irq and reverse a macro

The function can't be used for static initialisations so
convert them to macros.
parent 167c55ef
Loading
Loading
Loading
Loading
+4 −15
Original line number Diff line number Diff line
@@ -49,20 +49,9 @@ static inline void gpio_set_value(unsigned gpio, int value)

#define gpio_cansleep	__gpio_cansleep

static inline unsigned gpio_to_irq(unsigned gpio)
{
	if (gpio < 11)
		return IRQ_GPIO0 + gpio;
	else
		return IRQ_GPIO11 - 11 + gpio;
}

static inline unsigned irq_to_gpio(unsigned irq)
{
	if (irq < IRQ_GPIO11_27)
		return irq - IRQ_GPIO0;
	else
		return irq - IRQ_GPIO11 + 11;
}
#define gpio_to_irq(gpio)	((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
					(IRQ_GPIO11 - 11 + gpio))
#define irq_to_gpio(irq)	((irq < IRQ_GPIO11_27) ? (irq - IRQ_GPIO0) : \
					(irq - IRQ_GPIO11 + 11))

#endif