Re: [PATCH 01/15] iio: adc: stm32: use devm_of_platform_populate()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/29/2017 05:45 PM, Benjamin Gaignard wrote:
> Use devm_of_platform_populate() instead of of_platform_populate and
> of_platform_depopulate to simplify driver code
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxx>
> 
> CC: Jonathan Cameron <jic23@xxxxxxxxxx>
> CC: Hartmut Knaack <knaack.h@xxxxxx>
> CC: Lars-Peter Clausen <lars@xxxxxxxxxx>
> CC: Alexandre Torgue <alexandre.torgue@xxxxxx>
> CC: Fabrice Gasnier <fabrice.gasnier@xxxxxx>
> CC: linux-iio@xxxxxxxxxxxxxxx
> CC: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> CC: linux-kernel@xxxxxxxxxxxxxxx
> ---
>  drivers/iio/adc/stm32-adc-core.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
> index 22b7c93..46e41dc5 100644
> --- a/drivers/iio/adc/stm32-adc-core.c
> +++ b/drivers/iio/adc/stm32-adc-core.c
> @@ -186,7 +186,6 @@ static void stm32_adc_irq_remove(struct platform_device *pdev,
>  static int stm32_adc_probe(struct platform_device *pdev)
>  {
>  	struct stm32_adc_priv *priv;
> -	struct device_node *np = pdev->dev.of_node;
>  	struct resource *res;
>  	int ret;
>  
> @@ -249,7 +248,7 @@ static int stm32_adc_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, &priv->common);
>  
> -	ret = of_platform_populate(np, NULL, NULL, &pdev->dev);
> +	ret = devm_of_platform_populate(&pdev->dev);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed to populate DT children\n");
>  		goto err_irq_remove;
> @@ -274,7 +273,6 @@ static int stm32_adc_remove(struct platform_device *pdev)
>  	struct stm32_adc_common *common = platform_get_drvdata(pdev);
>  	struct stm32_adc_priv *priv = to_stm32_adc_priv(common);
>  
> -	of_platform_depopulate(&pdev->dev);

Hi Benjamin,

This is going to change order of sub devices removal. It may end-up with
bellow resources being removed while sub-device still needs them.
Not sure this is a good candidate for such a change.

Best Regards,
Fabrice

>  	stm32_adc_irq_remove(pdev, priv);
>  	clk_disable_unprepare(priv->aclk);
>  	regulator_disable(priv->vref);
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux