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.
17 /* Module Name : zdcompat.h */
20 /* This module contains function defintion for compatibility. */
23 /* Platform dependent. */
25 /************************************************************************/
30 #ifndef KERNEL_VERSION
31 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
34 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
36 #define INIT_TQUEUE(_tq, _routine, _data) \
40 PREPARE_TQUEUE((_tq), (_routine), (_data)); \
42 #define PREPARE_TQUEUE(_tq, _routine, _data) \
44 (_tq)->routine = _routine; \
45 (_tq)->data = _data; \
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)
55 #define schedule_work(a) schedule_task(a)
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)
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)
69 #define tasklet_schedule(a) schedule_task(a)
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
;
80 typedef struct net_device netdevice_t
;
84 #if (WIRELESS_EXT < 13)
85 struct iw_request_info
87 __u16 cmd
; /* Wireless Extension command */
88 __u16 flags
; /* More to come ;-) */
95 typedef void irqreturn_t
;
102 #define in_atomic() 0
105 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) // fixme
106 #define URB_ASYNC_UNLINK USB_ASYNC_UNLINK
108 #define USB_QUEUE_BULK 0
111 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
112 #define free_netdev(x) kfree(x)