lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 18 Jan 2024 13:59:50 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Hector Palacios <hector.palacios@...i.com>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>, linus.walleij@...aro.org, robh+dt@...nel.org, 
	krzysztof.kozlowski+dt@...aro.org, andy@...nel.org, conor+dt@...nel.org, 
	shawnguo@...nel.org, s.hauer@...gutronix.de, kernel@...gutronix.de, 
	festevam@...il.com, linux-imx@....com, stefan@...er.ch, 
	linux-gpio@...r.kernel.org, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/3] gpio: vf610: add support to DT 'ngpios' property

On Thu, Jan 18, 2024 at 1:45 PM Hector Palacios
<hector.palacios@...i.com> wrote:
>
> On 1/18/24 13:03, Bartosz Golaszewski wrote:
> >
> > On Thu, Jan 18, 2024 at 10:04 AM Andy Shevchenko
> > <andy.shevchenko@...il.com> wrote:
> >>
> >> On Thu, Jan 18, 2024 at 10:25 AM Hector Palacios
> >> <hector.palacios@...i.com> wrote:
> >>> On 1/17/24 21:51, Andy Shevchenko wrote:
> >>>>> Some SoCs, such as i.MX93, don't have all 32 pins available
> >>>>> per port. Allow optional generic 'ngpios' property to be
> >>>>> specified from the device tree and default to
> >>>>> VF610_GPIO_PER_PORT (32) if the property does not exist.
> >>
> >> ...
> >>
> >>>>> +       ret = device_property_read_u32(dev, "ngpios", &ngpios);
> >>>>> +       if (ret || ngpios > VF610_GPIO_PER_PORT)
> >>>>> +               gc->ngpio = VF610_GPIO_PER_PORT;
> >>>>> +       else
> >>>>> +               gc->ngpio = (u16)ngpios;
> >>>>
> >>>> This property is being read by the GPIOLIB core. Why do you need to repeat this?
> >>>
> >>> My apologies; I had not seen this.
> >>> I'll use gpiochip_get_ngpios() on the next iteration.
> >>
> >> But still why?
> >> https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib.c#L867
> >>
> >> It's called for every driver.
> >>
> >> Maybe it's needed to be refactored to allow fallbacks? Then can the
> >> GPIO MMIO case also be updated?
> >>
> >
> > I guess it's because Hector wants to set an upper limit on the number of GPIOs?
>
> I think Andy is suggesting to rework the gpio-vf610 driver to use
> bgpio_chip struct (it doesn't currently), and then I guess the 'ngpio'
> property gets read automatically if you call bgpio_init().

No, Andy said (and even provided a link to the code) that "ngpios" is
read ALWAYS when a new GPIO chip is registered with the GPIO core.
It's just that it doesn't impose any limits but that could be
addressed with imposing an upper limit in DT bindings maybe?

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ