On Fri, Sep 9, 2022 at 11:56 AM Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx> wrote: > > GPIO library now accepts fwnode as a firmware node, so > switch the driver to use it. > > Tested-by: Arınç ÜNAL <arinc.unal@xxxxxxxxxx> > Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx> > --- > drivers/gpio/gpio-mt7621.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c > index d8a26e503ca5..05891dd3f96e 100644 > --- a/drivers/gpio/gpio-mt7621.c > +++ b/drivers/gpio/gpio-mt7621.c > @@ -9,7 +9,6 @@ > #include <linux/interrupt.h> > #include <linux/io.h> > #include <linux/module.h> > -#include <linux/of_irq.h> > #include <linux/platform_device.h> > #include <linux/spinlock.h> > > @@ -205,7 +204,8 @@ mediatek_gpio_xlate(struct gpio_chip *chip, > } > > static int > -mediatek_gpio_bank_probe(struct device *dev, int bank) > +mediatek_gpio_bank_probe(struct device *dev, > + struct fwnode_handle *fwnode, int bank) > { > struct mtk *mtk = dev_get_drvdata(dev); > struct mtk_gc *rg; > @@ -216,6 +216,7 @@ mediatek_gpio_bank_probe(struct device *dev, int bank) > memset(rg, 0, sizeof(*rg)); > > spin_lock_init(&rg->lock); > + rg->chip.fwnode = fwnode; > rg->bank = bank; > > dat = mtk->base + GPIO_REG_DATA + (rg->bank * GPIO_BANK_STRIDE); > @@ -290,7 +291,7 @@ static int > mediatek_gpio_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > - struct device_node *np = dev->of_node; > + struct fwnode_handle *fwnode = dev_fwnode(dev); > struct mtk *mtk; > int i; > int ret; > @@ -303,12 +304,12 @@ mediatek_gpio_probe(struct platform_device *pdev) > if (IS_ERR(mtk->base)) > return PTR_ERR(mtk->base); > > - mtk->gpio_irq = irq_of_parse_and_map(np, 0); > + mtk->gpio_irq = fwnode_irq_get(fwnode, 0); You can do even better and just use platform_get_irq(). Bart > mtk->dev = dev; > platform_set_drvdata(pdev, mtk); > > for (i = 0; i < MTK_BANK_CNT; i++) { > - ret = mediatek_gpio_bank_probe(dev, i); > + ret = mediatek_gpio_bank_probe(dev, fwnode, i); > if (ret) > return ret; > } > -- > 2.25.1 >