From: Hauke Mehrtens Date: Sun, 6 Nov 2011 21:25:03 +0000 (+0100) Subject: compat: backport system_nrt_wq X-Git-Tag: compat-2011-11-08~1 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=de70e06e7c84debcfde536601004bfb1032b432a;p=~tnikolova%2Fcompat%2F.git compat: backport system_nrt_wq 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 --- 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 */