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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vdz=P=HrjyhT=dQFJt0LmqzBG2Cmw=sCBmU-RCwkQ3uUw@mail.gmail.com>
Date:   Fri, 24 Feb 2023 22:48:37 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Asmaa Mnebhi <asmaa@...dia.com>
Cc:     linus.walleij@...aro.org, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] gpio: mmio: handle "ngpios" properly in bgpio_init()

On Fri, Feb 24, 2023 at 9:20 PM Asmaa Mnebhi <asmaa@...dia.com> wrote:
>
> bgpio_init() uses "sz" argument to populate ngpio, which is not
> accurate. 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.

...

> +       ret = device_property_present(dev, "ngpios");
> +       if (!ret)

ret is not of the correct type for this call.

Why not simply

    if (!device_property_present(dev, "ngpios"))

> +               gc->ngpio = gc->bgpio_bits;

...

The problem with this change is that you need to provide bgpio_bits.

So, if there is a property when bgpio_bits will be updated?

That's said what you need is something like this:
1) split "ngpios" handling code (lines ~718-744 in gpiolib.c)  into a
helper function that is available inside drivers/gpio;
2) use it in bgpio_init() by overriding bgpio_bits.

ret = new_helper();
if (ret)
    gc->bgpio_bits = sz * 8;
else
    ... = gc->ngpio;


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ