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: <CACRpkdbORVt9sFCnBFE1U206M92u4fjk9enbDJYZw7HJyAC=ng@mail.gmail.com>
Date:   Thu, 29 Dec 2022 01:23:18 +0100
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Balamanikandan Gunasundar 
        <balamanikandan.gunasundar@...rochip.com>
Cc:     ludovic.desroches@...rochip.com, nicolas.ferre@...rochip.com,
        alexandre.belloni@...tlin.com, linux-kernel@...r.kernel.org,
        linux-mmc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        hari.prasathge@...rochip.com, dmitry.torokhov@...il.com,
        ulf.hansson@...aro.org
Subject: Re: [PATCH v3 1/2] mmc: atmel-mci: Convert to gpio descriptors

Hi Balamanikandan,

thanks for your patch!

On Mon, Dec 26, 2022 at 8:39 AM Balamanikandan Gunasundar
<balamanikandan.gunasundar@...rochip.com> wrote:

> Replace the legacy GPIO APIs with gpio descriptor consumer interface.
>
> To maintain backward compatibility, we rely on the "cd-inverted"
> property to manage the invertion flag instead of GPIO property.
>
> Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@...rochip.com>

Overall this looks really nice! I thought about converting this driver
but was a bit afraid of doing mistakes since it was a bit elaborate.
Nice that you use fwnode accessors!

Acked-by: Linus Walleij <linus.walleij@...aro.org>

Improvement to consider (can also be a separate patch):

> +       if (slot->detect_pin) {
> +               present = !(gpiod_get_raw_value(slot->detect_pin) ^
>                             slot->detect_is_active_high);

Normally we contain all this active low/high mess in mmc_of_parse(),
but I guess this doesn't work here because the of node is different
from the device :P

Since the code says *explicitly* "active high" not "inverted" as the
core code parses it, could you try just push this to gpiolib like
we usually do, by deleting the detect_is_active_high stuff and
just apply a patch like this?

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 4fff7258ee41..5979c9a75cf9 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -199,7 +199,9 @@ static void of_gpio_set_polarity_by_property(const
struct device_node *np,
                { "fsl,imx8mm-pcie", "reset-gpio", "reset-gpio-active-high" },
                { "fsl,imx8mp-pcie", "reset-gpio", "reset-gpio-active-high" },
 #endif
-
+#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
+               { "atmel,hsmci", "cd-gpios", "cd-inverted" },
+#endif
                /*
                 * The regulator GPIO handles are specified such that the
                 * presence or absence of "enable-active-high" solely controls

(It's fine to include in your MMC patch if some GPIO maintainer like
me ACK it.)

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ