public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev
@ 2014-03-09  7:27 Axel Lin
  2014-03-09  7:29 ` [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data Axel Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Axel Lin @ 2014-03-09  7:27 UTC (permalink / raw)
  To: Mark Brown; +Cc: Jonghwa Lee, Liam Girdwood, linux-kernel

Now we are using devm_regulator_register(), so we don't need to allocate *rdev[]
array to store return value of devm_regulator_register. Use a *rdev variable is
enough for checking return status.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/max77693.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index d6807fd..f5f85c2 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -38,7 +38,6 @@ struct max77693_pmic_dev {
 	struct device *dev;
 	struct max77693_dev *iodev;
 	int num_regulators;
-	struct regulator_dev **rdev;
 };
 
 /* CHARGER regulator ops */
@@ -249,12 +248,6 @@ static int max77693_pmic_probe(struct platform_device *pdev)
 	if (!max77693_pmic)
 		return -ENOMEM;
 
-	max77693_pmic->rdev = devm_kzalloc(&pdev->dev,
-				sizeof(struct regulator_dev *) * num_rdata,
-				GFP_KERNEL);
-	if (!max77693_pmic->rdev)
-		return -ENOMEM;
-
 	max77693_pmic->dev = &pdev->dev;
 	max77693_pmic->iodev = iodev;
 	max77693_pmic->num_regulators = num_rdata;
@@ -265,17 +258,18 @@ static int max77693_pmic_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, max77693_pmic);
 
 	for (i = 0; i < max77693_pmic->num_regulators; i++) {
+		struct regulator_dev *rdev;
 		int id = rdata[i].id;
 
 		config.init_data = rdata[i].initdata;
 		config.of_node = rdata[i].of_node;
 
-		max77693_pmic->rdev[i] = devm_regulator_register(&pdev->dev,
-						&regulators[id], &config);
-		if (IS_ERR(max77693_pmic->rdev[i])) {
+		rdev = devm_regulator_register(&pdev->dev, &regulators[id],
+					       &config);
+		if (IS_ERR(rdev)) {
 			dev_err(max77693_pmic->dev,
 				"Failed to initialize regulator-%d\n", id);
-			return PTR_ERR(max77693_pmic->rdev[i]);
+			return PTR_ERR(rdev);
 		}
 	}
 
-- 
1.8.1.2




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

* [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data
  2014-03-09  7:27 [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev Axel Lin
@ 2014-03-09  7:29 ` Axel Lin
  2014-03-10 10:11   ` Mark Brown
  2014-03-09  7:32 ` [PATCH 3/3] regulator: max8998: Remove unnecessary **rdev from struct max8998_data Axel Lin
  2014-03-10 12:14 ` [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev Mark Brown
  2 siblings, 1 reply; 7+ messages in thread
From: Axel Lin @ 2014-03-09  7:29 UTC (permalink / raw)
  To: Mark Brown
  Cc: Thomas Abraham, Kyungmin Park, MyungJoo Ham, Liam Girdwood,
	linux-kernel

Now we are using devm_regulator_register(), so we don't need to allocate *rdev[]
array to store return value of devm_regulator_register. Use a *rdev variable is
enough for checking return status.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/max8997.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index f657d8d..90b4c53 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -38,7 +38,6 @@ struct max8997_data {
 	struct device *dev;
 	struct max8997_dev *iodev;
 	int num_regulators;
-	struct regulator_dev **rdev;
 	int ramp_delay; /* in mV/us */
 
 	bool buck1_gpiodvs;
@@ -1029,10 +1028,10 @@ static int max8997_pmic_probe(struct platform_device *pdev)
 	struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent);
 	struct max8997_platform_data *pdata = iodev->pdata;
 	struct regulator_config config = { };
-	struct regulator_dev **rdev;
+	struct regulator_dev *rdev;
 	struct max8997_data *max8997;
 	struct i2c_client *i2c;
-	int i, ret, size, nr_dvs;
+	int i, ret, nr_dvs;
 	u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0;
 
 	if (!pdata) {
@@ -1051,12 +1050,6 @@ static int max8997_pmic_probe(struct platform_device *pdev)
 	if (!max8997)
 		return -ENOMEM;
 
-	size = sizeof(struct regulator_dev *) * pdata->num_regulators;
-	max8997->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
-	if (!max8997->rdev)
-		return -ENOMEM;
-
-	rdev = max8997->rdev;
 	max8997->dev = &pdev->dev;
 	max8997->iodev = iodev;
 	max8997->num_regulators = pdata->num_regulators;
@@ -1204,12 +1197,12 @@ static int max8997_pmic_probe(struct platform_device *pdev)
 		config.driver_data = max8997;
 		config.of_node = pdata->regulators[i].reg_node;
 
-		rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id],
-						  &config);
-		if (IS_ERR(rdev[i])) {
+		rdev = devm_regulator_register(&pdev->dev, &regulators[id],
+					       &config);
+		if (IS_ERR(rdev)) {
 			dev_err(max8997->dev, "regulator init failed for %d\n",
 					id);
-			return PTR_ERR(rdev[i]);
+			return PTR_ERR(rdev);
 		}
 	}
 
-- 
1.8.1.2




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

* [PATCH 3/3] regulator: max8998: Remove unnecessary **rdev from struct max8998_data
  2014-03-09  7:27 [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev Axel Lin
  2014-03-09  7:29 ` [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data Axel Lin
@ 2014-03-09  7:32 ` Axel Lin
  2014-03-10 10:12   ` Mark Brown
  2014-03-10 12:14 ` [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev Mark Brown
  2 siblings, 1 reply; 7+ messages in thread
From: Axel Lin @ 2014-03-09  7:32 UTC (permalink / raw)
  To: Mark Brown
  Cc: Thomas Abraham, Kyungmin Park, MyungJoo Ham, Liam Girdwood,
	linux-kernel

Now we are using devm_regulator_register(), so we don't need to allocate *rdev[]
array to store return value of devm_regulator_register. Use a *rdev variable is
enough for checking return status.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/max8998.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index ce22d4f..961091b 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -40,7 +40,6 @@ struct max8998_data {
 	struct device		*dev;
 	struct max8998_dev	*iodev;
 	int			num_regulators;
-	struct regulator_dev	**rdev;
 	u8                      buck1_vol[4]; /* voltages for selection */
 	u8                      buck2_vol[2];
 	unsigned int		buck1_idx; /* index to last changed voltage */
@@ -746,10 +745,10 @@ static int max8998_pmic_probe(struct platform_device *pdev)
 	struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent);
 	struct max8998_platform_data *pdata = iodev->pdata;
 	struct regulator_config config = { };
-	struct regulator_dev **rdev;
+	struct regulator_dev *rdev;
 	struct max8998_data *max8998;
 	struct i2c_client *i2c;
-	int i, ret, size;
+	int i, ret;
 	unsigned int v;
 
 	if (!pdata) {
@@ -768,12 +767,6 @@ static int max8998_pmic_probe(struct platform_device *pdev)
 	if (!max8998)
 		return -ENOMEM;
 
-	size = sizeof(struct regulator_dev *) * pdata->num_regulators;
-	max8998->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
-	if (!max8998->rdev)
-		return -ENOMEM;
-
-	rdev = max8998->rdev;
 	max8998->dev = &pdev->dev;
 	max8998->iodev = iodev;
 	max8998->num_regulators = pdata->num_regulators;
@@ -877,13 +870,12 @@ static int max8998_pmic_probe(struct platform_device *pdev)
 		config.init_data = pdata->regulators[i].initdata;
 		config.driver_data = max8998;
 
-		rdev[i] = devm_regulator_register(&pdev->dev,
-						  &regulators[index], &config);
-		if (IS_ERR(rdev[i])) {
-			ret = PTR_ERR(rdev[i]);
+		rdev = devm_regulator_register(&pdev->dev, &regulators[index],
+					       &config);
+		if (IS_ERR(rdev)) {
+			ret = PTR_ERR(rdev);
 			dev_err(max8998->dev, "regulator %s init failed (%d)\n",
 						regulators[index].name, ret);
-			rdev[i] = NULL;
 			return ret;
 		}
 	}
-- 
1.8.1.2




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

* Re: [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data
@ 2014-03-10  9:56 MyungJoo Ham
  0 siblings, 0 replies; 7+ messages in thread
From: MyungJoo Ham @ 2014-03-10  9:56 UTC (permalink / raw)
  To: Axel Lin, Mark Brown
  Cc: Thomas Abraham, 박경민, Liam Girdwood,
	linux-kernel@vger.kernel.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 466 bytes --]

> Now we are using devm_regulator_register(), so we don't need to allocate *rdev[]
> array to store return value of devm_regulator_register. Use a *rdev variable is
> enough for checking return status.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data
  2014-03-09  7:29 ` [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data Axel Lin
@ 2014-03-10 10:11   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-03-10 10:11 UTC (permalink / raw)
  To: Axel Lin
  Cc: Thomas Abraham, Kyungmin Park, MyungJoo Ham, Liam Girdwood,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

On Sun, Mar 09, 2014 at 03:29:31PM +0800, Axel Lin wrote:
> Now we are using devm_regulator_register(), so we don't need to allocate *rdev[]
> array to store return value of devm_regulator_register. Use a *rdev variable is
> enough for checking return status.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 3/3] regulator: max8998: Remove unnecessary **rdev from struct max8998_data
  2014-03-09  7:32 ` [PATCH 3/3] regulator: max8998: Remove unnecessary **rdev from struct max8998_data Axel Lin
@ 2014-03-10 10:12   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-03-10 10:12 UTC (permalink / raw)
  To: Axel Lin
  Cc: Thomas Abraham, Kyungmin Park, MyungJoo Ham, Liam Girdwood,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

On Sun, Mar 09, 2014 at 03:32:19PM +0800, Axel Lin wrote:
> Now we are using devm_regulator_register(), so we don't need to allocate *rdev[]
> array to store return value of devm_regulator_register. Use a *rdev variable is
> enough for checking return status.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev
  2014-03-09  7:27 [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev Axel Lin
  2014-03-09  7:29 ` [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data Axel Lin
  2014-03-09  7:32 ` [PATCH 3/3] regulator: max8998: Remove unnecessary **rdev from struct max8998_data Axel Lin
@ 2014-03-10 12:14 ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-03-10 12:14 UTC (permalink / raw)
  To: Axel Lin; +Cc: Jonghwa Lee, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

On Sun, Mar 09, 2014 at 03:27:12PM +0800, Axel Lin wrote:
> Now we are using devm_regulator_register(), so we don't need to allocate *rdev[]
> array to store return value of devm_regulator_register. Use a *rdev variable is
> enough for checking return status.

This doesn't apply with Krzysztof's recent (and more comprehensive)
patch - I think it's now redundant though?  If not can you please
resubmit against current code.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2014-03-10 12:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-09  7:27 [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev Axel Lin
2014-03-09  7:29 ` [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data Axel Lin
2014-03-10 10:11   ` Mark Brown
2014-03-09  7:32 ` [PATCH 3/3] regulator: max8998: Remove unnecessary **rdev from struct max8998_data Axel Lin
2014-03-10 10:12   ` Mark Brown
2014-03-10 12:14 ` [PATCH 1/3] regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2014-03-10  9:56 [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data MyungJoo Ham

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