2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 14:43:58 +08:00

power: supply: ds2780: switch to devm_power_supply_register

Simplify/Cleanup the driver by switching to devm_power_supply_register
and dropping the driver's remove function.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Sebastian Reichel 2018-09-29 08:01:12 +02:00 committed by Sebastian Reichel
parent 711aebcfe3
commit 63fac6cb63

View File

@ -768,8 +768,9 @@ static int ds2780_battery_probe(struct platform_device *pdev)
psy_cfg.drv_data = dev_info;
psy_cfg.attr_grp = ds2780_sysfs_groups;
dev_info->bat = power_supply_register(&pdev->dev, &dev_info->bat_desc,
&psy_cfg);
dev_info->bat = devm_power_supply_register(&pdev->dev,
&dev_info->bat_desc,
&psy_cfg);
if (IS_ERR(dev_info->bat)) {
dev_err(dev_info->dev, "failed to register battery\n");
return PTR_ERR(dev_info->bat);
@ -778,21 +779,11 @@ static int ds2780_battery_probe(struct platform_device *pdev)
return 0;
}
static int ds2780_battery_remove(struct platform_device *pdev)
{
struct ds2780_device_info *dev_info = platform_get_drvdata(pdev);
power_supply_unregister(dev_info->bat);
return 0;
}
static struct platform_driver ds2780_battery_driver = {
.driver = {
.name = "ds2780-battery",
},
.probe = ds2780_battery_probe,
.remove = ds2780_battery_remove,
};
module_platform_driver(ds2780_battery_driver);