Re: [PATCH 1/3] gpio: zynq: Take bank offset into account when reporting a IRQ

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux