@@ -173,8 +173,8 @@ void cleanup_slots(struct controller *ctrl)
list_for_each_safe(tmp, next, &ctrl->slot_list) {
slot = list_entry(tmp, struct slot, slot_list);
list_del(&slot->slot_list);
- cancel_delayed_work(&slot->work);
flush_workqueue(shpchp_wq);
+ cancel_delayed_work_sync(&slot->work);
flush_workqueue(shpchp_ordered_wq);
pci_hp_deregister(slot->hotplug_slot);
}
@@ -593,7 +593,7 @@ static void hpc_release_ctlr(struct controller *ctrl)
}
if (shpchp_poll_mode)
- del_timer(&ctrl->poll_timer);
+ del_timer_sync(&ctrl->poll_timer);
else {
free_irq(ctrl->pci_dev->irq, ctrl);
pci_disable_msi(ctrl->pci_dev);
del_timer() only deactivates a timer but doesn't wait for the handler to finish, so use del_timer_sync() to deactivate a timer and wait for the handler to finish in hpc_release_ctrl(). This patch also tune the workqueue flush logic to correctly flush all work items. Signed-off-by: Jiang Liu <jiang.liu@huawei.com> --- drivers/pci/hotplug/shpchp_core.c | 2 +- drivers/pci/hotplug/shpchp_hpc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)