From: Laurent Pinchart Date: Mon, 8 Apr 2013 09:36:13 +0000 (+0200) Subject: gpio-rcar: Add RCAR_GP_PIN macro X-Git-Tag: next-20130527~8^2^13~116 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=42dbcf0dd04007ac3b55a3f2259926ae700732fa;p=karo-tx-linux.git gpio-rcar: Add RCAR_GP_PIN macro Pins are numbered in the R-Car family documentation using a bank number and a pin number in the bank. As the Linux pin number space is linear, we need to flatten this by multiplying the bank number by 32 and adding the pin number. The resulting number bear no directly visible relationship to the documentation, making it error-prone. Add a RCAR_GP_PIN macro to convert from the documentation pin number space to the linear Linux space. Signed-off-by: Laurent Pinchart [horms+renesas@verge.net.au: non-trivial rebase on top of "sh-pfc: r8a7779: Don't group USB OVC and PENC pins"] Signed-off-by: Simon Horman --- diff --git a/include/linux/platform_data/gpio-rcar.h b/include/linux/platform_data/gpio-rcar.h index b253f77a7ddf..cc472f6d8591 100644 --- a/include/linux/platform_data/gpio-rcar.h +++ b/include/linux/platform_data/gpio-rcar.h @@ -23,4 +23,6 @@ struct gpio_rcar_config { const char *pctl_name; }; +#define RCAR_GP_PIN(bank, pin) (((bank) * 32) + (pin)) + #endif /* __GPIO_RCAR_H__ */