Staging: add otus Atheros wireless network driver
[wandboard.git] / drivers / staging / otus / zdcompat.h
blob27c807b3a7d0a6d59b746d5b1b31a6807182b84e
1 /*
2 * Copyright (c) 2007-2008 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 /* */
17 /* Module Name : zdcompat.h */
18 /* */
19 /* Abstract */
20 /* This module contains function defintion for compatibility. */
21 /* */
22 /* NOTES */
23 /* Platform dependent. */
24 /* */
25 /************************************************************************/
27 #ifndef _ZDCOMPAT_H
28 #define _ZDCOMPAT_H
30 #ifndef KERNEL_VERSION
31 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
32 #endif
34 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
35 #ifndef INIT_TQUEUE
36 #define INIT_TQUEUE(_tq, _routine, _data) \
37 do { \
38 (_tq)->next = NULL; \
39 (_tq)->sync = 0; \
40 PREPARE_TQUEUE((_tq), (_routine), (_data)); \
41 } while (0)
42 #define PREPARE_TQUEUE(_tq, _routine, _data) \
43 do { \
44 (_tq)->routine = _routine; \
45 (_tq)->data = _data; \
46 } while (0)
47 #endif
49 #ifndef INIT_WORK
50 #define work_struct tq_struct
52 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
53 #define schedule_work(a) queue_task(a, &tq_scheduler)
54 #else
55 #define schedule_work(a) schedule_task(a)
56 #endif
58 #define flush_scheduled_work flush_scheduled_tasks
59 #define INIT_WORK(_wq, _routine, _data) INIT_TQUEUE(_wq, _routine, _data)
60 #define PREPARE_WORK(_wq, _routine, _data) PREPARE_TQUEUE(_wq, _routine, _data)
61 #endif
62 #endif // < 2.5 kernel
65 #ifndef DECLARE_TASKLET
66 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
67 #define tasklet_schedule(a) queue_task(a, &tq_scheduler)
68 #else
69 #define tasklet_schedule(a) schedule_task(a)
70 #endif
71 #endif
74 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38))
75 typedef struct device netdevice_t;
76 #elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4))
77 typedef struct net_device netdevice_t;
78 #else
79 #undef netdevice_t
80 typedef struct net_device netdevice_t;
81 #endif
83 #ifdef WIRELESS_EXT
84 #if (WIRELESS_EXT < 13)
85 struct iw_request_info
87 __u16 cmd; /* Wireless Extension command */
88 __u16 flags; /* More to come ;-) */
90 #endif
91 #endif
93 /* linux < 2.5.69 */
94 #ifndef IRQ_NONE
95 typedef void irqreturn_t;
96 #define IRQ_NONE
97 #define IRQ_HANDLED
98 #define IRQ_RETVAL(x)
99 #endif
101 #ifndef in_atomic
102 #define in_atomic() 0
103 #endif
105 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) // fixme
106 #define URB_ASYNC_UNLINK USB_ASYNC_UNLINK
107 #else
108 #define USB_QUEUE_BULK 0
109 #endif
111 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
112 #define free_netdev(x) kfree(x)
113 #endif
116 #endif