Re: [PATCH v6 3/3] mmc: atmel-mci: Move card detect gpio polarity quirk to gpiolib

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 25 Aug 2023 at 13:45, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
>
> On Fri, Aug 25, 2023 at 11:53 AM Balamanikandan Gunasundar
> <balamanikandan.gunasundar@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx>
> > Suggested-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
>
> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
>
> > +#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




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux