linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: s5m8767: Fix carried over ena_gpio assignment
@ 2014-04-07 12:15 Krzysztof Kozlowski
  2014-04-07 12:15 ` [PATCH 2/2] regulator: s5m8767: Remove regulator_dev pointer from state container Krzysztof Kozlowski
  2014-04-07 12:41 ` [PATCH 1/2] regulator: s5m8767: Fix carried over ena_gpio assignment Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-07 12:15 UTC (permalink / raw)
  To: Sangbeom Kim, Liam Girdwood, Mark Brown, linux-kernel,
	linux-samsung-soc
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Tomasz Figa, Krzysztof Kozlowski

During registration of regulators if external control for regulator was
set in DTS the ena_gpio and ena_gpio_flags fields of regulator_config
were set to proper values.

However the same regulator_config was used in next iterations of loop so
the ena_gpio fields carried over to next regulators.

The issue was not observed as ena_gpio is supported only for Buck9
regulator which is often the last regulator parsed from DTS.
Be sure to clear ena_gpio config fields before registering the
regulator.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/regulator/s5m8767.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index f05badabd69e..92f19a005dc3 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -964,6 +964,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 		config.driver_data = s5m8767;
 		config.regmap = iodev->regmap_pmic;
 		config.of_node = pdata->regulators[i].reg_node;
+		config.ena_gpio = config.ena_gpio_flags = 0;
 		if (pdata->regulators[i].ext_control_gpio)
 			s5m8767_regulator_config_ext_control(s5m8767,
 					&pdata->regulators[i], &config);
-- 
1.7.9.5


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

* [PATCH 2/2] regulator: s5m8767: Remove regulator_dev pointer from state container
  2014-04-07 12:15 [PATCH 1/2] regulator: s5m8767: Fix carried over ena_gpio assignment Krzysztof Kozlowski
@ 2014-04-07 12:15 ` Krzysztof Kozlowski
  2014-04-07 12:42   ` Mark Brown
  2014-04-07 12:41 ` [PATCH 1/2] regulator: s5m8767: Fix carried over ena_gpio assignment Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-07 12:15 UTC (permalink / raw)
  To: Sangbeom Kim, Liam Girdwood, Mark Brown, linux-kernel,
	linux-samsung-soc
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Tomasz Figa, Krzysztof Kozlowski

Don't store pointer to regulator_dev returned by
devm_regulator_register() in state container. It isn't used anywhere
outside of probe.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/regulator/s5m8767.c |   17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 92f19a005dc3..5daa06626f16 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -28,7 +28,6 @@ struct s5m8767_info {
 	struct device *dev;
 	struct sec_pmic_dev *iodev;
 	int num_regulators;
-	struct regulator_dev **rdev;
 	struct sec_opmode_data *opmode;
 
 	int ramp_delay;
@@ -695,7 +694,6 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 	struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
 	struct sec_platform_data *pdata = iodev->pdata;
 	struct regulator_config config = { };
-	struct regulator_dev **rdev;
 	struct s5m8767_info *s5m8767;
 	int i, ret, size, buck_init;
 
@@ -737,11 +735,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	size = sizeof(struct regulator_dev *) * (S5M8767_REG_MAX - 2);
-	s5m8767->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
-	if (!s5m8767->rdev)
-		return -ENOMEM;
 
-	rdev = s5m8767->rdev;
 	s5m8767->dev = &pdev->dev;
 	s5m8767->iodev = iodev;
 	s5m8767->num_regulators = pdata->num_regulators;
@@ -938,6 +932,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 		const struct sec_voltage_desc *desc;
 		int id = pdata->regulators[i].id;
 		int enable_reg, enable_val;
+		struct regulator_dev *rdev;
 
 		desc = reg_voltage_map[id];
 		if (desc) {
@@ -969,21 +964,21 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 			s5m8767_regulator_config_ext_control(s5m8767,
 					&pdata->regulators[i], &config);
 
-		rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id],
+		rdev = devm_regulator_register(&pdev->dev, &regulators[id],
 						  &config);
-		if (IS_ERR(rdev[i])) {
-			ret = PTR_ERR(rdev[i]);
+		if (IS_ERR(rdev)) {
+			ret = PTR_ERR(rdev);
 			dev_err(s5m8767->dev, "regulator init failed for %d\n",
 					id);
 			return ret;
 		}
 
 		if (pdata->regulators[i].ext_control_gpio) {
-			ret = s5m8767_enable_ext_control(s5m8767, rdev[i]);
+			ret = s5m8767_enable_ext_control(s5m8767, rdev);
 			if (ret < 0) {
 				dev_err(s5m8767->dev,
 						"failed to enable gpio control over %s: %d\n",
-						rdev[i]->desc->name, ret);
+						rdev->desc->name, ret);
 				return ret;
 			}
 		}
-- 
1.7.9.5


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

* Re: [PATCH 1/2] regulator: s5m8767: Fix carried over ena_gpio assignment
  2014-04-07 12:15 [PATCH 1/2] regulator: s5m8767: Fix carried over ena_gpio assignment Krzysztof Kozlowski
  2014-04-07 12:15 ` [PATCH 2/2] regulator: s5m8767: Remove regulator_dev pointer from state container Krzysztof Kozlowski
@ 2014-04-07 12:41 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-04-07 12:41 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Liam Girdwood, linux-kernel, linux-samsung-soc,
	Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Tomasz Figa

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

On Mon, Apr 07, 2014 at 02:15:23PM +0200, Krzysztof Kozlowski wrote:
> During registration of regulators if external control for regulator was
> set in DTS the ena_gpio and ena_gpio_flags fields of regulator_config
> were set to proper values.

Applied, thanks.

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

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

* Re: [PATCH 2/2] regulator: s5m8767: Remove regulator_dev pointer from state container
  2014-04-07 12:15 ` [PATCH 2/2] regulator: s5m8767: Remove regulator_dev pointer from state container Krzysztof Kozlowski
@ 2014-04-07 12:42   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2014-04-07 12:42 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Liam Girdwood, linux-kernel, linux-samsung-soc,
	Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Tomasz Figa

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

On Mon, Apr 07, 2014 at 02:15:24PM +0200, Krzysztof Kozlowski wrote:
> Don't store pointer to regulator_dev returned by
> devm_regulator_register() in state container. It isn't used anywhere
> outside of probe.

Applied, thanks.

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

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

end of thread, other threads:[~2014-04-07 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-07 12:15 [PATCH 1/2] regulator: s5m8767: Fix carried over ena_gpio assignment Krzysztof Kozlowski
2014-04-07 12:15 ` [PATCH 2/2] regulator: s5m8767: Remove regulator_dev pointer from state container Krzysztof Kozlowski
2014-04-07 12:42   ` Mark Brown
2014-04-07 12:41 ` [PATCH 1/2] regulator: s5m8767: Fix carried over ena_gpio assignment Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).