Re: [PATCH 3/4] gpio: loongson1: Add DT support
From: andy . shevchenko
Date: Wed Feb 22 2023 - 07:37:49 EST
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.
...
> + 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?
...
> + 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.
...
> +static const struct of_device_id ls1x_gpio_dt_ids[] = {
> + { .compatible = "loongson,ls1x-gpio", },
Inner comma is not needed.
> + { /* sentinel */ }
> +};
You missed MODULE_DEVICE_TABLE().
--
With Best Regards,
Andy Shevchenko