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]
Date:   Wed, 23 Aug 2023 14:41:14 +0200
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Balamanikandan Gunasundar 
        <balamanikandan.gunasundar@...rochip.com>
Cc:     dmitry.torokhov@...il.com, ulf.hansson@...aro.org,
        linux-kernel@...r.kernel.org, linux-mmc@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        ludovic.desroches@...rochip.com, nicolas.ferre@...rochip.com,
        alexandre.belloni@...tlin.com, hari.prasathge@...rochip.com
Subject: Re: [PATCH v5 3/3] mmc: atmel-mci: Move card detect gpio polarity
 quirk to gpiolib

Hi Balamanikandan,

thanks for your patch!

On Wed, Aug 23, 2023 at 12:40 PM Balamanikandan Gunasundar
<balamanikandan.gunasundar@...rochip.com> wrote:

> The polarity of the card detection gpio is handled by the "cd-inverted"
> property in the device tree. Move this inversion logic to gpiolib to avoid
> reading the gpio raw value.
>
> Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@...rochip.com>
(...)
>  drivers/gpio/gpiolib-of.c    |  7 +++++++

Patching here is the right approach!

> +#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
> +       if (of_device_is_compatible(np->parent, "atmel,hsmci") &&
> +           !strcmp(propname, "cd-gpios")) {
> +               active_high = of_property_read_bool(np, "cd-inverted");
> +               of_gpio_quirk_polarity(np, active_high, flags);
> +       }
> +#endif
>         for (i = 0; i < ARRAY_SIZE(gpios); i++) {
>                 if (of_device_is_compatible(np, gpios[i].compatible) &&
>                     !strcmp(propname, gpios[i].gpio_propname)) {

This duplicates the code right below. Can't you just add an entry to the
existing gpios[] array?

I would imagine:

    static const struct {
        const char *compatible;
        const char *gpio_propname;
        const char *polarity_propname;
    } gpios[] = {
#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
        { "atmel,hsmci", "cd-gpios", "cd-inverted" },
#endif
(...)


Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ