wl1251: fix a memory leak in probe
[pandora-wifi.git] / include / linux / compat-2.6.22.h
1 #ifndef LINUX_26_22_COMPAT_H
2 #define LINUX_26_22_COMPAT_H
3
4 #include <linux/version.h>
5
6 /* Compat work for 2.6.21 */
7 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
8
9 #include <linux/pci.h>
10 #include <linux/skbuff.h>
11
12 /* reuse ax25_ptr */
13 #define ieee80211_ptr ax25_ptr
14
15 #ifdef CONFIG_AX25
16 #error Compat reuses the AX.25 pointer so that may not be enabled!
17 #endif
18
19 static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
20 {
21         return skb->mac.raw;
22 }
23
24 static inline void skb_set_mac_header(struct sk_buff *skb, int offset)
25 {
26         skb->mac.raw = skb->data + offset;
27 }
28
29 static inline void skb_reset_mac_header(struct sk_buff *skb)
30 {
31         skb->mac.raw = skb->data;
32 }
33
34 static inline void skb_reset_network_header(struct sk_buff *skb)
35 {
36         skb->nh.raw = skb->data;
37 }
38
39 static inline void skb_set_network_header(struct sk_buff *skb, int offset)
40 {
41         skb->nh.raw = skb->data + offset;
42 }
43
44 static inline void skb_set_transport_header(struct sk_buff *skb, int offset)
45 {
46         skb->h.raw = skb->data + offset;
47 }
48
49 static inline unsigned char *skb_transport_header(struct sk_buff *skb)
50 {
51         return skb->h.raw;
52 }
53
54 static inline unsigned char *skb_network_header(const struct sk_buff *skb)
55 {
56         return skb->nh.raw;
57 }
58
59 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
60 {
61         return skb->tail;
62 }
63
64 static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
65 {
66         return (struct iphdr *)skb_network_header(skb);
67 }
68
69 static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
70                                              void *to,
71                                              const unsigned int len)
72 {
73         memcpy(to, skb->data, len);
74 }
75
76 static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
77                                                     const int offset, void *to,
78                                                     const unsigned int len)
79 {
80         memcpy(to, skb->data + offset, len);
81 }
82
83 #define __maybe_unused  __attribute__((unused))
84
85 #define uninitialized_var(x) x = x
86
87 /* This will lead to very weird behaviour... */
88 #define NLA_BINARY NLA_STRING
89
90 static inline int pci_set_mwi(struct pci_dev *dev)
91 {
92         return -ENOSYS;
93 }
94
95 static inline void pci_clear_mwi(struct pci_dev *dev)
96 {
97 }
98
99 #define list_first_entry(ptr, type, member) \
100         list_entry((ptr)->next, type, member)
101
102 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) */
103
104 #endif /* LINUX_26_22_COMPAT_H */