diff mbox series

[12/15] mfd: qcom-spmi-pmic: use devm_of_platform_populate()

Message ID 1496072763-31209-13-git-send-email-benjamin.gaignard@linaro.org
State New
Headers show
Series [01/15] iio: adc: stm32: use devm_of_platform_populate() | expand

Commit Message

Benjamin Gaignard May 29, 2017, 3:46 p.m. UTC
Usage of  devm_of_platform_populate() simplify driver code
by allowing to delete pmic_spmi_remove().

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


CC: Lee Jones <lee.jones@linaro.org>
CC: linux-kernel@vger.kernel.org
---
 drivers/mfd/qcom-spmi-pmic.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

-- 
1.9.1

Comments

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

> Usage of  devm_of_platform_populate() simplify driver code

> by allowing to delete pmic_spmi_remove().

> 

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

> 

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

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

> ---

>  drivers/mfd/qcom-spmi-pmic.c | 9 +--------

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


Applied, thanks.

> diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c

> index 8653e8b..2022bdf 100644

> --- a/drivers/mfd/qcom-spmi-pmic.c

> +++ b/drivers/mfd/qcom-spmi-pmic.c

> @@ -120,7 +120,6 @@ static void pmic_spmi_show_revid(struct regmap *map, struct device *dev)

>  

>  static int pmic_spmi_probe(struct spmi_device *sdev)

>  {

> -	struct device_node *root = sdev->dev.of_node;

>  	struct regmap *regmap;

>  

>  	regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config);

> @@ -131,19 +130,13 @@ static int pmic_spmi_probe(struct spmi_device *sdev)

>  	if (sdev->usid % 2 == 0)

>  		pmic_spmi_show_revid(regmap, &sdev->dev);

>  

> -	return of_platform_populate(root, NULL, NULL, &sdev->dev);

> -}

> -

> -static void pmic_spmi_remove(struct spmi_device *sdev)

> -{

> -	of_platform_depopulate(&sdev->dev);

> +	return devm_of_platform_populate(&sdev->dev);

>  }

>  

>  MODULE_DEVICE_TABLE(of, pmic_spmi_id_table);

>  

>  static struct spmi_driver pmic_spmi_driver = {

>  	.probe = pmic_spmi_probe,

> -	.remove = pmic_spmi_remove,

>  	.driver = {

>  		.name = "pmic-spmi",

>  		.of_match_table = pmic_spmi_id_table,


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

Patch

diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
index 8653e8b..2022bdf 100644
--- a/drivers/mfd/qcom-spmi-pmic.c
+++ b/drivers/mfd/qcom-spmi-pmic.c
@@ -120,7 +120,6 @@  static void pmic_spmi_show_revid(struct regmap *map, struct device *dev)
 
 static int pmic_spmi_probe(struct spmi_device *sdev)
 {
-	struct device_node *root = sdev->dev.of_node;
 	struct regmap *regmap;
 
 	regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config);
@@ -131,19 +130,13 @@  static int pmic_spmi_probe(struct spmi_device *sdev)
 	if (sdev->usid % 2 == 0)
 		pmic_spmi_show_revid(regmap, &sdev->dev);
 
-	return of_platform_populate(root, NULL, NULL, &sdev->dev);
-}
-
-static void pmic_spmi_remove(struct spmi_device *sdev)
-{
-	of_platform_depopulate(&sdev->dev);
+	return devm_of_platform_populate(&sdev->dev);
 }
 
 MODULE_DEVICE_TABLE(of, pmic_spmi_id_table);
 
 static struct spmi_driver pmic_spmi_driver = {
 	.probe = pmic_spmi_probe,
-	.remove = pmic_spmi_remove,
 	.driver = {
 		.name = "pmic-spmi",
 		.of_match_table = pmic_spmi_id_table,