Re: [PATCH 3/4] gpio: loongson1: Add DT support
From: Kelvin Cheung
Date: Thu Mar 02 2023 - 06:09:07 EST
On Wed, Feb 22, 2023 at 8:21 PM <andy.shevchenko@xxxxxxxxx> wrote:
>
> Wed, Feb 22, 2023 at 07:12:12PM +0800, Keguang Zhang kirjoitti:
> > This patch adds DT support for Loongson-1 GPIO driver,
> > including the following changes.
> > - Add the of_match_table
> > - Parse the ngpios property
> > - Parse the alias id
>
> Split!
>
> ...
>
> > + if (of_property_read_u32(dn, "ngpios", &ngpios)) {
> > + dev_err(dev, "Missing ngpios OF property\n");
> > + return -ENODEV;
> > + }
>
> Why?! GPIO library has this already.
>
Will make use of gpiolib and remove this part.
> ...
>
> > + id = of_alias_get_id(dn, "gpio");
> > + if (id < 0) {
> > + dev_err(dev, "Couldn't get OF id\n");
> > + return id;
> > + }
>
> What is this for?
>
Will remove this part.
> ...
>
> > + ls1x_gc->gc.base = pdev->id * BITS_PER_LONG;
> > - ls1x_gc->gc.base = pdev->id * 32;
>
> No way. This is change makes me thing that initially it's simply wrong. Please,
> just use -1 for the base.
>
Sure. And this is already done by bgpio_init().
So I will simply remove this line.
> ...
>
> > +static const struct of_device_id ls1x_gpio_dt_ids[] = {
> > + { .compatible = "loongson,ls1x-gpio", },
>
> Inner comma is not needed.
>
Will do.
> > + { /* sentinel */ }
> > +};
>
> You missed MODULE_DEVICE_TABLE().
>
Will add MODULE_DEVICE_TABLE().
> --
> With Best Regards,
> Andy Shevchenko
>
>
--
Best regards,
Kelvin Cheung