Fix compilation warning on iface.c
[~emulex/for-vlad/old/compat.git] / include / linux / compat-2.6.28.h
1 #ifndef LINUX_26_28_COMPAT_H
2 #define LINUX_26_28_COMPAT_H
3
4 #include <linux/autoconf.h>
5 #include <linux/version.h>
6
7 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
8
9 #include <linux/skbuff.h>
10 #include <linux/if_ether.h>
11 #include <linux/usb.h>
12
13 #ifndef ETH_P_PAE
14 #define ETH_P_PAE 0x888E      /* Port Access Entity (IEEE 802.1X) */
15 #endif
16
17 #include <linux/pci.h>
18
19 #ifndef WARN_ONCE
20 #define WARN_ONCE(condition, format...) ({                      \
21         static int __warned;                                    \
22         int __ret_warn_once = !!(condition);                    \
23                                                                 \
24         if (unlikely(__ret_warn_once))                          \
25                 if (WARN(!__warned, format))                    \
26                         __warned = 1;                           \
27         unlikely(__ret_warn_once);                              \
28 })
29 #endif /* From include/asm-generic/bug.h */
30
31 #include <pcmcia/cs_types.h>
32 #include <pcmcia/cs.h>
33 #include <pcmcia/cistpl.h>
34 #ifdef pcmcia_parse_tuple
35 #undef pcmcia_parse_tuple
36 #define pcmcia_parse_tuple(tuple, parse) pccard_parse_tuple(tuple, parse)
37 #endif
38
39 /* From : include/pcmcia/ds.h */
40 /* loop CIS entries for valid configuration */
41 int pcmcia_loop_config(struct pcmcia_device *p_dev,
42                        int      (*conf_check)   (struct pcmcia_device *p_dev,
43                                                  cistpl_cftable_entry_t *cfg,
44                                                  cistpl_cftable_entry_t *dflt,
45                                                  unsigned int vcc,
46                                                  void *priv_data),
47                        void *priv_data);
48
49 #if 0
50 extern void usb_poison_urb(struct urb *urb);
51 #endif
52 extern void usb_unpoison_urb(struct urb *urb);
53
54 #if 0
55 extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
56 #endif
57
58 extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
59 extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
60 extern int usb_anchor_empty(struct usb_anchor *anchor);
61
62
63 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
64
65 /**
66  *      skb_queue_is_last - check if skb is the last entry in the queue
67  *      @list: queue head
68  *      @skb: buffer
69  *
70  *      Returns true if @skb is the last buffer on the list.
71  */
72 static inline bool skb_queue_is_last(const struct sk_buff_head *list,
73                                      const struct sk_buff *skb)
74 {
75         return (skb->next == (struct sk_buff *) list);
76 }
77
78 /**
79  *      skb_queue_next - return the next packet in the queue
80  *      @list: queue head
81  *      @skb: current buffer
82  *
83  *      Return the next packet in @list after @skb.  It is only valid to
84  *      call this if skb_queue_is_last() evaluates to false.
85  */
86 static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
87                                              const struct sk_buff *skb)
88 {
89         /* This BUG_ON may seem severe, but if we just return then we
90          * are going to dereference garbage.
91          */
92         BUG_ON(skb_queue_is_last(list, skb));
93         return skb->next;
94 }
95
96 /**
97  *      __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head
98  *      @list: queue to initialize
99  *
100  *      This initializes only the list and queue length aspects of
101  *      an sk_buff_head object.  This allows to initialize the list
102  *      aspects of an sk_buff_head without reinitializing things like
103  *      the spinlock.  It can also be used for on-stack sk_buff_head
104  *      objects where the spinlock is known to not be used.
105  */
106 static inline void __skb_queue_head_init(struct sk_buff_head *list)
107 {
108         list->prev = list->next = (struct sk_buff *)list;
109         list->qlen = 0;
110 }
111
112 static inline void __skb_queue_splice(const struct sk_buff_head *list,
113                                       struct sk_buff *prev,
114                                       struct sk_buff *next)
115 {
116         struct sk_buff *first = list->next;
117         struct sk_buff *last = list->prev;
118
119         first->prev = prev;
120         prev->next = first;
121
122         last->next = next;
123         next->prev = last;
124 }
125
126 /**
127  *      skb_queue_splice - join two skb lists, this is designed for stacks
128  *      @list: the new list to add
129  *      @head: the place to add it in the first list
130  */
131 static inline void skb_queue_splice(const struct sk_buff_head *list,
132                                     struct sk_buff_head *head)
133 {
134         if (!skb_queue_empty(list)) {
135                 __skb_queue_splice(list, (struct sk_buff *) head, head->next);
136                 head->qlen += list->qlen;
137         }
138 }
139
140 /**
141  *      skb_queue_splice_tail - join two skb lists and reinitialise the emptied list
142  *      @list: the new list to add
143  *      @head: the place to add it in the first list
144  *
145  *      Each of the lists is a queue.
146  *      The list at @list is reinitialised
147  */
148 static inline void skb_queue_splice_tail_init(struct sk_buff_head *list,
149                                               struct sk_buff_head *head)
150 {
151         if (!skb_queue_empty(list)) {
152                 __skb_queue_splice(list, head->prev, (struct sk_buff *) head);
153                 head->qlen += list->qlen;
154                 __skb_queue_head_init(list);
155         }
156 } /* From include/linux/skbuff.h */
157
158 /**
159  *      skb_queue_splice_tail - join two skb lists, each list being a queue
160  *      @list: the new list to add
161  *      @head: the place to add it in the first list
162  */
163 static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
164                                          struct sk_buff_head *head)
165 {
166         if (!skb_queue_empty(list)) {
167                 __skb_queue_splice(list, head->prev, (struct sk_buff *) head);
168                 head->qlen += list->qlen;
169         }
170 }
171
172 #ifndef DECLARE_TRACE
173
174 #define TP_PROTO(args...)       args
175 #define TP_ARGS(args...)                args
176
177 #define DECLARE_TRACE(name, proto, args)                                \
178         static inline void _do_trace_##name(struct tracepoint *tp, proto) \
179         { }                                                             \
180         static inline void trace_##name(proto)                          \
181         { }                                                             \
182         static inline int register_trace_##name(void (*probe)(proto))   \
183         {                                                               \
184                 return -ENOSYS;                                         \
185         }                                                               \
186         static inline int unregister_trace_##name(void (*probe)(proto)) \
187         {                                                               \
188                 return -ENOSYS;                                         \
189         }
190
191 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
192 #define EXPORT_TRACEPOINT_SYMBOL(name)
193
194
195 #endif
196
197 /* openSuse includes round_jiffies_up in it's kernel 2.6.27.
198  * This is needed to prevent conflicts with the openSuse definition.
199  */
200 #define round_jiffies_up backport_round_jiffies_up
201
202 unsigned long round_jiffies_up(unsigned long j);
203
204 extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
205                             int off, int size);
206
207 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
208
209 #endif /* LINUX_26_28_COMPAT_H */