[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdahEcKgR9gR7iU0cW_aDTReDYBKdP+5_F+hGcarCjG9gg@mail.gmail.com>
Date: Fri, 25 Aug 2023 13:45:20 +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 v6 3/3] mmc: atmel-mci: Move card detect gpio polarity
quirk to gpiolib
On Fri, Aug 25, 2023 at 11:53 AM 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>
> Suggested-by: Linus Walleij <linus.walleij@...aro.org>
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
> +#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
> + /*
> + * The Atmel HSMCI has compatible property in the parent node and
> + * gpio property in a child node
> + */
> + if (of_device_is_compatible(np->parent, "atmel,hsmci")) {
> + np_compat = np->parent;
> + np_propname = np;
> + }
> +#endif
You don't need to use the preprocessor actually, what I did in my
example works:
if (IS_ENABLED()... && of_device_is_compatible()...) {
...
}
If the first expression in the if() clause is constant false, the compiler
will optimize out the entire if()-clause. At least the compilers we care
about.
Yours,
Linus Walleij
Powered by blists - more mailing lists