diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 21:00:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 21:00:37 +0000 |
commit | 94ac2ab3fff96814d7460a27a0e9d004abbd4128 (patch) | |
tree | 9a4eb8cc234b540b0f4b93363109cdd37a20540b /drivers/power/supply/rx51_battery.c | |
parent | Adding debian version 6.8.12-1. (diff) | |
download | linux-94ac2ab3fff96814d7460a27a0e9d004abbd4128.tar.xz linux-94ac2ab3fff96814d7460a27a0e9d004abbd4128.zip |
Merging upstream version 6.9.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/power/supply/rx51_battery.c')
-rw-r--r-- | drivers/power/supply/rx51_battery.c | 57 |
1 files changed, 12 insertions, 45 deletions
diff --git a/drivers/power/supply/rx51_battery.c b/drivers/power/supply/rx51_battery.c index e2bfc81f0f..7cdcd415e8 100644 --- a/drivers/power/supply/rx51_battery.c +++ b/drivers/power/supply/rx51_battery.c @@ -192,14 +192,11 @@ static int rx51_battery_probe(struct platform_device *pdev) { struct power_supply_config psy_cfg = {}; struct rx51_device_info *di; - int ret; di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); if (!di) return -ENOMEM; - platform_set_drvdata(pdev, di); - di->dev = &pdev->dev; di->bat_desc.name = "rx51-battery"; di->bat_desc.type = POWER_SUPPLY_TYPE_BATTERY; @@ -209,52 +206,23 @@ static int rx51_battery_probe(struct platform_device *pdev) psy_cfg.drv_data = di; - di->channel_temp = iio_channel_get(di->dev, "temp"); - if (IS_ERR(di->channel_temp)) { - ret = PTR_ERR(di->channel_temp); - goto error; - } + di->channel_temp = devm_iio_channel_get(di->dev, "temp"); + if (IS_ERR(di->channel_temp)) + return PTR_ERR(di->channel_temp); - di->channel_bsi = iio_channel_get(di->dev, "bsi"); - if (IS_ERR(di->channel_bsi)) { - ret = PTR_ERR(di->channel_bsi); - goto error_channel_temp; - } + di->channel_bsi = devm_iio_channel_get(di->dev, "bsi"); + if (IS_ERR(di->channel_bsi)) + return PTR_ERR(di->channel_bsi); - di->channel_vbat = iio_channel_get(di->dev, "vbat"); - if (IS_ERR(di->channel_vbat)) { - ret = PTR_ERR(di->channel_vbat); - goto error_channel_bsi; - } + di->channel_vbat = devm_iio_channel_get(di->dev, "vbat"); + if (IS_ERR(di->channel_vbat)) + return PTR_ERR(di->channel_vbat); - di->bat = power_supply_register(di->dev, &di->bat_desc, &psy_cfg); - if (IS_ERR(di->bat)) { - ret = PTR_ERR(di->bat); - goto error_channel_vbat; - } + di->bat = devm_power_supply_register(di->dev, &di->bat_desc, &psy_cfg); + if (IS_ERR(di->bat)) + return PTR_ERR(di->bat); return 0; - -error_channel_vbat: - iio_channel_release(di->channel_vbat); -error_channel_bsi: - iio_channel_release(di->channel_bsi); -error_channel_temp: - iio_channel_release(di->channel_temp); -error: - - return ret; -} - -static void rx51_battery_remove(struct platform_device *pdev) -{ - struct rx51_device_info *di = platform_get_drvdata(pdev); - - power_supply_unregister(di->bat); - - iio_channel_release(di->channel_vbat); - iio_channel_release(di->channel_bsi); - iio_channel_release(di->channel_temp); } #ifdef CONFIG_OF @@ -267,7 +235,6 @@ MODULE_DEVICE_TABLE(of, n900_battery_of_match); static struct platform_driver rx51_battery_driver = { .probe = rx51_battery_probe, - .remove_new = rx51_battery_remove, .driver = { .name = "rx51-battery", .of_match_table = of_match_ptr(n900_battery_of_match), |