~ubuntu-branches/ubuntu/maverick/linux-backports-modules-2.6.32/maverick

« back to all changes in this revision

Viewing changes to updates/compat-wireless-2.6/include/linux/compat-2.6.31.h

  • Committer: Bazaar Package Importer
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2010-02-04 23:15:51 UTC
  • Revision ID: james.westby@ubuntu.com-20100204231551-vjz5pkvxclukjxm1
Tags: 2.6.32-12.1
[ Andy Whitcroft ]

* initial LBM for lucid
* drop generated files
* printchanges -- rebase tree does not have stable tags use changelog
* printenv -- add revisions to printenv output
* formally rename compat-wireless to linux-backports-modules-wireless
* Update to compat-wireless-2.6.33-rc5
* update nouveau to mainline 2.6.33-rc4
* add new LBM package for nouveau
* nouveau -- fix major numbers and proc entry names
* fix up firmware installs for -wireless
* clean up UPDATE-NOVEAU
* update Nouveau to v2.6.33-rc6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LINUX_26_31_COMPAT_H
 
2
#define LINUX_26_31_COMPAT_H
 
3
 
 
4
#include <linux/version.h>
 
5
 
 
6
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31))
 
7
 
 
8
#include <linux/skbuff.h>
 
9
#include <linux/workqueue.h>
 
10
#include <linux/interrupt.h>
 
11
#include <net/dst.h>
 
12
#include <net/genetlink.h>
 
13
#include <linux/ethtool.h>
 
14
 
 
15
/*
 
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.
 
20
 */
 
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
 
34
 
 
35
#ifndef ERFKILL
 
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 */
 
38
#endif
 
39
#ifdef CONFIG_ALPHA
 
40
#define ERFKILL         138     /* Operation not possible due to RF-kill */
 
41
#endif
 
42
#ifdef CONFIG_MIPS
 
43
#define ERFKILL         167     /* Operation not possible due to RF-kill */
 
44
#endif
 
45
#ifdef CONFIG_PARISC
 
46
#define ERFKILL         256     /* Operation not possible due to RF-kill */
 
47
#endif
 
48
#ifdef CONFIG_SPARC
 
49
#define ERFKILL         134     /* Operation not possible due to RF-kill */
 
50
#endif
 
51
#endif
 
52
 
 
53
#ifndef NETDEV_PRE_UP
 
54
#define NETDEV_PRE_UP           0x000D
 
55
#endif
 
56
 
 
57
#ifndef SDIO_DEVICE_ID_MARVELL_8688WLAN
 
58
#define SDIO_DEVICE_ID_MARVELL_8688WLAN         0x9104
 
59
#endif
 
60
 
 
61
struct compat_threaded_irq {
 
62
        unsigned int irq;
 
63
        irq_handler_t handler;
 
64
        irq_handler_t thread_fn;
 
65
        void *dev_id;
 
66
        char wq_name[64];
 
67
        struct workqueue_struct *wq;
 
68
        struct work_struct work;
 
69
};
 
70
 
 
71
/*
 
72
 * kmemleak was introduced on 2.6.31, since older kernels do not have
 
73
 * we simply ignore its tuning.
 
74
 */
 
75
static inline void kmemleak_ignore(const void *ptr)
 
76
{
 
77
        return;
 
78
}
 
79
 
 
80
static inline void kmemleak_not_leak(const void *ptr)
 
81
{
 
82
        return;
 
83
}
 
84
 
 
85
static inline void kmemleak_no_scan(const void *ptr)
 
86
{
 
87
        return;
 
88
}
 
89
 
 
90
/*
 
91
 * Added via adf30907d63893e4208dfe3f5c88ae12bc2f25d5
 
92
 *
 
93
 * There is no _sk_dst on older kernels, so just set the
 
94
 * old dst to NULL and release it directly.
 
95
 */
 
96
static inline void skb_dst_drop(struct sk_buff *skb)
 
97
{
 
98
        dst_release(skb->dst);
 
99
        skb->dst = NULL;
 
100
}
 
101
 
 
102
static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
 
103
{
 
104
        return (struct dst_entry *)skb->dst;
 
105
}
 
106
 
 
107
static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
 
108
{
 
109
        skb->dst = dst;
 
110
}
 
111
 
 
112
static inline struct rtable *skb_rtable(const struct sk_buff *skb)
 
113
{
 
114
        return (struct rtable *)skb_dst(skb);
 
115
}
 
116
 
 
117
extern int genl_register_family_with_ops(struct genl_family *family,
 
118
        struct genl_ops *ops, size_t n_ops);
 
119
 
 
120
 
 
121
/* Backport threaded IRQ support */
 
122
 
 
123
static inline
 
124
void compat_irq_work(struct work_struct *work)
 
125
{
 
126
        struct compat_threaded_irq *comp = container_of(work, struct compat_threaded_irq, work);
 
127
        comp->thread_fn(comp->irq, comp->dev_id);
 
128
}
 
129
 
 
130
static inline
 
131
irqreturn_t compat_irq_dispatcher(int irq, void *dev_id)
 
132
{
 
133
        struct compat_threaded_irq *comp = dev_id;
 
134
        irqreturn_t res;
 
135
 
 
136
        res = comp->handler(irq, comp->dev_id);
 
137
        if (res == IRQ_WAKE_THREAD) {
 
138
                queue_work(comp->wq, &comp->work);
 
139
                res = IRQ_HANDLED;
 
140
        }
 
141
 
 
142
        return res;
 
143
}
 
144
 
 
145
static inline
 
146
int compat_request_threaded_irq(struct compat_threaded_irq *comp,
 
147
                                unsigned int irq,
 
148
                                irq_handler_t handler,
 
149
                                irq_handler_t thread_fn,
 
150
                                unsigned long flags,
 
151
                                const char *name,
 
152
                                void *dev_id)
 
153
{
 
154
        comp->irq = irq;
 
155
        comp->handler = handler;
 
156
        comp->thread_fn = thread_fn;
 
157
        comp->dev_id = dev_id;
 
158
        INIT_WORK(&comp->work, compat_irq_work);
 
159
 
 
160
        if (!comp->wq) {
 
161
                snprintf(comp->wq_name, sizeof(comp->wq_name),
 
162
                         "compirq/%u-%s", irq, name);
 
163
                comp->wq = create_singlethread_workqueue(comp->wq_name);
 
164
                if (!comp->wq) {
 
165
                        printk(KERN_ERR "Failed to create compat-threaded-IRQ workqueue %s\n",
 
166
                               comp->wq_name);
 
167
                        return -ENOMEM;
 
168
                }
 
169
        }
 
170
        return request_irq(irq, compat_irq_dispatcher, flags, name, comp);
 
171
}
 
172
 
 
173
static inline
 
174
void compat_free_threaded_irq(struct compat_threaded_irq *comp)
 
175
{
 
176
        free_irq(comp->irq, comp);
 
177
}
 
178
 
 
179
static inline
 
180
void compat_destroy_threaded_irq(struct compat_threaded_irq *comp)
 
181
{
 
182
        if (comp->wq)
 
183
                destroy_workqueue(comp->wq);
 
184
        comp->wq = NULL;
 
185
}
 
186
 
 
187
static inline
 
188
void compat_synchronize_threaded_irq(struct compat_threaded_irq *comp)
 
189
{
 
190
        synchronize_irq(comp->irq);
 
191
        cancel_work_sync(&comp->work);
 
192
}
 
193
 
 
194
 
 
195
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
 
196
 
 
197
#endif /* LINUX_26_31_COMPAT_H */