On Sat, Jul 19, 2014 at 6:14 AM, Alexandre Courbot <gnurou@xxxxxxxxx> wrote: > On Fri, Jul 18, 2014 at 6:52 PM, Lars-Peter Clausen <lars@xxxxxxxxxx> wrote: >> +static int zynq_gpio_get_bank_offset(unsigned int bank) >> +{ >> + switch (bank) { >> + case 0: >> + return ZYNQ_GPIO_BANK0_PIN_MIN; >> + case 1: >> + return ZYNQ_GPIO_BANK1_PIN_MIN; >> + case 2: >> + return ZYNQ_GPIO_BANK2_PIN_MIN; >> + case 3: >> + return ZYNQ_GPIO_BANK3_PIN_MIN; >> + default: >> + /* We'll never get here */ >> + return -1; >> + } >> +} > > Wouldn't this be handled better by a simple, static array? I.e. > > static int zynq_gpio_bank_offset[] = { > ZYNQ_GPIO_BANK0_PIN_MIN, > ZYNQ_GPIO_BANK1_PIN_MIN, > ZYNQ_GPIO_BANK2_PIN_MIN, > ZYNQ_GPIO_BANK3_PIN_MIN > }; > > ... > > int bank offset = zynq_gpio_bank_offset(bank_num); I agree, Lars-Peter can you please rewrite the patch to do it this way instead. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html