[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPDyKFqg7G_vTJnXXT6JSc7J9Vha8s+5gFBtQugE7nCFqCLj6Q@mail.gmail.com>
Date: Fri, 25 Aug 2023 14:14:46 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Balamanikandan Gunasundar
<balamanikandan.gunasundar@...rochip.com>,
dmitry.torokhov@...il.com, 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, 25 Aug 2023 at 13:45, Linus Walleij <linus.walleij@...aro.org> wrote:
>
> 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.
Looks nicer. Feel free to send a patch on top, so I can pick it up.
Kind regards
Uffe
Powered by blists - more mailing lists