1
#ifndef LINUX_26_31_COMPAT_H
2
#define LINUX_26_31_COMPAT_H
4
#include <linux/version.h>
6
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31))
8
#include <linux/skbuff.h>
9
#include <linux/workqueue.h>
10
#include <linux/interrupt.h>
12
#include <net/genetlink.h>
13
#include <linux/ethtool.h>
16
* These macros allow us to backport rfkill without any
17
* changes on cfg80211 through compat.diff. Note that this
18
* file will be included by rfkill_backport.h so we must
19
* not conflict with things there.
21
#define rfkill_get_led_trigger_name backport_rfkill_get_led_trigger_name
22
#define rfkill_set_led_trigger_name backport_rfkill_set_led_trigger_name
23
#define rfkill_set_hw_state backport_rfkill_set_hw_state
24
#define rfkill_set_sw_state backport_rfkill_set_sw_state
25
#define rfkill_init_sw_state backport_rfkill_init_sw_state
26
#define rfkill_set_states backport_rfkill_set_states
27
#define rfkill_pause_polling backport_rfkill_pause_polling
28
#define rfkill_resume_polling backport_rfkill_resume_polling
29
#define rfkill_blocked backport_rfkill_blocked
30
#define rfkill_alloc backport_rfkill_alloc
31
#define rfkill_register backport_rfkill_register
32
#define rfkill_unregister backport_rfkill_unregister
33
#define rfkill_destroy backport_rfkill_destroy
36
#if !defined(CONFIG_ALPHA) && !defined(CONFIG_MIPS) && !defined(CONFIG_PARISC) && !defined(CONFIG_SPARC)
37
#define ERFKILL 132 /* Operation not possible due to RF-kill */
40
#define ERFKILL 138 /* Operation not possible due to RF-kill */
43
#define ERFKILL 167 /* Operation not possible due to RF-kill */
46
#define ERFKILL 256 /* Operation not possible due to RF-kill */
49
#define ERFKILL 134 /* Operation not possible due to RF-kill */
54
#define NETDEV_PRE_UP 0x000D
57
#ifndef SDIO_DEVICE_ID_MARVELL_8688WLAN
58
#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
61
struct compat_threaded_irq {
63
irq_handler_t handler;
64
irq_handler_t thread_fn;
67
struct workqueue_struct *wq;
68
struct work_struct work;
72
* kmemleak was introduced on 2.6.31, since older kernels do not have
73
* we simply ignore its tuning.
75
static inline void kmemleak_ignore(const void *ptr)
80
static inline void kmemleak_not_leak(const void *ptr)
85
static inline void kmemleak_no_scan(const void *ptr)
91
* Added via adf30907d63893e4208dfe3f5c88ae12bc2f25d5
93
* There is no _sk_dst on older kernels, so just set the
94
* old dst to NULL and release it directly.
96
static inline void skb_dst_drop(struct sk_buff *skb)
98
dst_release(skb->dst);
102
static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
104
return (struct dst_entry *)skb->dst;
107
static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
112
static inline struct rtable *skb_rtable(const struct sk_buff *skb)
114
return (struct rtable *)skb_dst(skb);
117
extern int genl_register_family_with_ops(struct genl_family *family,
118
struct genl_ops *ops, size_t n_ops);
121
/* Backport threaded IRQ support */
124
void compat_irq_work(struct work_struct *work)
126
struct compat_threaded_irq *comp = container_of(work, struct compat_threaded_irq, work);
127
comp->thread_fn(comp->irq, comp->dev_id);
131
irqreturn_t compat_irq_dispatcher(int irq, void *dev_id)
133
struct compat_threaded_irq *comp = dev_id;
136
res = comp->handler(irq, comp->dev_id);
137
if (res == IRQ_WAKE_THREAD) {
138
queue_work(comp->wq, &comp->work);
146
int compat_request_threaded_irq(struct compat_threaded_irq *comp,
148
irq_handler_t handler,
149
irq_handler_t thread_fn,
155
comp->handler = handler;
156
comp->thread_fn = thread_fn;
157
comp->dev_id = dev_id;
158
INIT_WORK(&comp->work, compat_irq_work);
161
snprintf(comp->wq_name, sizeof(comp->wq_name),
162
"compirq/%u-%s", irq, name);
163
comp->wq = create_singlethread_workqueue(comp->wq_name);
165
printk(KERN_ERR "Failed to create compat-threaded-IRQ workqueue %s\n",
170
return request_irq(irq, compat_irq_dispatcher, flags, name, comp);
174
void compat_free_threaded_irq(struct compat_threaded_irq *comp)
176
free_irq(comp->irq, comp);
180
void compat_destroy_threaded_irq(struct compat_threaded_irq *comp)
183
destroy_workqueue(comp->wq);
188
void compat_synchronize_threaded_irq(struct compat_threaded_irq *comp)
190
synchronize_irq(comp->irq);
191
cancel_work_sync(&comp->work);
195
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
197
#endif /* LINUX_26_31_COMPAT_H */