Re: [PATCH 1/2] gpio: rdc321x: Fix off-by-one for ngpio setting

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

 



2014-04-23 21:25 GMT+08:00 Linus Walleij <linus.walleij@xxxxxxxxxx>:
> On Fri, Apr 11, 2014 at 8:14 AM, Axel Lin <axel.lin@xxxxxxxxxx> wrote:
>
>> The valid gpio is GPIO0 ~ GPIO58, so ngpio should be RDC321X_MAX_GPIO + 1.
>>
>> Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx>
> (...)
>> -       rdc321x_gpio_dev->chip.ngpio = pdata->max_gpios;
>> +       rdc321x_gpio_dev->chip.ngpio = pdata->max_gpios + 1;
>
> This is counter-intuitive. "max_gpios" should be a name for the
> maximum number of gpios right? Not the maximum number of
> GPIOs minus one!
>
> It is better to patch include/linux/mfd/rdc321x.h:
>
> -#define RDC321X_MAX_GPIO    58
> +#define RDC321X_MAX_GPIO    59
Hi Linus,

I'm wondering if it is better to define RDC321X_NUM_GPIO  (59) rather
than RDC321X_MAX_GPIO.
How do you think?

Regards,
Axel
--
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