diff options
author | Hauke Mehrtens | 2011-11-06 15:25:03 -0600 |
---|---|---|
committer | Luis R. Rodriguez | 2011-11-08 13:21:01 -0600 |
commit | de70e06e7c84debcfde536601004bfb1032b432a (patch) | |
tree | 5da0057f9a1c352ef9bdc1e8e02bfd4404c26c91 | |
parent | b5edac3c763cc8562b77c1599153ab778cac4649 (diff) | |
download | compat-de70e06e7c84debcfde536601004bfb1032b432a.tar.gz compat-de70e06e7c84debcfde536601004bfb1032b432a.tar.xz compat-de70e06e7c84debcfde536601004bfb1032b432a.zip |
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 <hauke@hauke-m.de>
-rw-r--r-- | compat/compat-2.6.36.c | 15 | ||||
-rw-r--r-- | compat/main.c | 2 | ||||
-rw-r--r-- | 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) | |||
92 | spin_unlock_irqrestore(&anchor->lock, flags); | 92 | spin_unlock_irqrestore(&anchor->lock, flags); |
93 | } | 93 | } |
94 | EXPORT_SYMBOL_GPL(compat_usb_scuttle_anchored_urbs); | 94 | EXPORT_SYMBOL_GPL(compat_usb_scuttle_anchored_urbs); |
95 | |||
96 | struct workqueue_struct *system_nrt_wq __read_mostly; | ||
97 | EXPORT_SYMBOL_GPL(system_nrt_wq); | ||
98 | |||
99 | void compat_system_workqueue_create() | ||
100 | { | ||
101 | system_nrt_wq = create_singlethread_workqueue("events_nrt"); | ||
102 | WARN_ON(system_nrt_wq); | ||
103 | } | ||
104 | |||
105 | void compat_system_workqueue_destroy() | ||
106 | { | ||
107 | destroy_workqueue(system_nrt_wq); | ||
108 | } | ||
109 | |||
95 | #endif /* CONFIG_COMPAT_USB_URB_THREAD_FIX */ | 110 | #endif /* CONFIG_COMPAT_USB_URB_THREAD_FIX */ |
96 | 111 | ||
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) | |||
36 | { | 36 | { |
37 | /* pm-qos for kernels <= 2.6.24, this is a no-op on newer kernels */ | 37 | /* pm-qos for kernels <= 2.6.24, this is a no-op on newer kernels */ |
38 | compat_pm_qos_power_init(); | 38 | compat_pm_qos_power_init(); |
39 | compat_system_workqueue_create(); | ||
39 | 40 | ||
40 | printk(KERN_INFO | 41 | printk(KERN_INFO |
41 | COMPAT_PROJECT " backport release: " | 42 | COMPAT_PROJECT " backport release: " |
@@ -52,6 +53,7 @@ module_init(compat_init); | |||
52 | static void __exit compat_exit(void) | 53 | static void __exit compat_exit(void) |
53 | { | 54 | { |
54 | compat_pm_qos_power_deinit(); | 55 | compat_pm_qos_power_deinit(); |
56 | compat_system_workqueue_destroy(); | ||
55 | 57 | ||
56 | return; | 58 | return; |
57 | } | 59 | } |
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) | |||
134 | { | 134 | { |
135 | } | 135 | } |
136 | 136 | ||
137 | extern struct workqueue_struct *system_nrt_wq; | ||
138 | |||
139 | void compat_system_workqueue_create(void); | ||
140 | void compat_system_workqueue_destroy(void); | ||
141 | |||
142 | #else | ||
143 | |||
144 | static inline void compat_system_workqueue_create(void) | ||
145 | { | ||
146 | } | ||
147 | |||
148 | static inline void compat_system_workqueue_destroy(void) | ||
149 | { | ||
150 | } | ||
151 | |||
137 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */ | 152 | #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */ |
138 | 153 | ||
139 | #endif /* LINUX_26_36_COMPAT_H */ | 154 | #endif /* LINUX_26_36_COMPAT_H */ |