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

power: supply: axp20x_usb_power: fix work-queue init

The commit 6d0c5de2fd84
("power: supply: Clean-up few drivers by using managed work init")
Re-introduced wrong order of initializing work-queue and requesting
the IRQs which was originally fixed by the commit b5e8642ed95f
("power: supply: axp20x_usb_power: Init work before enabling IRQs")

In addition this caused the work queue to be initialized twice.

Fix it again.

Fixes: 6d0c5de2fd84 ("power: supply: Clean-up few drivers by using managed work init")
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reported-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/a774ca25010b7c932c07f22ce8a548466705c023.1616574973.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Matti Vaittinen and committed by
Greg Kroah-Hartman
ecdc996b a7d30f3f

+5 -5
+5 -5
drivers/power/supply/axp20x_usb_power.c
··· 594 594 power->axp20x_id = axp_data->axp20x_id; 595 595 power->regmap = axp20x->regmap; 596 596 power->num_irqs = axp_data->num_irq_names; 597 - INIT_DELAYED_WORK(&power->vbus_detect, axp20x_usb_power_poll_vbus); 597 + 598 + ret = devm_delayed_work_autocancel(&pdev->dev, &power->vbus_detect, 599 + axp20x_usb_power_poll_vbus); 600 + if (ret) 601 + return ret; 598 602 599 603 if (power->axp20x_id == AXP202_ID) { 600 604 /* Enable vbus valid checking */ ··· 651 647 } 652 648 } 653 649 654 - ret = devm_delayed_work_autocancel(&pdev->dev, &power->vbus_detect, 655 - axp20x_usb_power_poll_vbus); 656 - if (ret) 657 - return ret; 658 650 if (axp20x_usb_vbus_needs_polling(power)) 659 651 queue_delayed_work(system_power_efficient_wq, &power->vbus_detect, 0); 660 652