Commit b2657167 authored by Hans de Goede's avatar Hans de Goede Committed by Sebastian Reichel

power: supply: axp288_fuel_gauge: Add dev helper var to probe()

Add a dev local variable to probe() as shortcut for &pdev->dev, this is
a preparation change for making more use of devm managed resources.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent fd46821e
......@@ -622,16 +622,17 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
[BAT_D_CURR] = "axp288-chrg-d-curr",
[BAT_VOLT] = "axp288-batt-volt",
};
struct device *dev = &pdev->dev;
unsigned int val;
if (dmi_check_system(axp288_no_battery_list))
return -ENODEV;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
info->dev = &pdev->dev;
info->dev = dev;
info->regmap = axp20x->regmap;
info->regmap_irqc = axp20x->regmap_irqc;
info->status = POWER_SUPPLY_STATUS_UNKNOWN;
......@@ -651,8 +652,7 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
iio_channel_get(NULL, iio_chan_name[i]);
if (IS_ERR(info->iio_channel[i])) {
ret = PTR_ERR(info->iio_channel[i]);
dev_dbg(&pdev->dev, "error getting iiochan %s: %d\n",
iio_chan_name[i], ret);
dev_dbg(dev, "error getting iiochan %s: %d\n", iio_chan_name[i], ret);
/* Wait for axp288_adc to load */
if (ret == -ENODEV)
ret = -EPROBE_DEFER;
......@@ -722,10 +722,10 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
goto out_free_iio_chan;
psy_cfg.drv_data = info;
info->bat = power_supply_register(&pdev->dev, &fuel_gauge_desc, &psy_cfg);
info->bat = power_supply_register(dev, &fuel_gauge_desc, &psy_cfg);
if (IS_ERR(info->bat)) {
ret = PTR_ERR(info->bat);
dev_err(&pdev->dev, "failed to register battery: %d\n", ret);
dev_err(dev, "failed to register battery: %d\n", ret);
goto out_free_iio_chan;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment