From: Rob Herring Date: Mon, 2 Mar 2015 21:30:58 +0000 (-0600) Subject: gpio: pxa: simplify BANK_OFF macro offset calculation X-Git-Tag: v4.1-rc1~91^2~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e970b7d6d4fb3d715a34842ec00646f4b94bd72;p=platform%2Fkernel%2Flinux-exynos.git gpio: pxa: simplify BANK_OFF macro offset calculation The macro BANK_OFF which calculates the base offset for each GPIO port. The macro is needlessly complex and unreadable. Simplify the calculation to a simple math operation. Signed-off-by: Rob Herring Cc: linux-gpio@vger.kernel.org Reviewed-by: Alexandre Courbot Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 2fdb04b..cdbbcf0 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c @@ -59,8 +59,7 @@ #define GAFR_OFFSET 0x54 #define ED_MASK_OFFSET 0x9C /* GPIO edge detection for AP side */ -#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : ((n) > 5 ? 0x200 : 0x100) \ - + (((n) % 3) << 2)) +#define BANK_OFF(n) (((n) / 3) << 8) + (((n) % 3) << 2) int pxa_last_gpio; static int irq_base;