Search Linux Wireless

[PATCH 1/2] compat: backport system_nrt_wq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 compat/compat-2.6.36.c        |   15 +++++++++++++++
 compat/main.c                 |    2 ++
 include/linux/compat-2.6.36.h |   15 +++++++++++++++
 3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/compat/compat-2.6.36.c b/compat/compat-2.6.36.c
index 5faefb4..aab25df 100644
--- a/compat/compat-2.6.36.c
+++ b/compat/compat-2.6.36.c
@@ -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 */
 
diff --git a/compat/main.c b/compat/main.c
index a1a48d0..f830488 100644
--- a/compat/main.c
+++ b/compat/main.c
@@ -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;
 }
diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
index f4d6f80..29ade27 100644
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
@@ -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 */
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux