Skip to content

Commit

Permalink
power: supply: axp288_fuel_gauge: Add dev helper var to probe()
Browse files Browse the repository at this point in the history
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: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
  • Loading branch information
Hans de Goede authored and Sebastian Reichel committed Feb 1, 2022
1 parent fd46821 commit b265716
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/power/supply/axp288_fuel_gauge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit b265716

Please sign in to comment.