|
@@ -39,8 +39,6 @@
|
|
|
bool shpchp_debug;
|
|
|
bool shpchp_poll_mode;
|
|
|
int shpchp_poll_time;
|
|
|
-struct workqueue_struct *shpchp_wq;
|
|
|
-struct workqueue_struct *shpchp_ordered_wq;
|
|
|
|
|
|
#define DRIVER_VERSION "0.4"
|
|
|
#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
|
|
@@ -129,6 +127,14 @@ static int init_slots(struct controller *ctrl)
|
|
|
slot->device = ctrl->slot_device_offset + i;
|
|
|
slot->hpc_ops = ctrl->hpc_ops;
|
|
|
slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i);
|
|
|
+
|
|
|
+ snprintf(name, sizeof(name), "shpchp-%d", slot->number);
|
|
|
+ slot->wq = alloc_workqueue(name, 0, 0);
|
|
|
+ if (!slot->wq) {
|
|
|
+ retval = -ENOMEM;
|
|
|
+ goto error_info;
|
|
|
+ }
|
|
|
+
|
|
|
mutex_init(&slot->lock);
|
|
|
INIT_DELAYED_WORK(&slot->work, shpchp_queue_pushbutton_work);
|
|
|
|
|
@@ -148,7 +154,7 @@ static int init_slots(struct controller *ctrl)
|
|
|
if (retval) {
|
|
|
ctrl_err(ctrl, "pci_hp_register failed with error %d\n",
|
|
|
retval);
|
|
|
- goto error_info;
|
|
|
+ goto error_slotwq;
|
|
|
}
|
|
|
|
|
|
get_power_status(hotplug_slot, &info->power_status);
|
|
@@ -160,6 +166,8 @@ static int init_slots(struct controller *ctrl)
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
+error_slotwq:
|
|
|
+ destroy_workqueue(slot->wq);
|
|
|
error_info:
|
|
|
kfree(info);
|
|
|
error_hpslot:
|
|
@@ -180,8 +188,7 @@ void cleanup_slots(struct controller *ctrl)
|
|
|
slot = list_entry(tmp, struct slot, slot_list);
|
|
|
list_del(&slot->slot_list);
|
|
|
cancel_delayed_work(&slot->work);
|
|
|
- flush_workqueue(shpchp_wq);
|
|
|
- flush_workqueue(shpchp_ordered_wq);
|
|
|
+ destroy_workqueue(slot->wq);
|
|
|
pci_hp_deregister(slot->hotplug_slot);
|
|
|
}
|
|
|
}
|
|
@@ -364,25 +371,12 @@ static struct pci_driver shpc_driver = {
|
|
|
|
|
|
static int __init shpcd_init(void)
|
|
|
{
|
|
|
- int retval = 0;
|
|
|
-
|
|
|
- shpchp_wq = alloc_ordered_workqueue("shpchp", 0);
|
|
|
- if (!shpchp_wq)
|
|
|
- return -ENOMEM;
|
|
|
-
|
|
|
- shpchp_ordered_wq = alloc_ordered_workqueue("shpchp_ordered", 0);
|
|
|
- if (!shpchp_ordered_wq) {
|
|
|
- destroy_workqueue(shpchp_wq);
|
|
|
- return -ENOMEM;
|
|
|
- }
|
|
|
+ int retval;
|
|
|
|
|
|
retval = pci_register_driver(&shpc_driver);
|
|
|
dbg("%s: pci_register_driver = %d\n", __func__, retval);
|
|
|
info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
|
|
|
- if (retval) {
|
|
|
- destroy_workqueue(shpchp_ordered_wq);
|
|
|
- destroy_workqueue(shpchp_wq);
|
|
|
- }
|
|
|
+
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
@@ -390,8 +384,6 @@ static void __exit shpcd_cleanup(void)
|
|
|
{
|
|
|
dbg("unload_shpchpd()\n");
|
|
|
pci_unregister_driver(&shpc_driver);
|
|
|
- destroy_workqueue(shpchp_ordered_wq);
|
|
|
- destroy_workqueue(shpchp_wq);
|
|
|
info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
|
|
|
}
|
|
|
|