Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

power: supply: max14656: Use devm_work_autocancel()

Use devm_delayed_work_autocancel() instead of hand writing it.
It saves a few lines of code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Christophe JAILLET and committed by
Sebastian Reichel
d016fc7a 419c0e9d

+4 -11
+4 -11
drivers/power/supply/max14656_charger_detector.c
··· 18 18 #include <linux/of_device.h> 19 19 #include <linux/workqueue.h> 20 20 #include <linux/power_supply.h> 21 + #include <linux/devm-helpers.h> 21 22 22 23 #define MAX14656_MANUFACTURER "Maxim Integrated" 23 24 #define MAX14656_NAME "max14656" ··· 234 233 POWER_SUPPLY_PROP_MANUFACTURER, 235 234 }; 236 235 237 - static void stop_irq_work(void *data) 238 - { 239 - struct max14656_chip *chip = data; 240 - 241 - cancel_delayed_work_sync(&chip->irq_work); 242 - } 243 - 244 - 245 236 static int max14656_probe(struct i2c_client *client, 246 237 const struct i2c_device_id *id) 247 238 { ··· 279 286 return -EINVAL; 280 287 } 281 288 282 - INIT_DELAYED_WORK(&chip->irq_work, max14656_irq_worker); 283 - ret = devm_add_action(dev, stop_irq_work, chip); 289 + ret = devm_delayed_work_autocancel(dev, &chip->irq_work, 290 + max14656_irq_worker); 284 291 if (ret) { 285 - dev_err(dev, "devm_add_action %d failed\n", ret); 292 + dev_err(dev, "devm_delayed_work_autocancel %d failed\n", ret); 286 293 return ret; 287 294 } 288 295