Skip to contentSkip to conversation

pinctrl: Fix types in .pin_config_group_get() callbacks

PATCH In review Geert Uytterhoeven 5 participants 12 messages Apr 30 – May 5

Subsystems (8)
MIPS GPIO Arm MediaTek Pin control +4 more subsystems
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

cover pinctrl: Fix types in .pin_config_group_get() callbacks

Hi all,

On 64-bit platforms, "unsigned long" is 64-bit. However, when checking if all "unsigned long" configuration values passed to the .pin_config_group_get() callback are equal, several drivers use a 32-bit temporary. Fortunately this works, as currently all configuration values fit in 32-bit.

This series makes the code cleaner and more future-proof by changing the types of all temporaries to unsigned long.

I intend to queue patches 5 and 6 in renesas-pinctrl for v7.2. Thanks for your comments!

Geert Uytterhoeven (7):
pinctrl: airoha: Fix type in .pin_config_group_get() callback
pinctrl: equilibrium: Fix type in .pin_config_group_get() callback
pinctrl: ingenic: Fix type in .pin_config_group_get() callback
pinctrl: mediatek: moore: Fix type in .pin_config_group_get() callback
pinctrl: renesas: rzg2l: Fix type in .pin_config_group_get() callback
pinctrl: renesas: rzv2m: Fix type in .pin_config_group_get() callback
pinctrl: single: Fix type in .pin_config_group_get() callback

 drivers/pinctrl/mediatek/pinctrl-airoha.c | 2 +-
 drivers/pinctrl/mediatek/pinctrl-moore.c  | 3 ++-
 drivers/pinctrl/pinctrl-equilibrium.c     | 3 ++-
 drivers/pinctrl/pinctrl-ingenic.c         | 3 ++-
 drivers/pinctrl/pinctrl-single.c          | 3 ++-
 drivers/pinctrl/renesas/pinctrl-rzg2l.c   | 3 ++-
 drivers/pinctrl/renesas/pinctrl-rzv2m.c   | 3 ++-
 7 files changed, 13 insertions(+), 7 deletions(-)
Signature · 12 lines
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
author maintainer
#1 lore raw

PATCH 1/7 pinctrl: airoha: Fix type in .pin_config_group_get() callback

On 64-bit platforms, "unsigned long" is 64-bit. Hence checking if all "unsigned long" configuration values are equal should be done using an "unsigned long" temporary.

---
 drivers/pinctrl/mediatek/pinctrl-airoha.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/mediatek/pinctrl-airoha.c +1 -1
index 995ba6175c9504ba..e5a6a60fb3c660cb 100644
@@ -2811,7 +2811,7 @@ static int airoha_pinconf_group_get(struct pinctrl_dev *pctrl_dev,
 				    unsigned int group, unsigned long *config)
 {
 	struct airoha_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev);
-	u32 cur_config = 0;
+	unsigned long cur_config = 0;
 	int i;
 
 	for (i = 0; i < pinctrl->grps[group].npins; i++) {
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH 2/7 pinctrl: equilibrium: Fix type in .pin_config_group_get() callback

In reply to Geert Uytterhoeven

On 64-bit platforms, "unsigned long" is 64-bit. Hence checking if all "unsigned long" configuration values are equal should be done using an "unsigned long" temporary.

---
 drivers/pinctrl/pinctrl-equilibrium.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-equilibrium.c +2 -1
index ba1c867b7b891abb..349eb944b4ac880e 100644
@@ -532,8 +532,9 @@ static int eqbr_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
 static int eqbr_pinconf_group_get(struct pinctrl_dev *pctldev,
 				  unsigned int group, unsigned long *config)
 {
-	unsigned int i, npins, old = 0;
 	const unsigned int *pins;
+	unsigned int i, npins;
+	unsigned long old = 0;
 	int ret;
 
 	ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH 3/7 pinctrl: ingenic: Fix type in .pin_config_group_get() callback

In reply to Geert Uytterhoeven

On 64-bit platforms, "unsigned long" is 64-bit. Hence checking if all "unsigned long" configuration values are equal should be done using an "unsigned long" temporary.

While Ingenic is a 32-bit platform, it is still better to use the correct type, to serve as an example.

---
 drivers/pinctrl/pinctrl-ingenic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-ingenic.c +2 -1
index c7f14546de0528de..29d7f4e54bc7b126 100644
@@ -4334,7 +4334,8 @@ static int ingenic_pinconf_group_get(struct pinctrl_dev *pctldev,
 		unsigned int group, unsigned long *config)
 {
 	const unsigned int *pins;
-	unsigned int i, npins, old = 0;
+	unsigned int i, npins;
+	unsigned long old = 0;
 	int ret;
 
 	ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH 3/7] pinctrl: ingenic: Fix type in .pin_config_group_get() callback

Quoted 4 lines

Am 30.04.2026 um 17:33 schrieb Geert Uytterhoeven <[email protected]>:

Quoted 8 lines

On 64-bit platforms, "unsigned long" is 64-bit. Hence checking if all "unsigned long" configuration values are equal should be done using an "unsigned long" temporary.

While Ingenic is a 32-bit platform, it is still better to use the correct type, to serve as an example.

tested to show no visible difference on Ingenic X1600 based board (Letux X16) on top of v7.1-rc1.

BR and thanks,
Nikolaus

maintainer Acked-by on v1 3/7
#5 lore raw

Re: [PATCH 3/7] pinctrl: ingenic: Fix type in .pin_config_group_get() callback

In reply to Geert Uytterhoeven

Hi Geert,

Le jeudi 30 avril 2026 à 17:33 +0200, Geert Uytterhoeven a écrit :

Quoted 10 lines

On 64-bit platforms, "unsigned long" is 64-bit.  Hence checking if all
"unsigned long" configuration values are equal should be done using an
"unsigned long" temporary.

While Ingenic is a 32-bit platform, it is still better to use the correct type, to serve as an example.

Cheers,
-Paul

Quoted 21 lines

---
 drivers/pinctrl/pinctrl-ingenic.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-ingenic.c +2 -1
index c7f14546de0528de..29d7f4e54bc7b126 100644
@@ -4334,7 +4334,8 @@ static int ingenic_pinconf_group_get(struct
 pinctrl_dev *pctldev,
  		unsigned int group, unsigned long *config)
  {
  	const unsigned int *pins;
-	unsigned int i, npins, old = 0;
+	unsigned int i, npins;
+	unsigned long old = 0;
  	int ret;


  ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);

author maintainer
#6 lore raw

PATCH 4/7 pinctrl: mediatek: moore: Fix type in .pin_config_group_get() callback

In reply to Geert Uytterhoeven

On 64-bit platforms, "unsigned long" is 64-bit. Hence checking if all "unsigned long" configuration values are equal should be done using an "unsigned long" temporary.

---
 drivers/pinctrl/mediatek/pinctrl-moore.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/mediatek/pinctrl-moore.c +2 -1
index 071ba849e5322396..17e30f83dc1972c0 100644
@@ -402,7 +402,8 @@ static int mtk_pinconf_group_get(struct pinctrl_dev *pctldev,
 				 unsigned int group, unsigned long *config)
 {
 	const unsigned int *pins;
-	unsigned int i, npins, old = 0;
+	unsigned int i, npins;
+	unsigned long old = 0;
 	int ret;
 
 	ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
Signature · 1 line
2.43.0
author maintainer
#7 lore raw

PATCH 5/7 pinctrl: renesas: rzg2l: Fix type in .pin_config_group_get() callback

In reply to Geert Uytterhoeven

On 64-bit platforms, "unsigned long" is 64-bit. Hence checking if all "unsigned long" configuration values are equal should be done using an "unsigned long" temporary.

---
 drivers/pinctrl/renesas/pinctrl-rzg2l.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/renesas/pinctrl-rzg2l.c +2 -1
index bc2154b695149809..5b0f23af5a6cc9de 100644
@@ -1647,8 +1647,9 @@ static int rzg2l_pinctrl_pinconf_group_get(struct pinctrl_dev *pctldev,
 					   unsigned int group,
 					   unsigned long *config)
 {
+	unsigned long prev_config = 0;
 	const unsigned int *pins;
-	unsigned int i, npins, prev_config = 0;
+	unsigned int i, npins;
 	int ret;
 
 	ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
Signature · 1 line
2.43.0
Reviewed-by on v1 5/7
#8 lore raw

RE: [PATCH 5/7] pinctrl: renesas: rzg2l: Fix type in .pin_config_group_get() callback

Quoted 15 lines

From: Geert Uytterhoeven <[email protected]>
Sent: 30 April 2026 16:33
To: Linus Walleij <[email protected]>; Lorenzo Bianconi <[email protected]>; Sean Wang <[email protected]>; Paul Cercueil <[email protected]>; Tony Lindgren <[email protected]>; Haojian Zhuang <[email protected]>; Matthias Brugger <[email protected]>; AngeloGioacchino Del Regno <[email protected]>; Prabhakar Mahadev Lad <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; linux-renesas- [email protected]; Geert Uytterhoeven <[email protected]>
Subject: [PATCH 5/7] pinctrl: renesas: rzg2l: Fix type in .pin_config_group_get() callback

Quoted 9 lines

On 64-bit platforms, "unsigned long" is 64-bit. Hence checking if all "unsigned long" configuration values are equal should be done using an "unsigned long" temporary.

---
 drivers/pinctrl/renesas/pinctrl-rzg2l.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Cheers,
Prabhakar

Quoted 19 lines
drivers/pinctrl/renesas/pinctrl-rzg2l.c +2 -1
index bc2154b695149809..5b0f23af5a6cc9de 100644
@@ -1647,8 +1647,9 @@ static int rzg2l_pinctrl_pinconf_group_get(struct
 pinctrl_dev *pctldev,
 					   unsigned int group,
 					   unsigned long *config)
 {
+	unsigned long prev_config = 0;
 	const unsigned int *pins;
-	unsigned int i, npins, prev_config = 0;
+	unsigned int i, npins;
 	int ret;
 

ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
--
2.43.0

author maintainer
#9 lore raw

PATCH 6/7 pinctrl: renesas: rzv2m: Fix type in .pin_config_group_get() callback

In reply to Geert Uytterhoeven

On 64-bit platforms, "unsigned long" is 64-bit. Hence checking if all "unsigned long" configuration values are equal should be done using an "unsigned long" temporary.

---
 drivers/pinctrl/renesas/pinctrl-rzv2m.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/renesas/pinctrl-rzv2m.c +2 -1
index 495e7f5d41280dc9..827b3e91a6cc2622 100644
@@ -695,8 +695,9 @@ static int rzv2m_pinctrl_pinconf_group_get(struct pinctrl_dev *pctldev,
 					   unsigned int group,
 					   unsigned long *config)
 {
+	unsigned long prev_config = 0;
 	const unsigned int *pins;
-	unsigned int i, npins, prev_config = 0;
+	unsigned int i, npins;
 	int ret;
 
 	ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
Signature · 1 line
2.43.0
author maintainer
#10 lore raw

PATCH 7/7 pinctrl: single: Fix type in .pin_config_group_get() callback

In reply to Geert Uytterhoeven

On 64-bit platforms, "unsigned long" is 64-bit. Hence checking if all "unsigned long" configuration values are equal should be done using an "unsigned long" temporary.

---
 drivers/pinctrl/pinctrl-single.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-single.c +2 -1
index 7e022a46ee422dc1..4d5f85b7e6bbe2b0 100644
@@ -619,8 +619,9 @@ static int pcs_pinconf_set(struct pinctrl_dev *pctldev,
 static int pcs_pinconf_group_get(struct pinctrl_dev *pctldev,
 				unsigned group, unsigned long *config)
 {
+	unsigned long old = 0;
 	const unsigned *pins;
-	unsigned npins, old = 0;
+	unsigned npins;
 	int i, ret;
 
 	ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
Signature · 1 line
2.43.0
maintainer
#11 lore raw
In reply to Geert Uytterhoeven
Quoted 11 lines · Geert Uytterhoeven

On 64-bit platforms, "unsigned long" is 64-bit. However, when checking if all "unsigned long" configuration values passed to the .pin_config_group_get() callback are equal, several drivers use a 32-bit temporary. Fortunately this works, as currently all configuration values fit in 32-bit.

This series makes the code cleaner and more future-proof by changing the types of all temporaries to unsigned long.

I intend to queue patches 5 and 6 in renesas-pinctrl for v7.2. Thanks for your comments!

Excellent work Geert, thanks for noticing and fixing this!

I applied patches 1, 2, 3, 4 and 7 to the pin control tree, leaving off the Renesas patches so you can keep the Renesas stuff together.

Yours,
Linus Walleij