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

From: Stephen Rothwell <[email-masked]>
Date: Mon, 2 May 2022 16:45:57 +1000

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.

-- 
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");