From 464aed729288801b5acb339c1025494c5c12407f Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Sat, 17 Oct 2009 05:09:55 +0400 Subject: Fix pcf50606-regulator drvdata usage Ported from 01f61025cee418405880d653f33ce179873a3610 --- drivers/mfd/pcf50606-core.c | 1 - drivers/regulator/pcf50606-regulator.c | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/pcf50606-core.c b/drivers/mfd/pcf50606-core.c index f886893929d..71c56a8b098 100644 --- a/drivers/mfd/pcf50606-core.c +++ b/drivers/mfd/pcf50606-core.c @@ -599,7 +599,6 @@ static int pcf50606_probe(struct i2c_client *client, pdev->dev.parent = pcf->dev; platform_device_add_data(pdev, &pdata->reg_init_data[i], sizeof(pdata->reg_init_data[i])); - pdev->dev.driver_data = pcf; pcf->regulator_pdev[i] = pdev; platform_device_add(pdev); diff --git a/drivers/regulator/pcf50606-regulator.c b/drivers/regulator/pcf50606-regulator.c index 58d020ef93c..667614c06f4 100644 --- a/drivers/regulator/pcf50606-regulator.c +++ b/drivers/regulator/pcf50606-regulator.c @@ -333,13 +333,15 @@ static int __devinit pcf50606_regulator_probe(struct platform_device *pdev) struct pcf50606 *pcf; /* Already set by core driver */ - pcf = platform_get_drvdata(pdev); + pcf = dev_to_pcf50606(pdev->dev.parent); rdev = regulator_register(®ulators[pdev->id], &pdev->dev, pdev->dev.platform_data, pcf); if (IS_ERR(rdev)) return PTR_ERR(rdev); + platform_set_drvdata(pdev, rdev); + if (pcf->pdata->regulator_registered) pcf->pdata->regulator_registered(pcf, pdev->id); @@ -350,6 +352,7 @@ static int __devexit pcf50606_regulator_remove(struct platform_device *pdev) { struct regulator_dev *rdev = platform_get_drvdata(pdev); + platform_set_drvdata(pdev, NULL); regulator_unregister(rdev); return 0; -- cgit v1.2.3