Re: [PATCH v1] gpio: mmio: handle "ngpios" properly in bgpio_init

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

 



On Fri, Feb 24, 2023 at 7:40 PM Asmaa Mnebhi <asmaa@xxxxxxxxxx> wrote:
>
> bgpio_init uses "sz" argument to populate ngpio, which is not accurate.

bgpio_init() uses the

(Note parentheses, same for other func() mentions)

> Instead, read the "ngpios" property from the DT and if it
> doesn't exist, use the "sz" argument. With this change, drivers no
> longer need to overwrite the ngpio variable after calling bgpio_init.

Thank you!

...

> +       ret = device_property_read_u32(dev, "ngpios", &ngpios);
> +       if (!ret)
> +               gc->ngpio = ngpios;
> +       else
> +               gc->ngpio = gc->bgpio_bits;

This duplicates the GPIO library. What probably better to have is to
just check the property existence

device_property_present() and do accordingly.

-- 
With Best Regards,
Andy Shevchenko



[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