[09/15] mfd: fsl-imx25: use devm_of_platform_populate()

Message ID 1496072763-31209-10-git-send-email-benjamin.gaignard@linaro.org
State Accepted
Commit a55196eff6d63be4c439d707ce3b68ee82794ee9
Headers show
Series
  • [01/15] iio: adc: stm32: use devm_of_platform_populate()
Related show

Commit Message

Benjamin Gaignard May 29, 2017, 3:45 p.m.
Use devm_of_platform_populate() to be sure that of_platform_depopulate
is called when removing the driver.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>


CC: Lee Jones <lee.jones@linaro.org>
CC: linux-kernel@vger.kernel.org
---
 drivers/mfd/fsl-imx25-tsadc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

-- 
1.9.1

Comments

Lee Jones May 30, 2017, 9:31 a.m. | #1
On Mon, 29 May 2017, Benjamin Gaignard wrote:

> Use devm_of_platform_populate() to be sure that of_platform_depopulate

> is called when removing the driver.

> 

> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

> 

> CC: Lee Jones <lee.jones@linaro.org>

> CC: linux-kernel@vger.kernel.org

> ---

>  drivers/mfd/fsl-imx25-tsadc.c | 5 +----

>  1 file changed, 1 insertion(+), 4 deletions(-)


Applied, thanks.

> diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c

> index ac430a3..4258a42 100644

> --- a/drivers/mfd/fsl-imx25-tsadc.c

> +++ b/drivers/mfd/fsl-imx25-tsadc.c

> @@ -129,7 +129,6 @@ static void mx25_tsadc_setup_clk(struct platform_device *pdev,

>  static int mx25_tsadc_probe(struct platform_device *pdev)

>  {

>  	struct device *dev = &pdev->dev;

> -	struct device_node *np = dev->of_node;

>  	struct mx25_tsadc *tsadc;

>  	struct resource *res;

>  	int ret;

> @@ -178,9 +177,7 @@ static int mx25_tsadc_probe(struct platform_device *pdev)

>  

>  	platform_set_drvdata(pdev, tsadc);

>  

> -	of_platform_populate(np, NULL, NULL, dev);

> -

> -	return 0;

> +	return devm_of_platform_populate(dev);

>  }

>  

>  static const struct of_device_id mx25_tsadc_ids[] = {


-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

Patch

diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c
index ac430a3..4258a42 100644
--- a/drivers/mfd/fsl-imx25-tsadc.c
+++ b/drivers/mfd/fsl-imx25-tsadc.c
@@ -129,7 +129,6 @@  static void mx25_tsadc_setup_clk(struct platform_device *pdev,
 static int mx25_tsadc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
 	struct mx25_tsadc *tsadc;
 	struct resource *res;
 	int ret;
@@ -178,9 +177,7 @@  static int mx25_tsadc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, tsadc);
 
-	of_platform_populate(np, NULL, NULL, dev);
-
-	return 0;
+	return devm_of_platform_populate(dev);
 }
 
 static const struct of_device_id mx25_tsadc_ids[] = {