Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: Lee Jones <lee@kernel.org>, Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH 2/3] gpio: timberdale: use device properties
Date: Fri, 13 Mar 2026 12:21:49 +0200	[thread overview]
Message-ID: <abPlPQMPZyOL_byn@ashevche-desk.local> (raw)
In-Reply-To: <20260313-gpio-timberdale-swnode-v1-2-4df2e9b1dab5@oss.qualcomm.com>

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



  reply	other threads:[~2026-03-13 10:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 10:04 [PATCH 0/3] gpio: timberdale: remove platform data header Bartosz Golaszewski
2026-03-13 10:04 ` [PATCH 1/3] mfd: timberdale: set up a software node for the GPIO cell Bartosz Golaszewski
2026-03-13 10:04 ` [PATCH 2/3] gpio: timberdale: use device properties Bartosz Golaszewski
2026-03-13 10:21   ` Andy Shevchenko [this message]
2026-03-13 10:24     ` Andy Shevchenko
2026-03-13 13:27     ` Bartosz Golaszewski
2026-03-13 14:08       ` Andy Shevchenko
2026-03-16 13:58   ` Linus Walleij
2026-03-13 10:04 ` [PATCH 3/3] gpio: timberdale: remove platform data header Bartosz Golaszewski
2026-03-13 10:24   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abPlPQMPZyOL_byn@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=lee@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox