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

power: supply: max8997_charger: Use devm_work_autocancel()

Use devm_work_autocancel() instead of hand writing it.
It saves a few lines of code.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent d016fc7a
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/mfd/max8997.h> #include <linux/mfd/max8997.h>
#include <linux/mfd/max8997-private.h> #include <linux/mfd/max8997-private.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/devm-helpers.h>
/* MAX8997_REG_STATUS4 */ /* MAX8997_REG_STATUS4 */
#define DCINOK_SHIFT 1 #define DCINOK_SHIFT 1
...@@ -94,13 +95,6 @@ static int max8997_battery_get_property(struct power_supply *psy, ...@@ -94,13 +95,6 @@ static int max8997_battery_get_property(struct power_supply *psy,
return 0; return 0;
} }
static void max8997_battery_extcon_evt_stop_work(void *data)
{
struct charger_data *charger = data;
cancel_work_sync(&charger->extcon_work);
}
static void max8997_battery_extcon_evt_worker(struct work_struct *work) static void max8997_battery_extcon_evt_worker(struct work_struct *work)
{ {
struct charger_data *charger = struct charger_data *charger =
...@@ -255,8 +249,8 @@ static int max8997_battery_probe(struct platform_device *pdev) ...@@ -255,8 +249,8 @@ static int max8997_battery_probe(struct platform_device *pdev)
} }
if (!IS_ERR(charger->reg) && !IS_ERR_OR_NULL(charger->edev)) { if (!IS_ERR(charger->reg) && !IS_ERR_OR_NULL(charger->edev)) {
INIT_WORK(&charger->extcon_work, max8997_battery_extcon_evt_worker); ret = devm_work_autocancel(&pdev->dev, &charger->extcon_work,
ret = devm_add_action(&pdev->dev, max8997_battery_extcon_evt_stop_work, charger); max8997_battery_extcon_evt_worker);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to add extcon evt stop action: %d\n", ret); dev_err(&pdev->dev, "failed to add extcon evt stop action: %d\n", ret);
return ret; return ret;
......
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