MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / usb / net / Zydas / zdcompat.h
blob5cadecde2ce5d29e06cf3624588ad9efe49bd462
1 #ifndef _ZDCOMPAT_H_
2 #define _ZDCOMPAT_H_
4 #ifndef KERNEL_VERSION
5 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
6 #endif
8 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
9 #ifndef INIT_TQUEUE
10 #define INIT_TQUEUE(_tq, _routine, _data) \
11 do { \
12 (_tq)->next = NULL; \
13 (_tq)->sync = 0; \
14 PREPARE_TQUEUE((_tq), (_routine), (_data)); \
15 } while (0)
16 #define PREPARE_TQUEUE(_tq, _routine, _data) \
17 do { \
18 (_tq)->routine = _routine; \
19 (_tq)->data = _data; \
20 } while (0)
21 #endif
23 #ifndef INIT_WORK
24 #define work_struct tq_struct
26 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
27 #define schedule_work(a) queue_task(a, &tq_scheduler)
28 #else
29 #define schedule_work(a) schedule_task(a)
30 #endif
32 #define flush_scheduled_work flush_scheduled_tasks
33 #define INIT_WORK(_wq, _routine, _data) INIT_TQUEUE(_wq, _routine, _data)
34 #define PREPARE_WORK(_wq, _routine, _data) PREPARE_TQUEUE(_wq, _routine, _data)
35 #endif
36 #endif // < 2.5 kernel
39 #ifndef DECLARE_TASKLET
40 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
41 #define tasklet_schedule(a) queue_task(a, &tq_scheduler)
42 #else
43 #define tasklet_schedule(a) schedule_task(a)
44 #endif
45 #endif
48 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38))
49 typedef struct device netdevice_t;
50 #elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4))
51 typedef struct net_device netdevice_t;
52 #else
53 #undef netdevice_t
54 typedef struct net_device netdevice_t;
55 #endif
57 #ifdef WIRELESS_EXT
58 #if (WIRELESS_EXT < 13)
59 struct iw_request_info
61 __u16 cmd; /* Wireless Extension command */
62 __u16 flags; /* More to come ;-) */
64 #endif
65 #endif
67 /* linux < 2.5.69 */
68 #ifndef IRQ_NONE
69 typedef void irqreturn_t;
70 #define IRQ_NONE
71 #define IRQ_HANDLED
72 #define IRQ_RETVAL(x)
73 #endif
75 #ifndef in_atomic
76 #define in_atomic() 0
77 #endif
79 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) // fixme
80 #define URB_ASYNC_UNLINK USB_ASYNC_UNLINK
81 #else
82 #define USB_QUEUE_BULK 0
83 #endif
85 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
86 #define free_netdev(x) kfree(x)
87 #endif
90 #endif