wl1251: reduce eeprom read wait time
[pandora-wifi.git] / include / linux / compat-2.6.23.h
1 #ifndef LINUX_26_23_COMPAT_H
2 #define LINUX_26_23_COMPAT_H
3
4 #include <linux/version.h>
5
6 /* Compat work for < 2.6.23 */
7 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
8
9 #include <linux/netdevice.h>
10 #include <linux/sched.h>
11 #include <linux/workqueue.h>
12 #include <linux/genetlink.h>
13 #include <net/sch_generic.h>
14
15 /*
16  * Tell gcc if a function is cold. The compiler will assume any path
17  * directly leading to the call is unlikely.
18  */
19
20 #if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3)
21 /* Mark functions as cold. gcc will assume any path leading to a call
22  * to them will be unlikely.  This means a lot of manual unlikely()s
23  * are unnecessary now for any paths leading to the usual suspects
24  * like BUG(), printk(), panic() etc. [but let's keep them for now for
25  * older compilers]
26  *
27  * Early snapshots of gcc 4.3 don't support this and we can't detect this
28  * in the preprocessor, but we can live with this because they're unreleased.
29  * Maketime probing would be overkill here.
30  *
31  * gcc also has a __attribute__((__hot__)) to move hot functions into
32  * a special section, but I don't see any sense in this right now in
33  * the kernel context */
34 #define __cold                  __attribute__((__cold__))
35 #endif /* gcc 4.3 check */
36
37 #ifndef __cold
38 #define __cold
39 #endif
40
41 /* Added as of 2.6.23 in include/linux/netdevice.h */
42 #define alloc_netdev_mq(sizeof_priv, name, setup, queue) \
43         alloc_netdev(sizeof_priv, name, setup)
44 #define NETIF_F_MULTI_QUEUE 16384
45
46 /* Added as of 2.6.23 on include/linux/netdevice.h */
47 static inline int netif_is_multiqueue(const struct net_device *dev)
48 {
49         return (!!(NETIF_F_MULTI_QUEUE & dev->features));
50 }
51
52 /* 2.6.23 fixed a bug in tcf_destroy_chain and the parameter changed */
53 static inline void tcf_destroy_chain_compat(struct tcf_proto **fl)
54 {
55         struct tcf_proto *tp;
56
57         while ((tp = *fl) != NULL) {
58                 *fl = tp->next;
59                 tp->ops->destroy(tp);
60                 module_put(tp->ops->owner);
61                 kfree(tp);
62         }
63 }
64
65 /* dev_mc_list was replaced with dev_addr_list as of 2.6.23,
66  * only new member added is da_synced. */
67 #define dev_addr_list   dev_mc_list
68 #define da_addr         dmi_addr
69 #define da_addrlen      dmi_addrlen
70 #define da_users        dmi_users
71 #define da_gusers       dmi_gusers
72
73 /* dev_set_promiscuity() was moved to __dev_set_promiscuity() on 2.6.23 and
74  * dev_set_promiscuity() became a wrapper. */
75 #define __dev_set_promiscuity dev_set_promiscuity
76
77 /* Our own 2.6.22 port on compat.c */
78 extern void     dev_mc_unsync(struct net_device *to, struct net_device *from);
79 extern int      dev_mc_sync(struct net_device *to, struct net_device *from);
80
81 /* Our own 2.6.22 port on compat.c */
82 extern void     __dev_set_rx_mode(struct net_device *dev);
83
84 /* Simple to add this */
85 extern int cancel_delayed_work_sync(struct delayed_work *work);
86
87 #define cancel_delayed_work_sync cancel_rearming_delayed_work
88
89 #define debugfs_rename(a, b, c, d) 1
90
91 /* nl80211 requires multicast group support which is new and added on
92  * 2.6.23. We can't add support for it for older kernels to support it
93  * genl_family structure was changed. Lets just let through the
94  * genl_register_mc_group call. This means no multicast group suppport */
95
96 #define genl_register_mc_group(a, b) 0
97
98 /**
99  * struct genl_multicast_group - generic netlink multicast group
100  * @name: name of the multicast group, names are per-family
101  * @id: multicast group ID, assigned by the core, to use with
102  *      genlmsg_multicast().
103  * @list: list entry for linking
104  * @family: pointer to family, need not be set before registering
105  */
106 struct genl_multicast_group
107 {
108         struct genl_family      *family;        /* private */
109         struct list_head        list;           /* private */
110         char                    name[GENL_NAMSIZ];
111         u32                     id;
112 };
113
114
115 /* Added as of 2.6.23 */
116 int pci_try_set_mwi(struct pci_dev *dev);
117
118 /* Added as of 2.6.23 */
119 #ifdef CONFIG_PM_SLEEP
120 /*
121  * Tell the freezer that the current task should be frozen by it
122  */
123 static inline void set_freezable(void)
124 {
125         current->flags &= ~PF_NOFREEZE;
126 }
127
128 #else
129 static inline void set_freezable(void) {}
130 #endif /* CONFIG_PM_SLEEP */
131
132 #else
133 #define tcf_destroy_chain_compat tcf_destroy_chain
134 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) */
135
136 #endif /* LINUX_26_23_COMPAT_H */