Re: [PATCH 2/3] gpio: timberdale: use device properties

From: Andy Shevchenko

Date: Fri Mar 13 2026 - 06:22:18 EST


On Fri, Mar 13, 2026 at 11:04:49AM +0100, Bartosz Golaszewski wrote:
> The top-level MFD driver now passes the device properties to the GPIO
> cell via the software node. Use generic device property accessors and
> stop using platform data. We can ignore the "ngpios" property here now
> as it will be retrieved internally by GPIO core.

...

> + err = device_property_read_u32(dev, "intel,gpio-base", &gc->base);

In drivers/mfd/intel_quark_i2c_gpio.c we use 'gpio-base' and I prefer to have
it common since it's Linux only property for now. Alternatively patch that to
have a snps prefix.

> + if (err)
> + return err;

...

> err = devm_gpiochip_add_data(&pdev->dev, gc, tgpio);
> if (err)
> return err;
>
> + if (gc->ngpio > 32)
> + return dev_err_probe(dev, -EINVAL, "Invalid number of pins\n");
> +
> /* make sure to disable interrupts */
> iowrite32(0x0, tgpio->membase + TGPIO_IER);
>
> if (irq < 0 || tgpio->irq_base <= 0)
> return 0;
>
> - for (i = 0; i < pdata->nr_pins; i++) {
> + for (i = 0; i < gc->ngpio; i++) {
> irq_set_chip_and_handler(tgpio->irq_base + i,
> &timbgpio_irqchip, handle_simple_irq);
> irq_set_chip_data(tgpio->irq_base + i, tgpio);

Shouldn't this be done in the respective callbacks before the
devm_gpiochip_add_data() finishes? (Yes, it's not related to this
patch, but it is related to seems racy driver initialisation.

--
With Best Regards,
Andy Shevchenko