On Tue, Mar 3, 2015 at 6:30 AM, Rob Herring <[email protected]> wrote: > 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 <[email protected]> > Cc: Linus Walleij <[email protected]> > Cc: Alexandre Courbot <[email protected]> > Cc: [email protected] > --- > drivers/gpio/gpio-pxa.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c > index e45637b..d2324b9 100644 > --- a/drivers/gpio/gpio-pxa.c > +++ b/drivers/gpio/gpio-pxa.c > @@ -61,8 +61,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)
Seems to indeed compute the same output as the previous macro in a more readable way. Reviewed-by: Alexandre Courbot <[email protected]> -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
