~ubuntu-branches/ubuntu/natty/lirc/natty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/lirc_dev-2.6.33.patch

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello
  • Date: 2010-04-02 15:06:19 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20100402150619-y1z8c1yqv621a11o
Tags: 0.8.7~pre2-0ubuntu1
* Update to 0.8.7~pre2
  - Fixes issues with lirc on maverick. (LP: #620498)
* Add lirc-in-kernel-ioctls.patch to use ioctls from the kernel for drivers.
* Drop patches upstream now:
  - debian/patches/appleir_repeat_issue.patch
  - debian/patches/hauppauge-tv-card.patch
  - debian/patches/lirc-i2c-2.6.patch
  - debian/patches/lirc_dev-2.6.33.patch
* Add updated-driver-names.patch 
* Refresh patches:
  - debian/patches/02_Makefile.in
  - debian/patches/13-warning-cleanup
* Update extra transmitter and remote databases to not reference atiusb.
* debian/control:
  - Update branches to be owned by ~mythbuntu-dev
* Disable in-kernel-support when starting lircd, and re-enable when
  stopping.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
## Description: add some description
2
 
## Origin/Author: add some origin or author
3
 
## Bug: bug URL
4
 
Index: lirc/drivers/lirc_dev/lirc_dev.h
5
 
===================================================================
6
 
--- lirc.orig/drivers/lirc_dev/lirc_dev.h       2010-03-27 23:44:10.259225130 -0500
7
 
+++ lirc/drivers/lirc_dev/lirc_dev.h    2010-03-27 23:44:08.163236533 -0500
8
 
@@ -4,7 +4,7 @@
9
 
  * (L) by Artur Lipowski <alipowski@interia.pl>
10
 
  *        This code is licensed under GNU GPL
11
 
  *
12
 
- * $Id: lirc_dev.h,v 1.37 2009/03/15 09:34:00 lirc Exp $
13
 
+ * $Id: lirc_dev.h,v 1.39 2010/01/23 16:28:07 lirc Exp $
14
 
  *
15
 
  */
16
 
 
17
 
@@ -30,14 +30,19 @@
18
 
 
19
 
 struct lirc_buffer {
20
 
        wait_queue_head_t wait_poll;
21
 
-       spinlock_t lock;
22
 
+       spinlock_t fifo_lock;
23
 
        unsigned int chunk_size;
24
 
        unsigned int size; /* in chunks */
25
 
        /* Using chunks instead of bytes pretends to simplify boundary checking
26
 
         * And should allow for some performance fine tunning later */
27
 
 #ifdef LIRC_HAVE_KFIFO
28
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
29
 
        struct kfifo *fifo;
30
 
 #else
31
 
+       struct kfifo fifo;
32
 
+       u8 fifo_initialized;
33
 
+#endif
34
 
+#else
35
 
        unsigned int fill; /* in chunks */
36
 
        int head, tail;    /* in chunks */
37
 
        unsigned char *data;
38
 
@@ -47,12 +52,12 @@
39
 
 static inline void lirc_buffer_lock(struct lirc_buffer *buf,
40
 
                                    unsigned long *flags)
41
 
 {
42
 
-       spin_lock_irqsave(&buf->lock, *flags);
43
 
+       spin_lock_irqsave(&buf->fifo_lock, *flags);
44
 
 }
45
 
 static inline void lirc_buffer_unlock(struct lirc_buffer *buf,
46
 
                                      unsigned long *flags)
47
 
 {
48
 
-       spin_unlock_irqrestore(&buf->lock, *flags);
49
 
+       spin_unlock_irqrestore(&buf->fifo_lock, *flags);
50
 
 }
51
 
 static inline void _lirc_buffer_clear(struct lirc_buffer *buf)
52
 
 {
53
 
@@ -64,10 +69,21 @@
54
 
 static inline void lirc_buffer_clear(struct lirc_buffer *buf)
55
 
 {
56
 
 #ifdef LIRC_HAVE_KFIFO
57
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
58
 
        if (buf->fifo)
59
 
                kfifo_reset(buf->fifo);
60
 
 #else
61
 
        unsigned long flags;
62
 
+
63
 
+       if (buf->fifo_initialized) {
64
 
+               spin_lock_irqsave(&buf->fifo_lock, flags);
65
 
+               kfifo_reset(&buf->fifo);
66
 
+               spin_unlock_irqrestore(&buf->fifo_lock, flags);
67
 
+       }
68
 
+#endif
69
 
+#else
70
 
+       unsigned long flags;
71
 
+
72
 
        lirc_buffer_lock(buf, &flags);
73
 
        _lirc_buffer_clear(buf);
74
 
        lirc_buffer_unlock(buf, &flags);
75
 
@@ -77,31 +93,47 @@
76
 
                                    unsigned int chunk_size,
77
 
                                    unsigned int size)
78
 
 {
79
 
+       int ret = 0;
80
 
+
81
 
        init_waitqueue_head(&buf->wait_poll);
82
 
-       spin_lock_init(&buf->lock);
83
 
+       spin_lock_init(&buf->fifo_lock);
84
 
 #ifndef LIRC_HAVE_KFIFO
85
 
        _lirc_buffer_clear(buf);
86
 
 #endif
87
 
        buf->chunk_size = chunk_size;
88
 
        buf->size = size;
89
 
 #ifdef LIRC_HAVE_KFIFO
90
 
-       buf->fifo = kfifo_alloc(size*chunk_size, GFP_KERNEL, &buf->lock);
91
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
92
 
+       buf->fifo = kfifo_alloc(size*chunk_size, GFP_KERNEL, &buf->fifo_lock);
93
 
        if (!buf->fifo)
94
 
                return -ENOMEM;
95
 
 #else
96
 
+       ret = kfifo_alloc(&buf->fifo, size * chunk_size, GFP_KERNEL);
97
 
+       if (ret == 0)
98
 
+               buf->fifo_initialized = 1;
99
 
+#endif
100
 
+#else
101
 
        buf->data = kmalloc(size*chunk_size, GFP_KERNEL);
102
 
        if (buf->data == NULL)
103
 
                return -ENOMEM;
104
 
        memset(buf->data, 0, size*chunk_size);
105
 
 #endif
106
 
-       return 0;
107
 
+
108
 
+       return ret;
109
 
 }
110
 
 static inline void lirc_buffer_free(struct lirc_buffer *buf)
111
 
 {
112
 
 #ifdef LIRC_HAVE_KFIFO
113
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
114
 
        if (buf->fifo)
115
 
                kfifo_free(buf->fifo);
116
 
 #else
117
 
+       if (buf->fifo_initialized) {
118
 
+               kfifo_free(&buf->fifo);
119
 
+               buf->fifo_initialized = 0;
120
 
+       }
121
 
+#endif
122
 
+#else
123
 
        kfree(buf->data);
124
 
        buf->data = NULL;
125
 
        buf->head = 0;
126
 
@@ -111,6 +143,25 @@
127
 
        buf->size = 0;
128
 
 #endif
129
 
 }
130
 
+
131
 
+#ifdef LIRC_HAVE_KFIFO
132
 
+static inline int lirc_buffer_len(struct lirc_buffer *buf)
133
 
+{
134
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
135
 
+       return kfifo_len(buf->fifo);
136
 
+#else
137
 
+       int len;
138
 
+       unsigned long flags;
139
 
+
140
 
+       spin_lock_irqsave(&buf->fifo_lock, flags);
141
 
+       len = kfifo_len(&buf->fifo);
142
 
+       spin_unlock_irqrestore(&buf->fifo_lock, flags);
143
 
+
144
 
+       return len;
145
 
+#endif
146
 
+}
147
 
+#endif
148
 
+
149
 
 #ifndef LIRC_HAVE_KFIFO
150
 
 static inline int  _lirc_buffer_full(struct lirc_buffer *buf)
151
 
 {
152
 
@@ -120,7 +171,7 @@
153
 
 static inline int  lirc_buffer_full(struct lirc_buffer *buf)
154
 
 {
155
 
 #ifdef LIRC_HAVE_KFIFO
156
 
-       return kfifo_len(buf->fifo) == buf->size * buf->chunk_size;
157
 
+       return lirc_buffer_len(buf) == buf->size * buf->chunk_size;
158
 
 #else
159
 
        unsigned long flags;
160
 
        int ret;
161
 
@@ -139,7 +190,7 @@
162
 
 static inline int  lirc_buffer_empty(struct lirc_buffer *buf)
163
 
 {
164
 
 #ifdef LIRC_HAVE_KFIFO
165
 
-       return !kfifo_len(buf->fifo);
166
 
+       return !lirc_buffer_len(buf);
167
 
 #else
168
 
        unsigned long flags;
169
 
        int ret;
170
 
@@ -158,7 +209,7 @@
171
 
 static inline int  lirc_buffer_available(struct lirc_buffer *buf)
172
 
 {
173
 
 #ifdef LIRC_HAVE_KFIFO
174
 
-       return buf->size - (kfifo_len(buf->fifo) / buf->chunk_size);
175
 
+       return buf->size - (lirc_buffer_len(buf) / buf->chunk_size);
176
 
 #else
177
 
        unsigned long flags;
178
 
        int ret;
179
 
@@ -177,21 +228,30 @@
180
 
        buf->fill -= 1;
181
 
 }
182
 
 #endif
183
 
-static inline void lirc_buffer_read(struct lirc_buffer *buf,
184
 
-                                   unsigned char *dest)
185
 
+static inline unsigned int lirc_buffer_read(struct lirc_buffer *buf,
186
 
+                                           unsigned char *dest)
187
 
 {
188
 
+       unsigned int ret = 0;
189
 
+
190
 
 #ifdef LIRC_HAVE_KFIFO
191
 
-       if (kfifo_len(buf->fifo) >= buf->chunk_size)
192
 
-               kfifo_get(buf->fifo, dest, buf->chunk_size);
193
 
+       if (lirc_buffer_len(buf) >= buf->chunk_size)
194
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
195
 
+               ret = kfifo_get(buf->fifo, dest, buf->chunk_size);
196
 
+#else
197
 
+               ret = kfifo_out_locked(&buf->fifo, dest, buf->chunk_size,
198
 
+                                      &buf->fifo_lock);
199
 
+#endif
200
 
 #else
201
 
        unsigned long flags;
202
 
        lirc_buffer_lock(buf, &flags);
203
 
        _lirc_buffer_read_1(buf, dest);
204
 
        lirc_buffer_unlock(buf, &flags);
205
 
 #endif
206
 
+
207
 
+       return ret;
208
 
 }
209
 
 #ifndef LIRC_HAVE_KFIFO
210
 
-static inline void _lirc_buffer_write_1(struct lirc_buffer *buf,
211
 
+static inline  _lirc_buffer_write_1(struct lirc_buffer *buf,
212
 
                                      unsigned char *orig)
213
 
 {
214
 
        memcpy(&buf->data[buf->tail*buf->chunk_size], orig, buf->chunk_size);
215
 
@@ -199,17 +259,26 @@
216
 
        buf->fill++;
217
 
 }
218
 
 #endif
219
 
-static inline void lirc_buffer_write(struct lirc_buffer *buf,
220
 
-                                    unsigned char *orig)
221
 
+static inline unsigned int lirc_buffer_write(struct lirc_buffer *buf,
222
 
+                                            unsigned char *orig)
223
 
 {
224
 
+       unsigned int ret = 0;
225
 
+
226
 
 #ifdef LIRC_HAVE_KFIFO
227
 
-       kfifo_put(buf->fifo, orig, buf->chunk_size);
228
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
229
 
+       ret = kfifo_put(buf->fifo, orig, buf->chunk_size);
230
 
+#else
231
 
+       ret = kfifo_in_locked(&buf->fifo, orig, buf->chunk_size,
232
 
+                             &buf->fifo_lock);
233
 
+#endif
234
 
 #else
235
 
        unsigned long flags;
236
 
        lirc_buffer_lock(buf, &flags);
237
 
        _lirc_buffer_write_1(buf, orig);
238
 
        lirc_buffer_unlock(buf, &flags);
239
 
 #endif
240
 
+
241
 
+       return ret;
242
 
 }
243
 
 #ifndef LIRC_HAVE_KFIFO
244
 
 static inline void _lirc_buffer_write_n(struct lirc_buffer *buf,
245
 
@@ -234,17 +303,26 @@
246
 
        buf->fill += count;
247
 
 }
248
 
 #endif
249
 
-static inline void lirc_buffer_write_n(struct lirc_buffer *buf,
250
 
-                                      unsigned char *orig, int count)
251
 
+static inline unsigned int lirc_buffer_write_n(struct lirc_buffer *buf,
252
 
+                                              unsigned char *orig, int count)
253
 
 {
254
 
+       unsigned int ret = 0;
255
 
+
256
 
 #ifdef LIRC_HAVE_KFIFO
257
 
-       kfifo_put(buf->fifo, orig, count * buf->chunk_size);
258
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
259
 
+       ret = kfifo_put(buf->fifo, orig, count * buf->chunk_size);
260
 
+#else
261
 
+       ret = kfifo_in_locked(&buf->fifo, orig, count * buf->chunk_size,
262
 
+                             &buf->fifo_lock);
263
 
+#endif
264
 
 #else
265
 
        unsigned long flags;
266
 
        lirc_buffer_lock(buf, &flags);
267
 
        _lirc_buffer_write_n(buf, orig, count);
268
 
        lirc_buffer_unlock(buf, &flags);
269
 
 #endif
270
 
+
271
 
+       return ret;
272
 
 }
273
 
 
274
 
 struct lirc_driver {