1 #ifndef LINUX_26_28_COMPAT_H
2 #define LINUX_26_28_COMPAT_H
4 #include <linux/autoconf.h>
5 #include <linux/version.h>
7 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
9 #include <linux/skbuff.h>
10 #include <linux/if_ether.h>
11 #include <linux/usb.h>
14 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
17 #include <linux/pci.h>
20 #define WARN_ONCE(condition, format...) ({ \
21 static int __warned; \
22 int __ret_warn_once = !!(condition); \
24 if (unlikely(__ret_warn_once)) \
25 if (WARN(!__warned, format)) \
27 unlikely(__ret_warn_once); \
29 #endif /* From include/asm-generic/bug.h */
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)
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,
50 extern void usb_poison_urb(struct urb *urb);
52 extern void usb_unpoison_urb(struct urb *urb);
55 extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
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);
63 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
66 * skb_queue_is_last - check if skb is the last entry in the queue
70 * Returns true if @skb is the last buffer on the list.
72 static inline bool skb_queue_is_last(const struct sk_buff_head *list,
73 const struct sk_buff *skb)
75 return (skb->next == (struct sk_buff *) list);
79 * skb_queue_next - return the next packet in the queue
81 * @skb: current buffer
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.
86 static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
87 const struct sk_buff *skb)
89 /* This BUG_ON may seem severe, but if we just return then we
90 * are going to dereference garbage.
92 BUG_ON(skb_queue_is_last(list, skb));
97 * __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head
98 * @list: queue to initialize
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.
106 static inline void __skb_queue_head_init(struct sk_buff_head *list)
108 list->prev = list->next = (struct sk_buff *)list;
112 static inline void __skb_queue_splice(const struct sk_buff_head *list,
113 struct sk_buff *prev,
114 struct sk_buff *next)
116 struct sk_buff *first = list->next;
117 struct sk_buff *last = list->prev;
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
131 static inline void skb_queue_splice(const struct sk_buff_head *list,
132 struct sk_buff_head *head)
134 if (!skb_queue_empty(list)) {
135 __skb_queue_splice(list, (struct sk_buff *) head, head->next);
136 head->qlen += list->qlen;
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
145 * Each of the lists is a queue.
146 * The list at @list is reinitialised
148 static inline void skb_queue_splice_tail_init(struct sk_buff_head *list,
149 struct sk_buff_head *head)
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);
156 } /* From include/linux/skbuff.h */
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
163 static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
164 struct sk_buff_head *head)
166 if (!skb_queue_empty(list)) {
167 __skb_queue_splice(list, head->prev, (struct sk_buff *) head);
168 head->qlen += list->qlen;
172 #ifndef DECLARE_TRACE
174 #define TP_PROTO(args...) args
175 #define TP_ARGS(args...) args
177 #define DECLARE_TRACE(name, proto, args) \
178 static inline void _do_trace_##name(struct tracepoint *tp, proto) \
180 static inline void trace_##name(proto) \
182 static inline int register_trace_##name(void (*probe)(proto)) \
186 static inline int unregister_trace_##name(void (*probe)(proto)) \
191 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
192 #define EXPORT_TRACEPOINT_SYMBOL(name)
197 /* openSuse includes round_jiffies_up in it's kernel 2.6.27.
198 * This is needed to prevent conflicts with the openSuse definition.
200 #define round_jiffies_up backport_round_jiffies_up
202 unsigned long round_jiffies_up(unsigned long j);
204 extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
207 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
209 #endif /* LINUX_26_28_COMPAT_H */