Skip to contentSkip to conversation

pinctrl: st: Avoid using of_node member of struct gpio_chip

PATCH In review Andy Shevchenko 2 participants 3 messages Oct 4, 2022 – Oct 10, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: st: Avoid using of_node member of struct gpio_chip

The of_node member of the struct gpio_chip is obsoleted and shouldn't be used. It will be removed in the future.

Replace its use in st_pctl_dt_calculate_pin() by comparing the fwnode pointers.

Fixes e75729b2f63f ("pinctrl: st: stop abusing of_get_named_gpio()")
---
 drivers/pinctrl/pinctrl-st.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-st.c +1 -1
index cf7f9cbe6044..ac24d07338a4 100644
@@ -1175,7 +1175,7 @@ static int st_pctl_dt_calculate_pin(struct st_pinctrl *info,
 
 	for (i = 0; i < info->nbanks; i++) {
 		chip = &info->banks[i].gpio_chip;
-		if (chip->of_node == np) {
+		if (chip->fwnode == of_fwnode_handle(np)) {
 			if (offset < chip->ngpio)
 				retval = chip->base + offset;
 			break;
Signature · 7 lines
2.35.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

Hi Andy,

Quoted 17 lines · Andy Shevchenko

The of_node member of the struct gpio_chip is obsoleted and shouldn't be used. It will be removed in the future.

Replace its use in st_pctl_dt_calculate_pin() by comparing the fwnode pointers.

Fixes e75729b2f63f ("pinctrl: st: stop abusing of_get_named_gpio()")
---
 drivers/pinctrl/pinctrl-st.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-st.c +0 -0
index cf7f9cbe6044..ac24d07338a4 100644

drivers/pinctrl/pinctrl-st.c static int st_pctl_dt_calculate_pin(struct st_pinctrl *info, · line 1178

Quoted 5 lines
drivers/pinctrl/pinctrl-st.c +1 -1
@@ -1175,7 +1175,7 @@ static int st_pctl_dt_calculate_pin(struct st_pinctrl *info,
 
 	for (i = 0; i < info->nbanks; i++) {
 		chip = &info->banks[i].gpio_chip;
-		if (chip->of_node == np) {
+		if (chip->fwnode == of_fwnode_handle(np)) {

Are you sure chip's fwnode is properly set here (without your other patch)? I don't believe the driver sets it up, and I don't think gpiolib maps it from the gpio_chip->of_node.

Actually, there is another reference to of_node in gpio chip in st_gpiolib_register_bank()...

Thanks.

Signature · 1 line
Dmitry
#2 lore raw
Quoted 8 lines · Dmitry Torokhov
Quoted 7 lines · Andy Shevchenko

The of_node member of the struct gpio_chip is obsoleted and shouldn't be used. It will be removed in the future.

Replace its use in st_pctl_dt_calculate_pin() by comparing the fwnode pointers.

Fixes e75729b2f63f ("pinctrl: st: stop abusing of_get_named_gpio()")

...

Quoted 6 lines

Are you sure chip's fwnode is properly set here (without your other patch)? I don't believe the driver sets it up, and I don't think gpiolib maps it from the gpio_chip->of_node.

Actually, there is another reference to of_node in gpio chip in st_gpiolib_register_bank()...

You are right, this patch has been made on top of another not yet published one. Hence, nothing to fix it right now.

Signature · 9 lines
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel