compat: backport system_nrt_wq
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 6 Nov 2011 21:25:03 +0000 (22:25 +0100)
committerLuis R. Rodriguez <mcgrof@qca.qualcomm.com>
Tue, 8 Nov 2011 19:21:01 +0000 (11:21 -0800)
The workqueue system_nrt_wq is not available in kernel version < 2.6.36.
This backport code creates such a queue but this old kernel does not
have WQ_NON_REENTRANT, so we use a single threaded queue instead as it
should meat the same restrictions.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
compat/compat-2.6.36.c
compat/main.c
include/linux/compat-2.6.36.h

index 5faefb4b2376fb7087bfccbda1949bd0ffb70b70..aab25df7a963f0a8c95d9deb7097ab5dd2fe801a 100644 (file)
@@ -92,5 +92,20 @@ void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor)
        spin_unlock_irqrestore(&anchor->lock, flags);
 }
 EXPORT_SYMBOL_GPL(compat_usb_scuttle_anchored_urbs);
+
+struct workqueue_struct *system_nrt_wq __read_mostly;
+EXPORT_SYMBOL_GPL(system_nrt_wq);
+
+void compat_system_workqueue_create()
+{
+       system_nrt_wq = create_singlethread_workqueue("events_nrt");
+       WARN_ON(system_nrt_wq);
+}
+
+void compat_system_workqueue_destroy()
+{
+       destroy_workqueue(system_nrt_wq);
+}
+
 #endif /* CONFIG_COMPAT_USB_URB_THREAD_FIX */
 
index a1a48d01a73dbd13763671367640439afc904446..f830488f0aa5f7ac1d2b631052524470e3832f78 100644 (file)
@@ -36,6 +36,7 @@ static int __init compat_init(void)
 {
        /* pm-qos for kernels <= 2.6.24, this is a no-op on newer kernels */
        compat_pm_qos_power_init();
+       compat_system_workqueue_create();
 
        printk(KERN_INFO
               COMPAT_PROJECT " backport release: "
@@ -52,6 +53,7 @@ module_init(compat_init);
 static void __exit compat_exit(void)
 {
        compat_pm_qos_power_deinit();
+       compat_system_workqueue_destroy();
 
         return;
 }
index f4d6f800c83d95521d758ce4ad478582d8b53955..29ade270a9e9ec5f799b0e4e7cc502ea20894c78 100644 (file)
@@ -134,6 +134,21 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
 {
 }
 
+extern struct workqueue_struct *system_nrt_wq;
+
+void compat_system_workqueue_create(void);
+void compat_system_workqueue_destroy(void);
+
+#else
+
+static inline void compat_system_workqueue_create(void)
+{
+}
+
+static inline void compat_system_workqueue_destroy(void)
+{
+}
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
 
 #endif /* LINUX_26_36_COMPAT_H */