[07/15] mfd: cros_ec: use devm_of_platform_populate()

Message ID 1496072763-31209-8-git-send-email-benjamin.gaignard@linaro.org
State Accepted
Commit 2eb131efb13d1fb98c08fccfe25908a5a3ad04f6
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/cros_ec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.9.1

Comments

Lee Jones May 30, 2017, 9:30 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/cros_ec.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


Applied, thanks.

> diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c

> index d4a407e..e31ac60 100644

> --- a/drivers/mfd/cros_ec.c

> +++ b/drivers/mfd/cros_ec.c

> @@ -147,7 +147,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

>  	}

>  

>  	if (IS_ENABLED(CONFIG_OF) && dev->of_node) {

> -		err = of_platform_populate(dev->of_node, NULL, NULL, dev);

> +		err = devm_of_platform_populate(dev);

>  		if (err) {

>  			mfd_remove_devices(dev);

>  			dev_err(dev, "Failed to register sub-devices\n");


-- 
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/cros_ec.c b/drivers/mfd/cros_ec.c
index d4a407e..e31ac60 100644
--- a/drivers/mfd/cros_ec.c
+++ b/drivers/mfd/cros_ec.c
@@ -147,7 +147,7 @@  int cros_ec_register(struct cros_ec_device *ec_dev)
 	}
 
 	if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
-		err = of_platform_populate(dev->of_node, NULL, NULL, dev);
+		err = devm_of_platform_populate(dev);
 		if (err) {
 			mfd_remove_devices(dev);
 			dev_err(dev, "Failed to register sub-devices\n");