diff options
Diffstat (limited to 'drivers/power/supply/axp20x_usb_power.c')
-rw-r--r-- | drivers/power/supply/axp20x_usb_power.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c index 8933ae26c3d6..e954970b50e6 100644 --- a/drivers/power/supply/axp20x_usb_power.c +++ b/drivers/power/supply/axp20x_usb_power.c @@ -8,6 +8,7 @@ #include <linux/bitops.h> #include <linux/device.h> +#include <linux/devm-helpers.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/kernel.h> @@ -593,7 +594,11 @@ static int axp20x_usb_power_probe(struct platform_device *pdev) power->axp20x_id = axp_data->axp20x_id; power->regmap = axp20x->regmap; power->num_irqs = axp_data->num_irq_names; - INIT_DELAYED_WORK(&power->vbus_detect, axp20x_usb_power_poll_vbus); + + ret = devm_delayed_work_autocancel(&pdev->dev, &power->vbus_detect, + axp20x_usb_power_poll_vbus); + if (ret) + return ret; if (power->axp20x_id == AXP202_ID) { /* Enable vbus valid checking */ @@ -652,15 +657,6 @@ static int axp20x_usb_power_probe(struct platform_device *pdev) return 0; } -static int axp20x_usb_power_remove(struct platform_device *pdev) -{ - struct axp20x_usb_power *power = platform_get_drvdata(pdev); - - cancel_delayed_work_sync(&power->vbus_detect); - - return 0; -} - static const struct of_device_id axp20x_usb_power_match[] = { { .compatible = "x-powers,axp202-usb-power-supply", @@ -680,7 +676,6 @@ MODULE_DEVICE_TABLE(of, axp20x_usb_power_match); static struct platform_driver axp20x_usb_power_driver = { .probe = axp20x_usb_power_probe, - .remove = axp20x_usb_power_remove, .driver = { .name = DRVNAME, .of_match_table = axp20x_usb_power_match, |