Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <robh@kernel.org>
Cc: linux-gpio@vger.kernel.org
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Rob Herring and committed by
Linus Walleij
1e970b7d b90f8f22

+1 -2
+1 -2
drivers/gpio/gpio-pxa.c
··· 59 59 #define GAFR_OFFSET 0x54 60 60 #define ED_MASK_OFFSET 0x9C /* GPIO edge detection for AP side */ 61 61 62 - #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : ((n) > 5 ? 0x200 : 0x100) \ 63 - + (((n) % 3) << 2)) 62 + #define BANK_OFF(n) (((n) / 3) << 8) + (((n) % 3) << 2) 64 63 65 64 int pxa_last_gpio; 66 65 static int irq_base;