OSDN Git Service

gpio: mpc8xxx: Do not reverse bits using bgpio
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 20 Oct 2017 14:08:12 +0000 (16:08 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 25 Oct 2017 09:25:40 +0000 (11:25 +0200)
commitb3222f7147e028d31f965f193b6f995147c64651
tree7f75b5c93892bc59543fed5adcc53e38da6fc502
parentd74423687f9d70417bfec68121cbd35f79bb170f
gpio: mpc8xxx: Do not reverse bits using bgpio

The MPC8xxx driver is always instantiating its generic GPIO functions
with the flag BGPIOF_BIG_ENDIAN. This means "big-endian bit order"
and means the bits representing the GPIO lines in the registers are
reversed around 31 bits so line 0 is at bit 31 and so forth down to
line 31 in bit 0.

Instead of looping into the generic MMIO gpio to do the simple
calculation of a bitmask, through a vtable call with two parameters
likely using stack frames etc (unless the compiler optimize it)
and obscuring the view for the programmer, let's just open-code
what the call does. This likely executes faster, saves space and
makes the code easier to read.

Cc: Liu Gang <Gang.Liu@nxp.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-mpc8xxx.c