diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-08-01 16:34:12 +0530 |
---|---|---|
committer | Varun Wadekar <vwadekar@nvidia.com> | 2012-08-08 17:00:29 +0530 |
commit | 4e197e4c9bd51be4adae6b3cda7fe92b2d802a8f (patch) | |
tree | cbc0b80b9035c9448114f7c333bdf8bef2ce2360 /drivers/power | |
parent | e73a81819b4790151e08aee3ec1cc57ef85abe55 (diff) |
power: tps80031: battery-gauge: register as mfd sub device
Register battery gauge driver of TPS80031 as mfd
sub driver in place of adding it as a sub devices.
This is inline with the mfd driver policy.
Change-Id: I15765be19fc138695de2d813e5fa025400747c86
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/121134
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/tps80031_battery_gauge.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/power/tps80031_battery_gauge.c b/drivers/power/tps80031_battery_gauge.c index 9ccfaad41441..69bad9caa99d 100644 --- a/drivers/power/tps80031_battery_gauge.c +++ b/drivers/power/tps80031_battery_gauge.c @@ -453,7 +453,20 @@ static int tps80031_battery_probe(struct platform_device *pdev) uint8_t retval; struct device *dev = &pdev->dev; struct tps80031_device_info *di; - struct tps80031_bg_platform_data *pdata = pdev->dev.platform_data; + struct tps80031_platform_data *tps80031_pdata; + struct tps80031_bg_platform_data *pdata; + + tps80031_pdata = dev_get_platdata(pdev->dev.parent); + if (!tps80031_pdata) { + dev_err(&pdev->dev, "no tps80031 platform_data specified\n"); + return -EINVAL; + } + + pdata = tps80031_pdata->bg_pdata; + if (!pdata) { + dev_err(&pdev->dev, "no battery_gauge platform data\n"); + return -EINVAL; + } di = devm_kzalloc(&pdev->dev, sizeof *di, GFP_KERNEL); if (!di) { |