Re: [PATCH] mmc: atmel-mci: Convert to gpio descriptors

From: Dmitry Torokhov
Date: Thu Nov 10 2022 - 17:33:19 EST


Hi,

On Wed, Nov 09, 2022 at 03:48:32PM +0100, Linus Walleij wrote:
> On Wed, Nov 9, 2022 at 1:39 PM Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote:
> > On Wed, 9 Nov 2022 at 05:39, Balamanikandan Gunasundar
> (...)
> > > --- a/drivers/mmc/host/atmel-mci.c
> > > +++ b/drivers/mmc/host/atmel-mci.c
> > > @@ -19,7 +19,8 @@
> > > #include <linux/module.h>
> > > #include <linux/of.h>
> > > #include <linux/of_device.h>
> > > -#include <linux/of_gpio.h>
> > > +#include <linux/irq.h>
> > > +#include <linux/gpio/consumer.h>
>
> This is nice, but higher up the driver also #include <linux/gpio.h>
> so delete that line too, <linux/gpio/consumer.h> should be enough.
>
> > > - of_get_named_gpio(cnp, "cd-gpios", 0);
> > > + devm_gpiod_get_from_of_node(&pdev->dev, cnp,
> > > + "cd-gpios",
> > > + 0, GPIOD_IN, "cd-gpios");
> (...)
> > > pdata->slot[slot_id].wp_pin =
> > > - of_get_named_gpio(cnp, "wp-gpios", 0);
> > > + devm_gpiod_get_from_of_node(&pdev->dev, cnp,
> > > + "wp-gpios",
> > > + 0, GPIOD_IN, "wp-gpios");
>
> Hm. Dmitry is trying to get rid of of_get_named_gpio() I think.
>
> But I suppose we can migrate to fwnode later.

I'd much rather we changed this right away to

devm_fwnode_gpiod_get(&pdev->dev, of_fwnode_handle(cnp),
"wp", GPIOD_IN, "wp-gpios");

and not added new users of devm_gpiod_get_from_of_node() which is there
only 2 left.

Thanks!

--
Dmitry