1 #ifndef LINUX_26_32_COMPAT_H
2 #define LINUX_26_32_COMPAT_H
4 #include <linux/version.h>
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32))
8 #include <linux/netdevice.h>
9 #include <linux/compat.h>
10 #include <net/iw_handler.h>
11 #include <linux/workqueue.h>
12 #include <net/genetlink.h>
14 #define SDIO_VENDOR_ID_INTEL 0x0089
15 #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402
16 #define SDIO_DEVICE_ID_INTEL_IWMC3200WIFI 0x1403
17 #define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404
18 #define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405
19 #define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406
21 static inline void flush_delayed_work(struct delayed_work *dwork)
23 if (del_timer_sync(&dwork->timer)) {
25 * This is what would happen on 2.6.32 but since we don't have
26 * access to the singlethread_cpu we can't really backport this,
27 * so avoid really *flush*ing the work... Oh well. Any better ideas?
29 struct cpu_workqueue_struct *cwq;
30 cwq = wq_per_cpu(keventd_wq, get_cpu());
31 __queue_work(cwq, &dwork->work);
36 flush_work(&dwork->work);
40 * struct genl_multicast_group was made netns aware through
41 * patch "genetlink: make netns aware" by johannes, we just
42 * force this to always use the default init_net
44 #define genl_info_net(x) &init_net
45 /* Just use init_net for older kernels */
46 #define get_net_ns_by_pid(x) &init_net
48 /* net namespace is lost */
49 #define genlmsg_multicast_netns(a, b, c, d, e) genlmsg_multicast(b, c, d, e)
50 #define genlmsg_multicast_allns(a, b, c, d) genlmsg_multicast(a, b, c, d)
51 #define genlmsg_unicast(net, skb, pid) genlmsg_unicast(skb, pid)
53 #define dev_change_net_namespace(a, b, c) (-EOPNOTSUPP)
55 #define SET_NETDEV_DEVTYPE(netdev, type)
58 /* Driver transmit return codes */
60 BACKPORT_NETDEV_TX_OK = NETDEV_TX_OK, /* driver took care of packet */
61 BACKPORT_NETDEV_TX_BUSY = NETDEV_TX_BUSY, /* driver tx path was busy*/
62 BACKPORT_NETDEV_TX_LOCKED = NETDEV_TX_LOCKED, /* driver tx lock was already taken */
64 typedef enum netdev_tx netdev_tx_t;
65 #endif /* __KERNEL__ */
68 * dev_pm_ops is only available on kernels >= 2.6.29, for
69 * older kernels we rely on reverting the work to old
70 * power management style stuff.
72 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
74 * Use this if you want to use the same suspend and resume callbacks for suspend
75 * to RAM and hibernation.
77 #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
78 struct dev_pm_ops name = { \
79 .suspend = suspend_fn, \
80 .resume = resume_fn, \
81 .freeze = suspend_fn, \
83 .poweroff = suspend_fn, \
84 .restore = resume_fn, \
87 #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn)
88 #endif /* >= 2.6.29 */
90 #define wireless_send_event(a, b, c, d) wireless_send_event(a, b, c, (char * ) d)
92 /* The export symbol in changed in compat/patches/15-symbol-export-conflicts.patch */
93 #define ieee80211_rx(hw, skb) mac80211_ieee80211_rx(hw, skb)
95 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */
97 #endif /* LINUX_26_32_COMPAT_H */