All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] pinctrl: sunxi: dt: do not accumulate npins across probe attempts
@ 2026-10-07  6:01 Pablo Mazzini
  2026-10-12  8:40 ` Andre Przywara
  2026-10-12  9:30 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Pablo Mazzini @ 2026-10-07  6:01 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andre Przywara,
	linux-gpio, linux-arm-kernel, linux-sunxi, linux-kernel,
	Pablo Mazzini

init_pins_table() adds to npins in the driver's static descriptor, so
after a probe deferral the count doubles and the next probe fails with
"pin 0 already registered". Reset it first.

Signed-off-by: Pablo Mazzini <pmazzini@gmail.com>
---
v2: reset npins instead of counting into a local (Andre)

 drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c b/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c
index 50a16f3bd131..8bcd566593ae 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c
@@ -84,6 +84,7 @@ static struct sunxi_desc_pin *init_pins_table(struct device *dev,
 	 * Find the total number of pins.
 	 * Also work out how much memory we need to store all the pin names.
 	 */
+	desc->npins = 0;
 	for (i = 0; i < SUNXI_PINCTRL_MAX_BANKS; i++) {
 		desc->npins += pins_per_bank[i];
 		if (pins_per_bank[i] < 10) {
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] pinctrl: sunxi: dt: do not accumulate npins across probe attempts
  2026-10-07  6:01 [PATCH v2] pinctrl: sunxi: dt: do not accumulate npins across probe attempts Pablo Mazzini
@ 2026-10-12  8:40 ` Andre Przywara
  2026-10-12  9:30 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Andre Przywara @ 2026-10-12  8:40 UTC (permalink / raw)
  To: Pablo Mazzini, Linus Walleij
  Cc: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, linux-gpio,
	linux-arm-kernel, linux-sunxi, linux-kernel

Hi,

On 10/7/26 08:01, Pablo Mazzini wrote:
> init_pins_table() adds to npins in the driver's static descriptor, so
> after a probe deferral the count doubles and the next probe fails with
> "pin 0 already registered". Reset it first.

Yes, thanks, this is what I had in mind. And I think it deserves some 
backports:

> Signed-off-by: Pablo Mazzini <pmazzini@gmail.com>

Fixes: f5e2cd34b12f ("pinctrl: sunxi: allow reading mux values from DT")
Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
> v2: reset npins instead of counting into a local (Andre)
> 
>   drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c b/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c
> index 50a16f3bd131..8bcd566593ae 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi-dt.c
> @@ -84,6 +84,7 @@ static struct sunxi_desc_pin *init_pins_table(struct device *dev,
>   	 * Find the total number of pins.
>   	 * Also work out how much memory we need to store all the pin names.
>   	 */
> +	desc->npins = 0;
>   	for (i = 0; i < SUNXI_PINCTRL_MAX_BANKS; i++) {
>   		desc->npins += pins_per_bank[i];
>   		if (pins_per_bank[i] < 10) {


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] pinctrl: sunxi: dt: do not accumulate npins across probe attempts
  2026-10-07  6:01 [PATCH v2] pinctrl: sunxi: dt: do not accumulate npins across probe attempts Pablo Mazzini
  2026-10-12  8:40 ` Andre Przywara
@ 2026-10-12  9:30 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2026-10-12  9:30 UTC (permalink / raw)
  To: Pablo Mazzini
  Cc: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andre Przywara,
	linux-gpio, linux-arm-kernel, linux-sunxi, linux-kernel

On Wed, Oct 7, 2026 at 8:01 AM Pablo Mazzini <pmazzini@gmail.com> wrote:

> init_pins_table() adds to npins in the driver's static descriptor, so
> after a probe deferral the count doubles and the next probe fails with
> "pin 0 already registered". Reset it first.
>
> Signed-off-by: Pablo Mazzini <pmazzini@gmail.com>
> ---
> v2: reset npins instead of counting into a local (Andre)

Patch applied for fixes!

Yours,
Linus Walleij


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-12  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-07  6:01 [PATCH v2] pinctrl: sunxi: dt: do not accumulate npins across probe attempts Pablo Mazzini
2026-10-12  8:40 ` Andre Przywara
2026-10-12  9:30 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.