public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3 v2] regulator: tps65218: Remove unnecessary regulator_unregister call
  2014-02-19  8:29 Axel Lin
@ 2014-02-19  8:30 ` Axel Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Axel Lin @ 2014-02-19  8:30 UTC (permalink / raw)
  To: Mark Brown; +Cc: Markus Pargmann, Laxman Dewangan, Liam Girdwood, linux-kernel

Current code uses devm_regulator_register() so the we don't need to explicitly
call regulator_unregister() in .remove.
And then we don't need to save rdev pointer to tps->rdev[id].

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/tps65218-regulator.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
index d1c7831..1fb1db5 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -267,23 +267,6 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
 		return PTR_ERR(rdev);
 	}
 
-	/* Save regulator */
-	tps->rdev[id] = rdev;
-
-	return 0;
-}
-
-static int tps65218_regulator_remove(struct platform_device *pdev)
-{
-	struct tps65218 *tps = platform_get_drvdata(pdev);
-	const struct of_device_id	*match;
-	const struct tps_info		*template;
-
-	match = of_match_device(tps65218_of_match, &pdev->dev);
-	template = match->data;
-	regulator_unregister(tps->rdev[template->id]);
-	platform_set_drvdata(pdev, NULL);
-
 	return 0;
 }
 
@@ -294,7 +277,6 @@ static struct platform_driver tps65218_regulator_driver = {
 		.of_match_table = of_match_ptr(tps65218_of_match),
 	},
 	.probe = tps65218_regulator_probe,
-	.remove = tps65218_regulator_remove,
 };
 
 module_platform_driver(tps65218_regulator_driver);
-- 
1.8.1.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 1/3 v2] regulator: tps65218: Add terminate entry for of_device_id table
@ 2014-02-19  8:33 Axel Lin
  2014-02-19  8:34 ` [PATCH 2/3 v2] regulator: tps65218: Remove unnecessary regulator_unregister call Axel Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Axel Lin @ 2014-02-19  8:33 UTC (permalink / raw)
  To: Mark Brown; +Cc: Keerthy, Liam Girdwood, linux-kernel

Fixes below build error:
FATAL: drivers/regulator/tps65218-regulator: struct of_device_id is not terminated with a NULL entry!

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
I'm sorry that I just found I CC wrong developers in my previous mail.
So here is a resend.
 drivers/regulator/tps65218-regulator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
index 958276c..d1c7831 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -96,6 +96,7 @@ static const struct of_device_id tps65218_of_match[] = {
 	TPS65218_OF_MATCH("ti,tps65218-dcdc5", tps65218_pmic_regs[DCDC5]),
 	TPS65218_OF_MATCH("ti,tps65218-dcdc6", tps65218_pmic_regs[DCDC6]),
 	TPS65218_OF_MATCH("ti,tps65218-ldo1", tps65218_pmic_regs[LDO1]),
+	{ }
 };
 MODULE_DEVICE_TABLE(of, tps65218_of_match);
 
-- 
1.8.1.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3 v2] regulator: tps65218: Remove unnecessary regulator_unregister call
  2014-02-19  8:33 [PATCH 1/3 v2] regulator: tps65218: Add terminate entry for of_device_id table Axel Lin
@ 2014-02-19  8:34 ` Axel Lin
  2014-02-19  8:38   ` Keerthy
  2014-02-19  8:35 ` [PATCH 3/3 v2] regulator: tps65218: Add OF dependency Axel Lin
  2014-02-19  8:38 ` [PATCH 1/3 v2] regulator: tps65218: Add terminate entry for of_device_id table Keerthy
  2 siblings, 1 reply; 6+ messages in thread
From: Axel Lin @ 2014-02-19  8:34 UTC (permalink / raw)
  To: Mark Brown; +Cc: Keerthy, Liam Girdwood, linux-kernel

Current code uses devm_regulator_register() so the we don't need to explicitly
call regulator_unregister() in .remove.
And then we don't need to save rdev pointer to tps->rdev[id].

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/tps65218-regulator.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
index d1c7831..1fb1db5 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -267,23 +267,6 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
 		return PTR_ERR(rdev);
 	}
 
-	/* Save regulator */
-	tps->rdev[id] = rdev;
-
-	return 0;
-}
-
-static int tps65218_regulator_remove(struct platform_device *pdev)
-{
-	struct tps65218 *tps = platform_get_drvdata(pdev);
-	const struct of_device_id	*match;
-	const struct tps_info		*template;
-
-	match = of_match_device(tps65218_of_match, &pdev->dev);
-	template = match->data;
-	regulator_unregister(tps->rdev[template->id]);
-	platform_set_drvdata(pdev, NULL);
-
 	return 0;
 }
 
@@ -294,7 +277,6 @@ static struct platform_driver tps65218_regulator_driver = {
 		.of_match_table = of_match_ptr(tps65218_of_match),
 	},
 	.probe = tps65218_regulator_probe,
-	.remove = tps65218_regulator_remove,
 };
 
 module_platform_driver(tps65218_regulator_driver);
-- 
1.8.1.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3 v2] regulator: tps65218: Add OF dependency
  2014-02-19  8:33 [PATCH 1/3 v2] regulator: tps65218: Add terminate entry for of_device_id table Axel Lin
  2014-02-19  8:34 ` [PATCH 2/3 v2] regulator: tps65218: Remove unnecessary regulator_unregister call Axel Lin
@ 2014-02-19  8:35 ` Axel Lin
  2014-02-19  8:38 ` [PATCH 1/3 v2] regulator: tps65218: Add terminate entry for of_device_id table Keerthy
  2 siblings, 0 replies; 6+ messages in thread
From: Axel Lin @ 2014-02-19  8:35 UTC (permalink / raw)
  To: Mark Brown; +Cc: Keerthy, Liam Girdwood, linux-kernel

This is a DT-only driver, so make it depend on OF and remove of_match_ptr in
the code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/Kconfig              |  2 +-
 drivers/regulator/tps65218-regulator.c | 14 ++++++--------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index b05da880..b7c95e8 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -515,7 +515,7 @@ config REGULATOR_TPS65217
 
 config REGULATOR_TPS65218
 	tristate "TI TPS65218 Power regulators"
-	depends on MFD_TPS65218
+	depends on MFD_TPS65218 && OF
 	help
 	  This driver supports TPS65218 voltage regulator chips. TPS65218
 	  provides six step-down converters and one general-purpose LDO
diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
index 1fb1db5..cec72fa 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -243,14 +243,12 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
 	int id;
 
 	match = of_match_device(tps65218_of_match, &pdev->dev);
-	if (match) {
-		template = match->data;
-		id = template->id;
-		init_data = of_get_regulator_init_data(&pdev->dev,
-						      pdev->dev.of_node);
-	} else {
+	if (!match)
 		return -ENODEV;
-	}
+
+	template = match->data;
+	id = template->id;
+	init_data = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node);
 
 	platform_set_drvdata(pdev, tps);
 
@@ -274,7 +272,7 @@ static struct platform_driver tps65218_regulator_driver = {
 	.driver = {
 		.name = "tps65218-pmic",
 		.owner = THIS_MODULE,
-		.of_match_table = of_match_ptr(tps65218_of_match),
+		.of_match_table = tps65218_of_match,
 	},
 	.probe = tps65218_regulator_probe,
 };
-- 
1.8.1.2




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3 v2] regulator: tps65218: Add terminate entry for of_device_id table
  2014-02-19  8:33 [PATCH 1/3 v2] regulator: tps65218: Add terminate entry for of_device_id table Axel Lin
  2014-02-19  8:34 ` [PATCH 2/3 v2] regulator: tps65218: Remove unnecessary regulator_unregister call Axel Lin
  2014-02-19  8:35 ` [PATCH 3/3 v2] regulator: tps65218: Add OF dependency Axel Lin
@ 2014-02-19  8:38 ` Keerthy
  2 siblings, 0 replies; 6+ messages in thread
From: Keerthy @ 2014-02-19  8:38 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, Keerthy, Liam Girdwood, linux-kernel

On Wednesday 19 February 2014 02:03 PM, Axel Lin wrote:
> Fixes below build error:
> FATAL: drivers/regulator/tps65218-regulator: struct of_device_id is not terminated with a NULL entry!
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> I'm sorry that I just found I CC wrong developers in my previous mail.
> So here is a resend.
>   drivers/regulator/tps65218-regulator.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
> index 958276c..d1c7831 100644
> --- a/drivers/regulator/tps65218-regulator.c
> +++ b/drivers/regulator/tps65218-regulator.c
> @@ -96,6 +96,7 @@ static const struct of_device_id tps65218_of_match[] = {
>   	TPS65218_OF_MATCH("ti,tps65218-dcdc5", tps65218_pmic_regs[DCDC5]),
>   	TPS65218_OF_MATCH("ti,tps65218-dcdc6", tps65218_pmic_regs[DCDC6]),
>   	TPS65218_OF_MATCH("ti,tps65218-ldo1", tps65218_pmic_regs[LDO1]),
> +	{ }
>   };
>   MODULE_DEVICE_TABLE(of, tps65218_of_match);
Thanks

Acked-by: Keerthy <j-keerthy@ti.com>
>   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3 v2] regulator: tps65218: Remove unnecessary regulator_unregister call
  2014-02-19  8:34 ` [PATCH 2/3 v2] regulator: tps65218: Remove unnecessary regulator_unregister call Axel Lin
@ 2014-02-19  8:38   ` Keerthy
  0 siblings, 0 replies; 6+ messages in thread
From: Keerthy @ 2014-02-19  8:38 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, Keerthy, Liam Girdwood, linux-kernel

On Wednesday 19 February 2014 02:04 PM, Axel Lin wrote:
> Current code uses devm_regulator_register() so the we don't need to explicitly
> call regulator_unregister() in .remove.
> And then we don't need to save rdev pointer to tps->rdev[id].

Acked-by: Keerthy <j-keerthy@ti.com>

> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>   drivers/regulator/tps65218-regulator.c | 18 ------------------
>   1 file changed, 18 deletions(-)
>
> diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
> index d1c7831..1fb1db5 100644
> --- a/drivers/regulator/tps65218-regulator.c
> +++ b/drivers/regulator/tps65218-regulator.c
> @@ -267,23 +267,6 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
>   		return PTR_ERR(rdev);
>   	}
>   
> -	/* Save regulator */
> -	tps->rdev[id] = rdev;
> -
> -	return 0;
> -}
> -
> -static int tps65218_regulator_remove(struct platform_device *pdev)
> -{
> -	struct tps65218 *tps = platform_get_drvdata(pdev);
> -	const struct of_device_id	*match;
> -	const struct tps_info		*template;
> -
> -	match = of_match_device(tps65218_of_match, &pdev->dev);
> -	template = match->data;
> -	regulator_unregister(tps->rdev[template->id]);
> -	platform_set_drvdata(pdev, NULL);
> -
>   	return 0;
>   }
>   
> @@ -294,7 +277,6 @@ static struct platform_driver tps65218_regulator_driver = {
>   		.of_match_table = of_match_ptr(tps65218_of_match),
>   	},
>   	.probe = tps65218_regulator_probe,
> -	.remove = tps65218_regulator_remove,
>   };
>   
>   module_platform_driver(tps65218_regulator_driver);


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-19  8:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-19  8:33 [PATCH 1/3 v2] regulator: tps65218: Add terminate entry for of_device_id table Axel Lin
2014-02-19  8:34 ` [PATCH 2/3 v2] regulator: tps65218: Remove unnecessary regulator_unregister call Axel Lin
2014-02-19  8:38   ` Keerthy
2014-02-19  8:35 ` [PATCH 3/3 v2] regulator: tps65218: Add OF dependency Axel Lin
2014-02-19  8:38 ` [PATCH 1/3 v2] regulator: tps65218: Add terminate entry for of_device_id table Keerthy
  -- strict thread matches above, loose matches on Subject: below --
2014-02-19  8:29 Axel Lin
2014-02-19  8:30 ` [PATCH 2/3 v2] regulator: tps65218: Remove unnecessary regulator_unregister call Axel Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox