Skip to content

Commit ea6b4fe

Browse files
jhovoldjic23
authored andcommitted
iio: adc: exynos_adc: fix OF populate on driver rebind
Since commit c6e126d ("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: c6e126d ("of: Keep track of populated platform devices") Cc: stable@vger.kernel.org # 3.16 Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 441ac29 commit ea6b4fe

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

drivers/iio/adc/exynos_adc.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -540,15 +540,6 @@ static const struct iio_chan_spec exynos_adc_iio_channels[] = {
540540
ADC_CHANNEL(9, "adc9"),
541541
};
542542

543-
static int exynos_adc_remove_devices(struct device *dev, void *c)
544-
{
545-
struct platform_device *pdev = to_platform_device(dev);
546-
547-
platform_device_unregister(pdev);
548-
549-
return 0;
550-
}
551-
552543
static int exynos_adc_probe(struct platform_device *pdev)
553544
{
554545
struct exynos_adc *info = NULL;
@@ -660,8 +651,7 @@ static int exynos_adc_probe(struct platform_device *pdev)
660651
return 0;
661652

662653
err_of_populate:
663-
device_for_each_child(&indio_dev->dev, NULL,
664-
exynos_adc_remove_devices);
654+
of_platform_depopulate(&indio_dev->dev);
665655
iio_device_unregister(indio_dev);
666656
err_irq:
667657
free_irq(info->irq, info);
@@ -681,8 +671,7 @@ static void exynos_adc_remove(struct platform_device *pdev)
681671
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
682672
struct exynos_adc *info = iio_priv(indio_dev);
683673

684-
device_for_each_child(&indio_dev->dev, NULL,
685-
exynos_adc_remove_devices);
674+
of_platform_depopulate(&indio_dev->dev);
686675
iio_device_unregister(indio_dev);
687676
free_irq(info->irq, info);
688677
if (info->data->exit_hw)

0 commit comments

Comments
 (0)