public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind
@ 2025-12-19 11:09 Johan Hovold
  2025-12-19 11:26 ` Konrad Dybcio
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Johan Hovold @ 2025-12-19 11:09 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-arm-msm, linux-kernel, Johan Hovold, stable

Since commit c6e126de43e7 ("of: Keep track of populated platform
devices") child devices will not be created by of_platform_populate()
if the devices had previously been deregistered individually so that the
OF_POPULATED flag is still set in the corresponding OF nodes.

Switch to using of_platform_depopulate() instead of open coding so that
the child devices are created if the driver is rebound.

Fixes: c6e126de43e7 ("of: Keep track of populated platform devices")
Cc: stable@vger.kernel.org	# 3.16
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/mfd/qcom-pm8xxx.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/mfd/qcom-pm8xxx.c b/drivers/mfd/qcom-pm8xxx.c
index 1149f7102a36..0cf374c015ce 100644
--- a/drivers/mfd/qcom-pm8xxx.c
+++ b/drivers/mfd/qcom-pm8xxx.c
@@ -577,17 +577,11 @@ static int pm8xxx_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int pm8xxx_remove_child(struct device *dev, void *unused)
-{
-	platform_device_unregister(to_platform_device(dev));
-	return 0;
-}
-
 static void pm8xxx_remove(struct platform_device *pdev)
 {
 	struct pm_irq_chip *chip = platform_get_drvdata(pdev);
 
-	device_for_each_child(&pdev->dev, NULL, pm8xxx_remove_child);
+	of_platform_depopulate(&pdev->dev);
 	irq_domain_remove(chip->irqdomain);
 }
 
-- 
2.51.2


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

* Re: [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind
  2025-12-19 11:09 [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind Johan Hovold
@ 2025-12-19 11:26 ` Konrad Dybcio
  2025-12-21  5:01 ` Dmitry Baryshkov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Konrad Dybcio @ 2025-12-19 11:26 UTC (permalink / raw)
  To: Johan Hovold, Lee Jones; +Cc: linux-arm-msm, linux-kernel, stable

On 12/19/25 12:09 PM, Johan Hovold wrote:
> Since commit c6e126de43e7 ("of: Keep track of populated platform
> devices") child devices will not be created by of_platform_populate()
> if the devices had previously been deregistered individually so that the
> OF_POPULATED flag is still set in the corresponding OF nodes.
> 
> Switch to using of_platform_depopulate() instead of open coding so that
> the child devices are created if the driver is rebound.
> 
> Fixes: c6e126de43e7 ("of: Keep track of populated platform devices")
> Cc: stable@vger.kernel.org	# 3.16
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

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

* Re: [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind
  2025-12-19 11:09 [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind Johan Hovold
  2025-12-19 11:26 ` Konrad Dybcio
@ 2025-12-21  5:01 ` Dmitry Baryshkov
  2026-01-09 15:27 ` Lee Jones
  2026-01-20 15:06 ` (subset) " Lee Jones
  3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2025-12-21  5:01 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Lee Jones, linux-arm-msm, linux-kernel, stable

On Fri, Dec 19, 2025 at 12:09:47PM +0100, Johan Hovold wrote:
> Since commit c6e126de43e7 ("of: Keep track of populated platform
> devices") child devices will not be created by of_platform_populate()
> if the devices had previously been deregistered individually so that the
> OF_POPULATED flag is still set in the corresponding OF nodes.
> 
> Switch to using of_platform_depopulate() instead of open coding so that
> the child devices are created if the driver is rebound.
> 
> Fixes: c6e126de43e7 ("of: Keep track of populated platform devices")
> Cc: stable@vger.kernel.org	# 3.16
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/mfd/qcom-pm8xxx.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

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

* Re: [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind
  2025-12-19 11:09 [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind Johan Hovold
  2025-12-19 11:26 ` Konrad Dybcio
  2025-12-21  5:01 ` Dmitry Baryshkov
@ 2026-01-09 15:27 ` Lee Jones
  2026-01-13  9:24   ` Johan Hovold
  2026-01-20 15:06 ` (subset) " Lee Jones
  3 siblings, 1 reply; 6+ messages in thread
From: Lee Jones @ 2026-01-09 15:27 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-arm-msm, linux-kernel, stable

On Fri, 19 Dec 2025, Johan Hovold wrote:

> Since commit c6e126de43e7 ("of: Keep track of populated platform
> devices") child devices will not be created by of_platform_populate()
> if the devices had previously been deregistered individually so that the
> OF_POPULATED flag is still set in the corresponding OF nodes.
> 
> Switch to using of_platform_depopulate() instead of open coding so that
> the child devices are created if the driver is rebound.
> 
> Fixes: c6e126de43e7 ("of: Keep track of populated platform devices")
> Cc: stable@vger.kernel.org	# 3.16
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/mfd/qcom-pm8xxx.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/mfd/qcom-pm8xxx.c b/drivers/mfd/qcom-pm8xxx.c
> index 1149f7102a36..0cf374c015ce 100644
> --- a/drivers/mfd/qcom-pm8xxx.c
> +++ b/drivers/mfd/qcom-pm8xxx.c
> @@ -577,17 +577,11 @@ static int pm8xxx_probe(struct platform_device *pdev)
>  	return rc;
>  }
>  
> -static int pm8xxx_remove_child(struct device *dev, void *unused)
> -{
> -	platform_device_unregister(to_platform_device(dev));
> -	return 0;
> -}
> -
>  static void pm8xxx_remove(struct platform_device *pdev)
>  {
>  	struct pm_irq_chip *chip = platform_get_drvdata(pdev);
>  
> -	device_for_each_child(&pdev->dev, NULL, pm8xxx_remove_child);
> +	of_platform_depopulate(&pdev->dev);
>  	irq_domain_remove(chip->irqdomain);

Have you explored devm_of_platform_populate()?

-- 
Lee Jones [李琼斯]

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

* Re: [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind
  2026-01-09 15:27 ` Lee Jones
@ 2026-01-13  9:24   ` Johan Hovold
  0 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2026-01-13  9:24 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-arm-msm, linux-kernel, stable

On Fri, Jan 09, 2026 at 03:27:38PM +0000, Lee Jones wrote:
> On Fri, 19 Dec 2025, Johan Hovold wrote:
> 
> > Since commit c6e126de43e7 ("of: Keep track of populated platform
> > devices") child devices will not be created by of_platform_populate()
> > if the devices had previously been deregistered individually so that the
> > OF_POPULATED flag is still set in the corresponding OF nodes.
> > 
> > Switch to using of_platform_depopulate() instead of open coding so that
> > the child devices are created if the driver is rebound.
> > 
> > Fixes: c6e126de43e7 ("of: Keep track of populated platform devices")
> > Cc: stable@vger.kernel.org	# 3.16
> > Signed-off-by: Johan Hovold <johan@kernel.org>

> > -static int pm8xxx_remove_child(struct device *dev, void *unused)
> > -{
> > -	platform_device_unregister(to_platform_device(dev));
> > -	return 0;
> > -}
> > -
> >  static void pm8xxx_remove(struct platform_device *pdev)
> >  {
> >  	struct pm_irq_chip *chip = platform_get_drvdata(pdev);
> >  
> > -	device_for_each_child(&pdev->dev, NULL, pm8xxx_remove_child);
> > +	of_platform_depopulate(&pdev->dev);
> >  	irq_domain_remove(chip->irqdomain);
> 
> Have you explored devm_of_platform_populate()?

Yeah, but mixing devres and explicit release risks introducing bugs. And
here we want to make sure the children are deregistered before freeing
the irqdomain.

Johan

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

* Re: (subset) [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind
  2025-12-19 11:09 [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind Johan Hovold
                   ` (2 preceding siblings ...)
  2026-01-09 15:27 ` Lee Jones
@ 2026-01-20 15:06 ` Lee Jones
  3 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2026-01-20 15:06 UTC (permalink / raw)
  To: Lee Jones, Johan Hovold; +Cc: linux-arm-msm, linux-kernel, stable

On Fri, 19 Dec 2025 12:09:47 +0100, Johan Hovold wrote:
> Since commit c6e126de43e7 ("of: Keep track of populated platform
> devices") child devices will not be created by of_platform_populate()
> if the devices had previously been deregistered individually so that the
> OF_POPULATED flag is still set in the corresponding OF nodes.
> 
> Switch to using of_platform_depopulate() instead of open coding so that
> the child devices are created if the driver is rebound.
> 
> [...]

Applied, thanks!

[1/1] mfd: qcom-pm8xxx: fix OF populate on driver rebind
      commit: 0b6a34ca0ac3b6e02389a2594f0638e5b9c65814

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2026-01-20 15:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-19 11:09 [PATCH] mfd: qcom-pm8xxx: fix OF populate on driver rebind Johan Hovold
2025-12-19 11:26 ` Konrad Dybcio
2025-12-21  5:01 ` Dmitry Baryshkov
2026-01-09 15:27 ` Lee Jones
2026-01-13  9:24   ` Johan Hovold
2026-01-20 15:06 ` (subset) " Lee Jones

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