diff options
Diffstat (limited to 'drivers/net/wireless/bcmdhd/include/linuxver.h')
-rw-r--r-- | drivers/net/wireless/bcmdhd/include/linuxver.h | 593 |
1 files changed, 593 insertions, 0 deletions
diff --git a/drivers/net/wireless/bcmdhd/include/linuxver.h b/drivers/net/wireless/bcmdhd/include/linuxver.h new file mode 100644 index 00000000000..96844db2f05 --- /dev/null +++ b/drivers/net/wireless/bcmdhd/include/linuxver.h | |||
@@ -0,0 +1,593 @@ | |||
1 | /* | ||
2 | * Linux-specific abstractions to gain some independence from linux kernel versions. | ||
3 | * Pave over some 2.2 versus 2.4 versus 2.6 kernel differences. | ||
4 | * | ||
5 | * Copyright (C) 1999-2011, Broadcom Corporation | ||
6 | * | ||
7 | * Unless you and Broadcom execute a separate written software license | ||
8 | * agreement governing use of this software, this software is licensed to you | ||
9 | * under the terms of the GNU General Public License version 2 (the "GPL"), | ||
10 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the | ||
11 | * following added to such license: | ||
12 | * | ||
13 | * As a special exception, the copyright holders of this software give you | ||
14 | * permission to link this software with independent modules, and to copy and | ||
15 | * distribute the resulting executable under terms of your choice, provided that | ||
16 | * you also meet, for each linked independent module, the terms and conditions of | ||
17 | * the license of that module. An independent module is a module which is not | ||
18 | * derived from this software. The special exception does not apply to any | ||
19 | * modifications of the software. | ||
20 | * | ||
21 | * Notwithstanding the above, under no circumstances may you combine this | ||
22 | * software in any way with any other Broadcom software provided under a license | ||
23 | * other than the GPL, without Broadcom's express prior written consent. | ||
24 | * | ||
25 | * $Id: linuxver.h,v 13.53.2.2 2010-12-22 23:47:26 Exp $ | ||
26 | */ | ||
27 | |||
28 | |||
29 | #ifndef _linuxver_h_ | ||
30 | #define _linuxver_h_ | ||
31 | |||
32 | #include <linux/version.h> | ||
33 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) | ||
34 | #include <linux/config.h> | ||
35 | #else | ||
36 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) | ||
37 | #include <generated/autoconf.h> | ||
38 | #else | ||
39 | #include <linux/autoconf.h> | ||
40 | #endif | ||
41 | #endif | ||
42 | #include <linux/module.h> | ||
43 | |||
44 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)) | ||
45 | |||
46 | #ifdef __UNDEF_NO_VERSION__ | ||
47 | #undef __NO_VERSION__ | ||
48 | #else | ||
49 | #define __NO_VERSION__ | ||
50 | #endif | ||
51 | #endif | ||
52 | |||
53 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) | ||
54 | #define module_param(_name_, _type_, _perm_) MODULE_PARM(_name_, "i") | ||
55 | #define module_param_string(_name_, _string_, _size_, _perm_) \ | ||
56 | MODULE_PARM(_string_, "c" __MODULE_STRING(_size_)) | ||
57 | #endif | ||
58 | |||
59 | |||
60 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 9)) | ||
61 | #include <linux/malloc.h> | ||
62 | #else | ||
63 | #include <linux/slab.h> | ||
64 | #endif | ||
65 | |||
66 | #include <linux/types.h> | ||
67 | #include <linux/init.h> | ||
68 | #include <linux/mm.h> | ||
69 | #include <linux/string.h> | ||
70 | #include <linux/pci.h> | ||
71 | #include <linux/interrupt.h> | ||
72 | #include <linux/netdevice.h> | ||
73 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) | ||
74 | #include <linux/semaphore.h> | ||
75 | #endif | ||
76 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) | ||
77 | #undef IP_TOS | ||
78 | #endif | ||
79 | #include <asm/io.h> | ||
80 | |||
81 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 41)) | ||
82 | #include <linux/workqueue.h> | ||
83 | #else | ||
84 | #include <linux/tqueue.h> | ||
85 | #ifndef work_struct | ||
86 | #define work_struct tq_struct | ||
87 | #endif | ||
88 | #ifndef INIT_WORK | ||
89 | #define INIT_WORK(_work, _func, _data) INIT_TQUEUE((_work), (_func), (_data)) | ||
90 | #endif | ||
91 | #ifndef schedule_work | ||
92 | #define schedule_work(_work) schedule_task((_work)) | ||
93 | #endif | ||
94 | #ifndef flush_scheduled_work | ||
95 | #define flush_scheduled_work() flush_scheduled_tasks() | ||
96 | #endif | ||
97 | #endif | ||
98 | |||
99 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) | ||
100 | #define MY_INIT_WORK(_work, _func) INIT_WORK(_work, _func) | ||
101 | #else | ||
102 | #define MY_INIT_WORK(_work, _func) INIT_WORK(_work, _func, _work) | ||
103 | typedef void (*work_func_t)(void *work); | ||
104 | #endif | ||
105 | |||
106 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) | ||
107 | |||
108 | #ifndef IRQ_NONE | ||
109 | typedef void irqreturn_t; | ||
110 | #define IRQ_NONE | ||
111 | #define IRQ_HANDLED | ||
112 | #define IRQ_RETVAL(x) | ||
113 | #endif | ||
114 | #else | ||
115 | typedef irqreturn_t(*FN_ISR) (int irq, void *dev_id, struct pt_regs *ptregs); | ||
116 | #endif | ||
117 | |||
118 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) | ||
119 | #define IRQF_SHARED SA_SHIRQ | ||
120 | #endif | ||
121 | |||
122 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17) | ||
123 | #ifdef CONFIG_NET_RADIO | ||
124 | #define CONFIG_WIRELESS_EXT | ||
125 | #endif | ||
126 | #endif | ||
127 | |||
128 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 67) | ||
129 | #define MOD_INC_USE_COUNT | ||
130 | #define MOD_DEC_USE_COUNT | ||
131 | #endif | ||
132 | |||
133 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) | ||
134 | #include <linux/sched.h> | ||
135 | #endif | ||
136 | |||
137 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) | ||
138 | #include <net/lib80211.h> | ||
139 | #endif | ||
140 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) | ||
141 | #include <linux/ieee80211.h> | ||
142 | #else | ||
143 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) | ||
144 | #include <net/ieee80211.h> | ||
145 | #endif | ||
146 | #endif | ||
147 | |||
148 | |||
149 | #ifndef __exit | ||
150 | #define __exit | ||
151 | #endif | ||
152 | #ifndef __devexit | ||
153 | #define __devexit | ||
154 | #endif | ||
155 | #ifndef __devinit | ||
156 | #define __devinit __init | ||
157 | #endif | ||
158 | #ifndef __devinitdata | ||
159 | #define __devinitdata | ||
160 | #endif | ||
161 | #ifndef __devexit_p | ||
162 | #define __devexit_p(x) x | ||
163 | #endif | ||
164 | |||
165 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)) | ||
166 | |||
167 | #define pci_get_drvdata(dev) (dev)->sysdata | ||
168 | #define pci_set_drvdata(dev, value) (dev)->sysdata = (value) | ||
169 | |||
170 | |||
171 | |||
172 | struct pci_device_id { | ||
173 | unsigned int vendor, device; | ||
174 | unsigned int subvendor, subdevice; | ||
175 | unsigned int class, class_mask; | ||
176 | unsigned long driver_data; | ||
177 | }; | ||
178 | |||
179 | struct pci_driver { | ||
180 | struct list_head node; | ||
181 | char *name; | ||
182 | const struct pci_device_id *id_table; | ||
183 | int (*probe)(struct pci_dev *dev, | ||
184 | const struct pci_device_id *id); | ||
185 | void (*remove)(struct pci_dev *dev); | ||
186 | void (*suspend)(struct pci_dev *dev); | ||
187 | void (*resume)(struct pci_dev *dev); | ||
188 | }; | ||
189 | |||
190 | #define MODULE_DEVICE_TABLE(type, name) | ||
191 | #define PCI_ANY_ID (~0) | ||
192 | |||
193 | |||
194 | #define pci_module_init pci_register_driver | ||
195 | extern int pci_register_driver(struct pci_driver *drv); | ||
196 | extern void pci_unregister_driver(struct pci_driver *drv); | ||
197 | |||
198 | #endif | ||
199 | |||
200 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)) | ||
201 | #define pci_module_init pci_register_driver | ||
202 | #endif | ||
203 | |||
204 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)) | ||
205 | #ifdef MODULE | ||
206 | #define module_init(x) int init_module(void) { return x(); } | ||
207 | #define module_exit(x) void cleanup_module(void) { x(); } | ||
208 | #else | ||
209 | #define module_init(x) __initcall(x); | ||
210 | #define module_exit(x) __exitcall(x); | ||
211 | #endif | ||
212 | #endif | ||
213 | |||
214 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) | ||
215 | #define WL_USE_NETDEV_OPS | ||
216 | #else | ||
217 | #undef WL_USE_NETDEV_OPS | ||
218 | #endif | ||
219 | |||
220 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)) && defined(CONFIG_RFKILL_INPUT) | ||
221 | #define WL_CONFIG_RFKILL_INPUT | ||
222 | #else | ||
223 | #undef WL_CONFIG_RFKILL_INPUT | ||
224 | #endif | ||
225 | |||
226 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 48)) | ||
227 | #define list_for_each(pos, head) \ | ||
228 | for (pos = (head)->next; pos != (head); pos = pos->next) | ||
229 | #endif | ||
230 | |||
231 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 13)) | ||
232 | #define pci_resource_start(dev, bar) ((dev)->base_address[(bar)]) | ||
233 | #elif (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 44)) | ||
234 | #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) | ||
235 | #endif | ||
236 | |||
237 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 23)) | ||
238 | #define pci_enable_device(dev) do { } while (0) | ||
239 | #endif | ||
240 | |||
241 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 14)) | ||
242 | #define net_device device | ||
243 | #endif | ||
244 | |||
245 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 42)) | ||
246 | |||
247 | |||
248 | |||
249 | #ifndef PCI_DMA_TODEVICE | ||
250 | #define PCI_DMA_TODEVICE 1 | ||
251 | #define PCI_DMA_FROMDEVICE 2 | ||
252 | #endif | ||
253 | |||
254 | typedef u32 dma_addr_t; | ||
255 | |||
256 | |||
257 | static inline int get_order(unsigned long size) | ||
258 | { | ||
259 | int order; | ||
260 | |||
261 | size = (size-1) >> (PAGE_SHIFT-1); | ||
262 | order = -1; | ||
263 | do { | ||
264 | size >>= 1; | ||
265 | order++; | ||
266 | } while (size); | ||
267 | return order; | ||
268 | } | ||
269 | |||
270 | static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, | ||
271 | dma_addr_t *dma_handle) | ||
272 | { | ||
273 | void *ret; | ||
274 | int gfp = GFP_ATOMIC | GFP_DMA; | ||
275 | |||
276 | ret = (void *)__get_free_pages(gfp, get_order(size)); | ||
277 | |||
278 | if (ret != NULL) { | ||
279 | memset(ret, 0, size); | ||
280 | *dma_handle = virt_to_bus(ret); | ||
281 | } | ||
282 | return ret; | ||
283 | } | ||
284 | static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, | ||
285 | void *vaddr, dma_addr_t dma_handle) | ||
286 | { | ||
287 | free_pages((unsigned long)vaddr, get_order(size)); | ||
288 | } | ||
289 | #define pci_map_single(cookie, address, size, dir) virt_to_bus(address) | ||
290 | #define pci_unmap_single(cookie, address, size, dir) | ||
291 | |||
292 | #endif | ||
293 | |||
294 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 43)) | ||
295 | |||
296 | #define dev_kfree_skb_any(a) dev_kfree_skb(a) | ||
297 | #define netif_down(dev) do { (dev)->start = 0; } while (0) | ||
298 | |||
299 | |||
300 | #ifndef _COMPAT_NETDEVICE_H | ||
301 | |||
302 | |||
303 | |||
304 | #define dev_kfree_skb_irq(a) dev_kfree_skb(a) | ||
305 | #define netif_wake_queue(dev) \ | ||
306 | do { clear_bit(0, &(dev)->tbusy); mark_bh(NET_BH); } while (0) | ||
307 | #define netif_stop_queue(dev) set_bit(0, &(dev)->tbusy) | ||
308 | |||
309 | static inline void netif_start_queue(struct net_device *dev) | ||
310 | { | ||
311 | dev->tbusy = 0; | ||
312 | dev->interrupt = 0; | ||
313 | dev->start = 1; | ||
314 | } | ||
315 | |||
316 | #define netif_queue_stopped(dev) (dev)->tbusy | ||
317 | #define netif_running(dev) (dev)->start | ||
318 | |||
319 | #endif | ||
320 | |||
321 | #define netif_device_attach(dev) netif_start_queue(dev) | ||
322 | #define netif_device_detach(dev) netif_stop_queue(dev) | ||
323 | |||
324 | |||
325 | #define tasklet_struct tq_struct | ||
326 | static inline void tasklet_schedule(struct tasklet_struct *tasklet) | ||
327 | { | ||
328 | queue_task(tasklet, &tq_immediate); | ||
329 | mark_bh(IMMEDIATE_BH); | ||
330 | } | ||
331 | |||
332 | static inline void tasklet_init(struct tasklet_struct *tasklet, | ||
333 | void (*func)(unsigned long), | ||
334 | unsigned long data) | ||
335 | { | ||
336 | tasklet->next = NULL; | ||
337 | tasklet->sync = 0; | ||
338 | tasklet->routine = (void (*)(void *))func; | ||
339 | tasklet->data = (void *)data; | ||
340 | } | ||
341 | #define tasklet_kill(tasklet) { do {} while (0); } | ||
342 | |||
343 | |||
344 | #define del_timer_sync(timer) del_timer(timer) | ||
345 | |||
346 | #else | ||
347 | |||
348 | #define netif_down(dev) | ||
349 | |||
350 | #endif | ||
351 | |||
352 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3)) | ||
353 | |||
354 | |||
355 | #define PREPARE_TQUEUE(_tq, _routine, _data) \ | ||
356 | do { \ | ||
357 | (_tq)->routine = _routine; \ | ||
358 | (_tq)->data = _data; \ | ||
359 | } while (0) | ||
360 | |||
361 | |||
362 | #define INIT_TQUEUE(_tq, _routine, _data) \ | ||
363 | do { \ | ||
364 | INIT_LIST_HEAD(&(_tq)->list); \ | ||
365 | (_tq)->sync = 0; \ | ||
366 | PREPARE_TQUEUE((_tq), (_routine), (_data)); \ | ||
367 | } while (0) | ||
368 | |||
369 | #endif | ||
370 | |||
371 | |||
372 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 9) | ||
373 | #define PCI_SAVE_STATE(a, b) pci_save_state(a) | ||
374 | #define PCI_RESTORE_STATE(a, b) pci_restore_state(a) | ||
375 | #else | ||
376 | #define PCI_SAVE_STATE(a, b) pci_save_state(a, b) | ||
377 | #define PCI_RESTORE_STATE(a, b) pci_restore_state(a, b) | ||
378 | #endif | ||
379 | |||
380 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 6)) | ||
381 | static inline int | ||
382 | pci_save_state(struct pci_dev *dev, u32 *buffer) | ||
383 | { | ||
384 | int i; | ||
385 | if (buffer) { | ||
386 | for (i = 0; i < 16; i++) | ||
387 | pci_read_config_dword(dev, i * 4, &buffer[i]); | ||
388 | } | ||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static inline int | ||
393 | pci_restore_state(struct pci_dev *dev, u32 *buffer) | ||
394 | { | ||
395 | int i; | ||
396 | |||
397 | if (buffer) { | ||
398 | for (i = 0; i < 16; i++) | ||
399 | pci_write_config_dword(dev, i * 4, buffer[i]); | ||
400 | } | ||
401 | |||
402 | else { | ||
403 | for (i = 0; i < 6; i ++) | ||
404 | pci_write_config_dword(dev, | ||
405 | PCI_BASE_ADDRESS_0 + (i * 4), | ||
406 | pci_resource_start(dev, i)); | ||
407 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); | ||
408 | } | ||
409 | return 0; | ||
410 | } | ||
411 | #endif | ||
412 | |||
413 | |||
414 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 19)) | ||
415 | #define read_c0_count() read_32bit_cp0_register(CP0_COUNT) | ||
416 | #endif | ||
417 | |||
418 | |||
419 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) | ||
420 | #ifndef SET_MODULE_OWNER | ||
421 | #define SET_MODULE_OWNER(dev) do {} while (0) | ||
422 | #define OLD_MOD_INC_USE_COUNT MOD_INC_USE_COUNT | ||
423 | #define OLD_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT | ||
424 | #else | ||
425 | #define OLD_MOD_INC_USE_COUNT do {} while (0) | ||
426 | #define OLD_MOD_DEC_USE_COUNT do {} while (0) | ||
427 | #endif | ||
428 | #else | ||
429 | #ifndef SET_MODULE_OWNER | ||
430 | #define SET_MODULE_OWNER(dev) do {} while (0) | ||
431 | #endif | ||
432 | #ifndef MOD_INC_USE_COUNT | ||
433 | #define MOD_INC_USE_COUNT do {} while (0) | ||
434 | #endif | ||
435 | #ifndef MOD_DEC_USE_COUNT | ||
436 | #define MOD_DEC_USE_COUNT do {} while (0) | ||
437 | #endif | ||
438 | #define OLD_MOD_INC_USE_COUNT MOD_INC_USE_COUNT | ||
439 | #define OLD_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT | ||
440 | #endif | ||
441 | |||
442 | #ifndef SET_NETDEV_DEV | ||
443 | #define SET_NETDEV_DEV(net, pdev) do {} while (0) | ||
444 | #endif | ||
445 | |||
446 | #ifndef HAVE_FREE_NETDEV | ||
447 | #define free_netdev(dev) kfree(dev) | ||
448 | #endif | ||
449 | |||
450 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) | ||
451 | |||
452 | #define af_packet_priv data | ||
453 | #endif | ||
454 | |||
455 | |||
456 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) | ||
457 | #define DRV_SUSPEND_STATE_TYPE pm_message_t | ||
458 | #else | ||
459 | #define DRV_SUSPEND_STATE_TYPE uint32 | ||
460 | #endif | ||
461 | |||
462 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) | ||
463 | #define CHECKSUM_HW CHECKSUM_PARTIAL | ||
464 | #endif | ||
465 | |||
466 | typedef struct { | ||
467 | void *parent; | ||
468 | struct task_struct *p_task; | ||
469 | long thr_pid; | ||
470 | int prio; | ||
471 | struct semaphore sema; | ||
472 | bool terminated; | ||
473 | struct completion completed; | ||
474 | } tsk_ctl_t; | ||
475 | |||
476 | |||
477 | |||
478 | |||
479 | #ifdef DHD_DEBUG | ||
480 | #define DBG_THR(x) printk x | ||
481 | #else | ||
482 | #define DBG_THR(x) | ||
483 | #endif | ||
484 | |||
485 | #define SMP_RD_BARRIER_DEPENDS(x) smp_rmb(x) | ||
486 | |||
487 | |||
488 | #define PROC_START(thread_func, owner, tsk_ctl, flags) \ | ||
489 | { \ | ||
490 | sema_init(&((tsk_ctl)->sema), 0); \ | ||
491 | init_completion(&((tsk_ctl)->completed)); \ | ||
492 | (tsk_ctl)->parent = owner; \ | ||
493 | (tsk_ctl)->terminated = FALSE; \ | ||
494 | (tsk_ctl)->thr_pid = kernel_thread(thread_func, tsk_ctl, flags); \ | ||
495 | if ((tsk_ctl)->thr_pid > 0) \ | ||
496 | wait_for_completion(&((tsk_ctl)->completed)); \ | ||
497 | DBG_THR(("%s thr:%lx started\n", __FUNCTION__, (tsk_ctl)->thr_pid)); \ | ||
498 | } | ||
499 | |||
500 | #define PROC_STOP(tsk_ctl) \ | ||
501 | { \ | ||
502 | (tsk_ctl)->terminated = TRUE; \ | ||
503 | smp_wmb(); \ | ||
504 | up(&((tsk_ctl)->sema)); \ | ||
505 | wait_for_completion(&((tsk_ctl)->completed)); \ | ||
506 | DBG_THR(("%s thr:%lx terminated OK\n", __FUNCTION__, (tsk_ctl)->thr_pid)); \ | ||
507 | (tsk_ctl)->thr_pid = -1; \ | ||
508 | } | ||
509 | |||
510 | |||
511 | |||
512 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) | ||
513 | #define KILL_PROC(nr, sig) \ | ||
514 | { \ | ||
515 | struct task_struct *tsk; \ | ||
516 | struct pid *pid; \ | ||
517 | pid = find_get_pid((pid_t)nr); \ | ||
518 | tsk = pid_task(pid, PIDTYPE_PID); \ | ||
519 | if (tsk) send_sig(sig, tsk, 1); \ | ||
520 | } | ||
521 | #else | ||
522 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && (LINUX_VERSION_CODE <= \ | ||
523 | KERNEL_VERSION(2, 6, 30)) | ||
524 | #define KILL_PROC(pid, sig) \ | ||
525 | { \ | ||
526 | struct task_struct *tsk; \ | ||
527 | tsk = find_task_by_vpid(pid); \ | ||
528 | if (tsk) send_sig(sig, tsk, 1); \ | ||
529 | } | ||
530 | #else | ||
531 | #define KILL_PROC(pid, sig) \ | ||
532 | { \ | ||
533 | kill_proc(pid, sig, 1); \ | ||
534 | } | ||
535 | #endif | ||
536 | #endif | ||
537 | |||
538 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) | ||
539 | #include <linux/time.h> | ||
540 | #include <linux/wait.h> | ||
541 | #else | ||
542 | #include <linux/sched.h> | ||
543 | |||
544 | #define __wait_event_interruptible_timeout(wq, condition, ret) \ | ||
545 | do { \ | ||
546 | wait_queue_t __wait; \ | ||
547 | init_waitqueue_entry(&__wait, current); \ | ||
548 | \ | ||
549 | add_wait_queue(&wq, &__wait); \ | ||
550 | for (;;) { \ | ||
551 | set_current_state(TASK_INTERRUPTIBLE); \ | ||
552 | if (condition) \ | ||
553 | break; \ | ||
554 | if (!signal_pending(current)) { \ | ||
555 | ret = schedule_timeout(ret); \ | ||
556 | if (!ret) \ | ||
557 | break; \ | ||
558 | continue; \ | ||
559 | } \ | ||
560 | ret = -ERESTARTSYS; \ | ||
561 | break; \ | ||
562 | } \ | ||
563 | current->state = TASK_RUNNING; \ | ||
564 | remove_wait_queue(&wq, &__wait); \ | ||
565 | } while (0) | ||
566 | |||
567 | #define wait_event_interruptible_timeout(wq, condition, timeout) \ | ||
568 | ({ \ | ||
569 | long __ret = timeout; \ | ||
570 | if (!(condition)) \ | ||
571 | __wait_event_interruptible_timeout(wq, condition, __ret); \ | ||
572 | __ret; \ | ||
573 | }) | ||
574 | |||
575 | #endif | ||
576 | |||
577 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) | ||
578 | #define WL_DEV_IF(dev) ((wl_if_t*)netdev_priv(dev)) | ||
579 | #else | ||
580 | #define WL_DEV_IF(dev) ((wl_if_t*)(dev)->priv) | ||
581 | #endif | ||
582 | |||
583 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) | ||
584 | #define WL_ISR(i, d, p) wl_isr((i), (d)) | ||
585 | #else | ||
586 | #define WL_ISR(i, d, p) wl_isr((i), (d), (p)) | ||
587 | #endif | ||
588 | |||
589 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) | ||
590 | #define netdev_priv(dev) dev->priv | ||
591 | #endif | ||
592 | |||
593 | #endif | ||