Skip to contentSkip to conversation

linux-next: manual merge of the pinctrl tree with the gpio-intel tree

DISCUSSION Stephen Rothwell 3 participants 3 messages May 2, 2022 – May 4, 2022 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next merge of the pinctrl tree got a conflict in:

drivers/pinctrl/stm32/pinctrl-stm32.c

between commit:

bb949ed9b16b ("pinctrl: stm32: Switch to use for_each_gpiochip_node() helper")

from the gpio-intel tree and commit:

c954531bc5d8 ("pinctrl: stm32: improve bank clocks management")

from the pinctrl tree.

I fixed it up (I think, see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 76 lines
Cheers,
Stephen Rothwell

diff --cc drivers/pinctrl/stm32/pinctrl-stm32.c
index 7aecd0efde07,b308e7bb7487..000000000000
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@@ -1544,34 -1508,44 +1506,38 @@@ int stm32_pctl_probe(struct platform_de
  		return -ENOMEM;
  
  	i = 0;
 -	for_each_available_child_of_node(np, child) {
 +	for_each_gpiochip_node(dev, child) {
  		struct stm32_gpio_bank *bank = &pctl->banks[i];
 +		struct device_node *np = to_of_node(child);
  
 -		if (of_property_read_bool(child, "gpio-controller")) {
 -			bank->rstc = of_reset_control_get_exclusive(child,
 -								    NULL);
 -			if (PTR_ERR(bank->rstc) == -EPROBE_DEFER) {
 -				of_node_put(child);
 -				return -EPROBE_DEFER;
 -			}
 -
 -			bank->clk = of_clk_get_by_name(child, NULL);
 -			if (IS_ERR(bank->clk)) {
 -				if (PTR_ERR(bank->clk) != -EPROBE_DEFER)
 -					dev_err(dev,
 -						"failed to get clk (%ld)\n",
 -						PTR_ERR(bank->clk));
 -				of_node_put(child);
 -				return PTR_ERR(bank->clk);
 -			}
 -			i++;
 +		bank->rstc = of_reset_control_get_exclusive(np, NULL);
 +		if (PTR_ERR(bank->rstc) == -EPROBE_DEFER) {
 +			fwnode_handle_put(child);
 +			return -EPROBE_DEFER;
  		}
 -	}
  
 -	for_each_available_child_of_node(np, child) {
 -		if (of_property_read_bool(child, "gpio-controller")) {
 -			ret = stm32_gpiolib_register_bank(pctl, child);
 -			if (ret) {
 -				of_node_put(child);
 +		bank->clk = of_clk_get_by_name(np, NULL);
 +		if (IS_ERR(bank->clk)) {
 +			if (PTR_ERR(bank->clk) != -EPROBE_DEFER)
 +				dev_err(dev, "failed to get clk (%ld)\n", PTR_ERR(bank->clk));
 +			fwnode_handle_put(child);
 +			return PTR_ERR(bank->clk);
 +		}
 +		i++;
 +	}
  
 -				for (i = 0; i < pctl->nbanks; i++)
 -					clk_disable_unprepare(pctl->banks[i].clk);
 +	for_each_gpiochip_node(dev, child) {
 +		ret = stm32_gpiolib_register_bank(pctl, child);
 +		if (ret) {
 +			fwnode_handle_put(child);
+ 
 -				return ret;
 -			}
++			for (i = 0; i < pctl->nbanks; i++)
++				clk_disable_unprepare(pctl->banks[i].clk);
+ 
 -			pctl->nbanks++;
 +			return ret;
  		}
 +
 +		pctl->nbanks++;
  	}
  
  	dev_info(dev, "Pinctrl STM32 initialized\n");
#1 lore raw
Quoted 15 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the pinctrl tree got a conflict in:

drivers/pinctrl/stm32/pinctrl-stm32.c

between commit:

bb949ed9b16b ("pinctrl: stm32: Switch to use for_each_gpiochip_node() helper")

from the gpio-intel tree and commit:

c954531bc5d8 ("pinctrl: stm32: improve bank clocks management")

Quoted 8 lines

from the pinctrl tree.

I fixed it up (I think, see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Thanks for the fix. I think the best course of action is that Linus W. can pull the same branch that GPIO tree has into the pin control tree and resolve that, because the drivers touched are all pin control drivers while the core part of GPIO subsystem was updated.

Quoted 77 lines

--
Cheers,
Stephen Rothwell

drivers/pinctrl/stm32/pinctrl-stm32.c +4 -0
diff --cc drivers/pinctrl/stm32/pinctrl-stm32.c
index 7aecd0efde07,b308e7bb7487..000000000000
@@@ -1544,34 -1508,44 +1506,38 @@@ int stm32_pctl_probe(struct platform_de
                return -ENOMEM;
 
        i = 0;
 -      for_each_available_child_of_node(np, child) {
 +      for_each_gpiochip_node(dev, child) {
                struct stm32_gpio_bank *bank = &pctl->banks[i];
 +              struct device_node *np = to_of_node(child);
 
 -              if (of_property_read_bool(child, "gpio-controller")) {
 -                      bank->rstc = of_reset_control_get_exclusive(child,
 -                                                                  NULL);
 -                      if (PTR_ERR(bank->rstc) == -EPROBE_DEFER) {
 -                              of_node_put(child);
 -                              return -EPROBE_DEFER;
 -                      }
 -
 -                      bank->clk = of_clk_get_by_name(child, NULL);
 -                      if (IS_ERR(bank->clk)) {
 -                              if (PTR_ERR(bank->clk) != -EPROBE_DEFER)
 -                                      dev_err(dev,
 -                                              "failed to get clk (%ld)\n",
 -                                              PTR_ERR(bank->clk));
 -                              of_node_put(child);
 -                              return PTR_ERR(bank->clk);
 -                      }
 -                      i++;
 +              bank->rstc = of_reset_control_get_exclusive(np, NULL);
 +              if (PTR_ERR(bank->rstc) == -EPROBE_DEFER) {
 +                      fwnode_handle_put(child);
 +                      return -EPROBE_DEFER;
                }
 -      }
 
 -      for_each_available_child_of_node(np, child) {
 -              if (of_property_read_bool(child, "gpio-controller")) {
 -                      ret = stm32_gpiolib_register_bank(pctl, child);
 -                      if (ret) {
 -                              of_node_put(child);
 +              bank->clk = of_clk_get_by_name(np, NULL);
 +              if (IS_ERR(bank->clk)) {
 +                      if (PTR_ERR(bank->clk) != -EPROBE_DEFER)
 +                              dev_err(dev, "failed to get clk (%ld)\n", PTR_ERR(bank->clk));
 +                      fwnode_handle_put(child);
 +                      return PTR_ERR(bank->clk);
 +              }
 +              i++;
 +      }
 
 -                              for (i = 0; i < pctl->nbanks; i++)
 -                                      clk_disable_unprepare(pctl->banks[i].clk);
 +      for_each_gpiochip_node(dev, child) {
 +              ret = stm32_gpiolib_register_bank(pctl, child);
 +              if (ret) {
 +                      fwnode_handle_put(child);
+
 -                              return ret;
 -                      }
++                      for (i = 0; i < pctl->nbanks; i++)
++                              clk_disable_unprepare(pctl->banks[i].clk);
+
 -                      pctl->nbanks++;
 +                      return ret;
                }
 +
 +              pctl->nbanks++;
        }
 
        dev_info(dev, "Pinctrl STM32 initialized\n");
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 4 lines · Andy Shevchenko

Thanks for the fix. I think the best course of action is that Linus W. can pull the same branch that GPIO tree has into the pin control tree and resolve that, because the drivers touched are all pin control drivers while the core part of GPIO subsystem was updated.

Yup did this!

Yours,
Linus Walleij