compat-wireless-2010-03-10
[pandora-wifi.git] / include / linux / compat-2.6.29.h
1 #ifndef LINUX_26_29_COMPAT_H
2 #define LINUX_26_29_COMPAT_H
3
4 #include <linux/version.h>
5
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
7
8 #include <linux/netdevice.h>
9 #include <linux/skbuff.h>
10 #include <linux/usb.h>
11
12 /**
13  *      skb_queue_is_first - check if skb is the first entry in the queue
14  *      @list: queue head
15  *      @skb: buffer
16  *
17  *      Returns true if @skb is the first buffer on the list.
18  */
19 static inline bool skb_queue_is_first(const struct sk_buff_head *list,
20                                       const struct sk_buff *skb)
21 {
22         return (skb->prev == (struct sk_buff *) list);
23 }
24
25 /**
26  *      skb_queue_prev - return the prev packet in the queue
27  *      @list: queue head
28  *      @skb: current buffer
29  *
30  *      Return the prev packet in @list before @skb.  It is only valid to
31  *      call this if skb_queue_is_first() evaluates to false.
32  */
33 static inline struct sk_buff *skb_queue_prev(const struct sk_buff_head *list,
34                                              const struct sk_buff *skb)
35 {
36         /* This BUG_ON may seem severe, but if we just return then we
37          * are going to dereference garbage.
38          */
39         BUG_ON(skb_queue_is_first(list, skb));
40         return skb->prev;
41 }
42
43
44 static inline struct net_device_stats *dev_get_stats(struct net_device *dev)
45 {
46         return dev->get_stats(dev);
47 }
48
49 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
50 #if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
51 extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
52 #endif /* CONFIG_USB */
53 #endif
54
55 #define DIV_ROUND_CLOSEST(x, divisor)(                  \
56 {                                                       \
57         typeof(divisor) __divisor = divisor;            \
58         (((x) + ((__divisor) / 2)) / (__divisor));      \
59 }                                                       \
60 )
61
62 extern int eth_mac_addr(struct net_device *dev, void *p);
63
64 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */
65
66 #endif /*  LINUX_26_29_COMPAT_H */