]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/pci/hotplug/shpchp_core.c
Merge tag 'v2.6.37' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / pci / hotplug / shpchp_core.c
index a7bd5048396ed61ba1d379b713215c39725e0bd0..aca972bbfb4c8ba04e7fc74efd74636ebe49ea65 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
-#include <linux/workqueue.h>
 #include "shpchp.h"
 
 /* Global variables */
@@ -41,6 +40,7 @@ int shpchp_debug;
 int 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>"
@@ -174,8 +174,8 @@ 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_scheduled_work();
                flush_workqueue(shpchp_wq);
+               flush_workqueue(shpchp_ordered_wq);
                pci_hp_deregister(slot->hotplug_slot);
        }
 }
@@ -360,9 +360,23 @@ 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;
+       }
+
        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;
 }
 
@@ -370,6 +384,8 @@ 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");
 }