mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] pinctrl: stm32: fix pinctrl/gpio dependency ordering
@ 2023-01-10 17:41 Ahmad Fatoum
  2023-01-11  7:59 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-01-10 17:41 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

pinctrl_register will apply pinctrl hogs if specified and the STM32
pinctrl driver expects the GPIO chips to be registered by then.

Swap the order of registration to accommodate this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/pinctrl/pinctrl-stm32.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-stm32.c b/drivers/pinctrl/pinctrl-stm32.c
index 5e6625072a8f..15d845e0ad34 100644
--- a/drivers/pinctrl/pinctrl-stm32.c
+++ b/drivers/pinctrl/pinctrl-stm32.c
@@ -368,12 +368,6 @@ static int stm32_pinctrl_probe(struct device *dev)
 		dev_dbg(dev, "proceeding without hw spinlock support: (%d)\n",
 			ret);
 
-	ret = pinctrl_register(&pinctrl->pdev);
-	if (ret) {
-		dev_dbg(dev, "pinctrl_register failed: (%d)\n", ret);
-		return ret;
-	}
-
 	gpio_bank = pinctrl->gpio_banks;
 	for_each_available_child_of_node(np, child) {
 		if (!of_property_read_bool(child, "gpio-controller"))
@@ -389,9 +383,7 @@ static int stm32_pinctrl_probe(struct device *dev)
 		gpio_bank++;
 	}
 
-	dev_dbg(dev, "pinctrl/gpio driver registered\n");
-
-	return 0;
+	return pinctrl_register(&pinctrl->pdev);
 }
 
 static __maybe_unused struct of_device_id stm32_pinctrl_dt_ids[] = {
-- 
2.30.2




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

* Re: [PATCH] pinctrl: stm32: fix pinctrl/gpio dependency ordering
  2023-01-10 17:41 [PATCH] pinctrl: stm32: fix pinctrl/gpio dependency ordering Ahmad Fatoum
@ 2023-01-11  7:59 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-01-11  7:59 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Jan 10, 2023 at 06:41:04PM +0100, Ahmad Fatoum wrote:
> pinctrl_register will apply pinctrl hogs if specified and the STM32
> pinctrl driver expects the GPIO chips to be registered by then.
> 
> Swap the order of registration to accommodate this.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/pinctrl/pinctrl-stm32.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/pinctrl/pinctrl-stm32.c b/drivers/pinctrl/pinctrl-stm32.c
> index 5e6625072a8f..15d845e0ad34 100644
> --- a/drivers/pinctrl/pinctrl-stm32.c
> +++ b/drivers/pinctrl/pinctrl-stm32.c
> @@ -368,12 +368,6 @@ static int stm32_pinctrl_probe(struct device *dev)
>  		dev_dbg(dev, "proceeding without hw spinlock support: (%d)\n",
>  			ret);
>  
> -	ret = pinctrl_register(&pinctrl->pdev);
> -	if (ret) {
> -		dev_dbg(dev, "pinctrl_register failed: (%d)\n", ret);
> -		return ret;
> -	}
> -
>  	gpio_bank = pinctrl->gpio_banks;
>  	for_each_available_child_of_node(np, child) {
>  		if (!of_property_read_bool(child, "gpio-controller"))
> @@ -389,9 +383,7 @@ static int stm32_pinctrl_probe(struct device *dev)
>  		gpio_bank++;
>  	}
>  
> -	dev_dbg(dev, "pinctrl/gpio driver registered\n");
> -
> -	return 0;
> +	return pinctrl_register(&pinctrl->pdev);
>  }
>  
>  static __maybe_unused struct of_device_id stm32_pinctrl_dt_ids[] = {
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2023-01-11  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 17:41 [PATCH] pinctrl: stm32: fix pinctrl/gpio dependency ordering Ahmad Fatoum
2023-01-11  7:59 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox