public inbox for linux-samsung-soc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: exynos_adc: fix OF populate on driver rebind
@ 2025-12-19 11:05 Johan Hovold
  2025-12-19 13:28 ` Krzysztof Kozlowski
  2025-12-21 17:01 ` Jonathan Cameron
  0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2025-12-19 11:05 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, Krzysztof Kozlowski,
	Alim Akhtar, linux-iio, linux-samsung-soc, 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/iio/adc/exynos_adc.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index 1484adff00df..f2400897818c 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -540,15 +540,6 @@ static const struct iio_chan_spec exynos_adc_iio_channels[] = {
 	ADC_CHANNEL(9, "adc9"),
 };
 
-static int exynos_adc_remove_devices(struct device *dev, void *c)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-
-	platform_device_unregister(pdev);
-
-	return 0;
-}
-
 static int exynos_adc_probe(struct platform_device *pdev)
 {
 	struct exynos_adc *info = NULL;
@@ -660,8 +651,7 @@ static int exynos_adc_probe(struct platform_device *pdev)
 	return 0;
 
 err_of_populate:
-	device_for_each_child(&indio_dev->dev, NULL,
-				exynos_adc_remove_devices);
+	of_platform_depopulate(&indio_dev->dev);
 	iio_device_unregister(indio_dev);
 err_irq:
 	free_irq(info->irq, info);
@@ -681,8 +671,7 @@ static void exynos_adc_remove(struct platform_device *pdev)
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
 	struct exynos_adc *info = iio_priv(indio_dev);
 
-	device_for_each_child(&indio_dev->dev, NULL,
-				exynos_adc_remove_devices);
+	of_platform_depopulate(&indio_dev->dev);
 	iio_device_unregister(indio_dev);
 	free_irq(info->irq, info);
 	if (info->data->exit_hw)
-- 
2.51.2


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

* Re: [PATCH] iio: adc: exynos_adc: fix OF populate on driver rebind
  2025-12-19 11:05 [PATCH] iio: adc: exynos_adc: fix OF populate on driver rebind Johan Hovold
@ 2025-12-19 13:28 ` Krzysztof Kozlowski
  2025-12-21 17:01 ` Jonathan Cameron
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-19 13:28 UTC (permalink / raw)
  To: Johan Hovold, Jonathan Cameron
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, Alim Akhtar,
	linux-iio, linux-samsung-soc, linux-kernel, stable

On 19/12/2025 12:05, 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/iio/adc/exynos_adc.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>


Best regards,
Krzysztof

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

* Re: [PATCH] iio: adc: exynos_adc: fix OF populate on driver rebind
  2025-12-19 11:05 [PATCH] iio: adc: exynos_adc: fix OF populate on driver rebind Johan Hovold
  2025-12-19 13:28 ` Krzysztof Kozlowski
@ 2025-12-21 17:01 ` Jonathan Cameron
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-12-21 17:01 UTC (permalink / raw)
  To: Johan Hovold
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, Krzysztof Kozlowski,
	Alim Akhtar, linux-iio, linux-samsung-soc, linux-kernel, stable

On Fri, 19 Dec 2025 12:05:45 +0100
Johan Hovold <johan@kernel.org> 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>
Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/exynos_adc.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
> index 1484adff00df..f2400897818c 100644
> --- a/drivers/iio/adc/exynos_adc.c
> +++ b/drivers/iio/adc/exynos_adc.c
> @@ -540,15 +540,6 @@ static const struct iio_chan_spec exynos_adc_iio_channels[] = {
>  	ADC_CHANNEL(9, "adc9"),
>  };
>  
> -static int exynos_adc_remove_devices(struct device *dev, void *c)
> -{
> -	struct platform_device *pdev = to_platform_device(dev);
> -
> -	platform_device_unregister(pdev);
> -
> -	return 0;
> -}
> -
>  static int exynos_adc_probe(struct platform_device *pdev)
>  {
>  	struct exynos_adc *info = NULL;
> @@ -660,8 +651,7 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  	return 0;
>  
>  err_of_populate:
> -	device_for_each_child(&indio_dev->dev, NULL,
> -				exynos_adc_remove_devices);
> +	of_platform_depopulate(&indio_dev->dev);
>  	iio_device_unregister(indio_dev);
>  err_irq:
>  	free_irq(info->irq, info);
> @@ -681,8 +671,7 @@ static void exynos_adc_remove(struct platform_device *pdev)
>  	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
>  	struct exynos_adc *info = iio_priv(indio_dev);
>  
> -	device_for_each_child(&indio_dev->dev, NULL,
> -				exynos_adc_remove_devices);
> +	of_platform_depopulate(&indio_dev->dev);
>  	iio_device_unregister(indio_dev);
>  	free_irq(info->irq, info);
>  	if (info->data->exit_hw)


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

end of thread, other threads:[~2025-12-21 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-19 11:05 [PATCH] iio: adc: exynos_adc: fix OF populate on driver rebind Johan Hovold
2025-12-19 13:28 ` Krzysztof Kozlowski
2025-12-21 17:01 ` Jonathan Cameron

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