lkml.org 
[lkml]   [2023]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1] gpio: mmio: handle "ngpios" properly in bgpio_init
On Fri, Feb 24, 2023 at 7:40 PM Asmaa Mnebhi <asmaa@nvidia.com> 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

\
 
 \ /
  Last update: 2023-03-27 00:35    [W:0.028 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site