mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
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>
This commit is contained in:
parent
419c0e9d25
commit
d016fc7ab5
@ -18,6 +18,7 @@
|
|||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/power_supply.h>
|
#include <linux/power_supply.h>
|
||||||
|
#include <linux/devm-helpers.h>
|
||||||
|
|
||||||
#define MAX14656_MANUFACTURER "Maxim Integrated"
|
#define MAX14656_MANUFACTURER "Maxim Integrated"
|
||||||
#define MAX14656_NAME "max14656"
|
#define MAX14656_NAME "max14656"
|
||||||
@ -233,14 +234,6 @@ static enum power_supply_property max14656_battery_props[] = {
|
|||||||
POWER_SUPPLY_PROP_MANUFACTURER,
|
POWER_SUPPLY_PROP_MANUFACTURER,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void stop_irq_work(void *data)
|
|
||||||
{
|
|
||||||
struct max14656_chip *chip = data;
|
|
||||||
|
|
||||||
cancel_delayed_work_sync(&chip->irq_work);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int max14656_probe(struct i2c_client *client,
|
static int max14656_probe(struct i2c_client *client,
|
||||||
const struct i2c_device_id *id)
|
const struct i2c_device_id *id)
|
||||||
{
|
{
|
||||||
@ -286,10 +279,10 @@ static int max14656_probe(struct i2c_client *client,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT_DELAYED_WORK(&chip->irq_work, max14656_irq_worker);
|
ret = devm_delayed_work_autocancel(dev, &chip->irq_work,
|
||||||
ret = devm_add_action(dev, stop_irq_work, chip);
|
max14656_irq_worker);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "devm_add_action %d failed\n", ret);
|
dev_err(dev, "devm_delayed_work_autocancel %d failed\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user