summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sebastian.reichel@collabora.com>2018-09-29 08:47:43 +0200
committerSebastian Reichel <sre@kernel.org>2018-12-13 00:16:56 +0100
commitfbd17e58d472d7ec49810c6cd87900d73e75bb2b (patch)
tree349215a996dc6917ad8bde983d29650a7b3ad299
parent63fac6cb63b06eb1ee471d7d62a1c2e8cf72bdf0 (diff)
downloadlinux-fbd17e58d472d7ec49810c6cd87900d73e75bb2b.tar.bz2
power: supply: ds2781: 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>
-rw-r--r--drivers/power/supply/ds2781_battery.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/power/supply/ds2781_battery.c b/drivers/power/supply/ds2781_battery.c
index c81cc14e7acb..166a8bd58811 100644
--- a/drivers/power/supply/ds2781_battery.c
+++ b/drivers/power/supply/ds2781_battery.c
@@ -772,8 +772,9 @@ static int ds2781_battery_probe(struct platform_device *pdev)
psy_cfg.drv_data = dev_info;
psy_cfg.attr_grp = ds2781_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);
@@ -782,21 +783,11 @@ static int ds2781_battery_probe(struct platform_device *pdev)
return 0;
}
-static int ds2781_battery_remove(struct platform_device *pdev)
-{
- struct ds2781_device_info *dev_info = platform_get_drvdata(pdev);
-
- power_supply_unregister(dev_info->bat);
-
- return 0;
-}
-
static struct platform_driver ds2781_battery_driver = {
.driver = {
.name = "ds2781-battery",
},
.probe = ds2781_battery_probe,
- .remove = ds2781_battery_remove,
};
module_platform_driver(ds2781_battery_driver);