iio: adc: exynos_adc: fix OF populate on driver rebind
Subsystems (3)
PATCH 1/1 iio: adc: exynos_adc: fix OF populate on driver rebind
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.
--- drivers/iio/adc/exynos_adc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/iio/adc/exynos_adc.c +2 -13
@@ -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)
Signature · 1 line
2.51.2
Quoted 8 lines · Johan Hovold
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag 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.
Quoted 6 lines
Fixes c6e126de43e7 ("of: Keep track of populated platform devices")Cc [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>--- drivers/iio/adc/exynos_adc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
Best regards,
Krzysztof
Quoted 11 lines · On Fri, 19 Dec 2025 12:05:45 +0100 Johan Hovold <[email protected]> wrote:
Since commit
c6e126de43e7("of: Keep track of populated platform devices") child devices will not be created byof_platform_populate()if the devices had previously been deregistered individually so that theOF_POPULATEDflag 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 [email protected] # 3.16Signed-off-by Johan Hovold <[email protected]>
Applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
Quoted 44 lines
--- drivers/iio/adc/exynos_adc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)drivers/iio/adc/exynos_adc.c +2
-13@@ -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)