Commit e5372503 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Sebastian Reichel

power: supply: max17042_battery: Use devm_work_autocancel()

Use devm_work_autocancel() instead of hand-writing it.
This saves a few lines of code.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 4c678b7a
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
// This driver is based on max17040_battery.c // This driver is based on max17040_battery.c
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/devm-helpers.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -1030,13 +1031,6 @@ static const struct power_supply_desc max17042_no_current_sense_psy_desc = { ...@@ -1030,13 +1031,6 @@ static const struct power_supply_desc max17042_no_current_sense_psy_desc = {
.num_properties = ARRAY_SIZE(max17042_battery_props) - 2, .num_properties = ARRAY_SIZE(max17042_battery_props) - 2,
}; };
static void max17042_stop_work(void *data)
{
struct max17042_chip *chip = data;
cancel_work_sync(&chip->work);
}
static int max17042_probe(struct i2c_client *client, static int max17042_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -1142,8 +1136,8 @@ static int max17042_probe(struct i2c_client *client, ...@@ -1142,8 +1136,8 @@ static int max17042_probe(struct i2c_client *client,
regmap_read(chip->regmap, MAX17042_STATUS, &val); regmap_read(chip->regmap, MAX17042_STATUS, &val);
if (val & STATUS_POR_BIT) { if (val & STATUS_POR_BIT) {
INIT_WORK(&chip->work, max17042_init_worker); ret = devm_work_autocancel(&client->dev, &chip->work,
ret = devm_add_action(&client->dev, max17042_stop_work, chip); max17042_init_worker);
if (ret) if (ret)
return ret; return ret;
schedule_work(&chip->work); schedule_work(&chip->work);
......
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