public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] lp8788-buck: fix a parent deivce in _probe()
@ 2013-01-03  6:31 Kim, Milo
  2013-01-03 11:31 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Kim, Milo @ 2013-01-03  6:31 UTC (permalink / raw)
  To: Mark Brown; +Cc: Girdwood, Liam, linux-kernel@vger.kernel.org

 The lp8788-buck is a platform driver of lp8788-mfd.
 The platform device is allocated when mfd_add_devices() is called
 in lp8788-mfd.
 On the other hand, 'lp->dev' is the i2c client device.

 Therefore, this 'platform_device' is a proper parent device in case of
 resource managed mem alloc, registering a regulator and device kernel message.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
---
 drivers/regulator/lp8788-buck.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/lp8788-buck.c b/drivers/regulator/lp8788-buck.c
index aef3f2b..4916a55 100644
--- a/drivers/regulator/lp8788-buck.c
+++ b/drivers/regulator/lp8788-buck.c
@@ -503,7 +503,7 @@ static int lp8788_buck_probe(struct platform_device *pdev)
 	struct regulator_dev *rdev;
 	int ret;
 
-	buck = devm_kzalloc(lp->dev, sizeof(struct lp8788_buck), GFP_KERNEL);
+	buck = devm_kzalloc(&pdev->dev, sizeof(struct lp8788_buck), GFP_KERNEL);
 	if (!buck)
 		return -ENOMEM;
 
@@ -513,7 +513,7 @@ static int lp8788_buck_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	cfg.dev = lp->dev;
+	cfg.dev = pdev->dev.parent;
 	cfg.init_data = lp->pdata ? lp->pdata->buck_data[id] : NULL;
 	cfg.driver_data = buck;
 	cfg.regmap = lp->regmap;
@@ -521,7 +521,7 @@ static int lp8788_buck_probe(struct platform_device *pdev)
 	rdev = regulator_register(&lp8788_buck_desc[id], &cfg);
 	if (IS_ERR(rdev)) {
 		ret = PTR_ERR(rdev);
-		dev_err(lp->dev, "BUCK%d regulator register err = %d\n",
+		dev_err(&pdev->dev, "BUCK%d regulator register err = %d\n",
 				id + 1, ret);
 		return ret;
 	}
-- 
1.7.9.5


Best Regards,
Milo



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

* Re: [PATCH 1/5] lp8788-buck: fix a parent deivce in _probe()
  2013-01-03  6:31 [PATCH 1/5] lp8788-buck: fix a parent deivce in _probe() Kim, Milo
@ 2013-01-03 11:31 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-01-03 11:31 UTC (permalink / raw)
  To: Kim, Milo; +Cc: Girdwood, Liam, linux-kernel@vger.kernel.org

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

On Thu, Jan 03, 2013 at 06:31:02AM +0000, Kim, Milo wrote:
>  The lp8788-buck is a platform driver of lp8788-mfd.
>  The platform device is allocated when mfd_add_devices() is called
>  in lp8788-mfd.
>  On the other hand, 'lp->dev' is the i2c client device.

Applied all, thanks.

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

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

end of thread, other threads:[~2013-01-03 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03  6:31 [PATCH 1/5] lp8788-buck: fix a parent deivce in _probe() Kim, Milo
2013-01-03 11:31 ` Mark Brown

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