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: <CAHp75Vd4m79RhG-_KLRNzr0SPzphG07fOiTWwmGCfx8Lz=+6Vg@mail.gmail.com>
Date:   Fri, 24 Mar 2023 14:07:18 +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 v1] gpio: mmio: fix calculation of bgpio_bits

On Thu, Mar 23, 2023 at 10:57 PM Asmaa Mnebhi <asmaa@...dia.com> wrote:
>
> If the "ngpios" property is specified, bgpio_bits is calculated
> as the round up value of ngpio. At the moment, the only requirement
> specified is that the round up value must be a multiple of 8 but
> it should also be a power of 2 because we provide accessors based
> on the bank size in bgpio_setup_accessors().

Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Signed-off-by: Asmaa Mnebhi <asmaa@...dia.com>
> ---
>  drivers/gpio/gpio-mmio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
> index b52a3dd511ca..74fdf0d87b2c 100644
> --- a/drivers/gpio/gpio-mmio.c
> +++ b/drivers/gpio/gpio-mmio.c
> @@ -623,7 +623,7 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev,
>         if (ret)
>                 gc->ngpio = gc->bgpio_bits;
>         else
> -               gc->bgpio_bits = round_up(gc->ngpio, 8);
> +               gc->bgpio_bits = roundup_pow_of_two(round_up(gc->ngpio, 8));
>
>         ret = bgpio_setup_io(gc, dat, set, clr, flags);
>         if (ret)
> --
> 2.30.1
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ