* protects scheduling, execution and cancellation of @work
* @hotplug_lock: serializes calls to pciehp_enable_slot() and
* pciehp_disable_slot()
- * @wq: work queue on which @work is scheduled
*/
struct slot {
u8 state;
struct delayed_work work;
struct mutex lock;
struct mutex hotplug_lock;
- struct workqueue_struct *wq;
};
/**
*/
static void release_slot(struct hotplug_slot *hotplug_slot)
{
- struct slot *slot = hotplug_slot->private;
-
- /* queued work needs hotplug_slot name */
- cancel_delayed_work(&slot->work);
- drain_workqueue(slot->wq);
-
kfree(hotplug_slot->ops);
kfree(hotplug_slot->info);
kfree(hotplug_slot);
/* blink green LED and turn off amber */
pciehp_green_led_blink(p_slot);
pciehp_set_attention_status(p_slot, 0);
- queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ);
+ schedule_delayed_work(&p_slot->work, 5 * HZ);
break;
case BLINKINGOFF_STATE:
case BLINKINGON_STATE:
if (!slot)
return -ENOMEM;
- slot->wq = alloc_ordered_workqueue("pciehp-%u", 0, PSN(ctrl));
- if (!slot->wq)
- goto abort;
-
slot->ctrl = ctrl;
mutex_init(&slot->lock);
mutex_init(&slot->hotplug_lock);
INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work);
ctrl->slot = slot;
return 0;
-abort:
- kfree(slot);
- return -ENOMEM;
}
static void pcie_cleanup_slot(struct controller *ctrl)
{
struct slot *slot = ctrl->slot;
- destroy_workqueue(slot->wq);
+ cancel_delayed_work_sync(&slot->work);
kfree(slot);
}