summaryrefslogtreecommitdiff
path: root/system/ov51x-jpeg/ov51x-jpeg.diff
blob: cf45dff487209f551fecb34ac7045a7d1b3ed45a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
diff -Naur ov51x-jpeg-1.5.9.orig/ov511-decomp.c ov51x-jpeg-1.5.9/ov511-decomp.c
--- ov51x-jpeg-1.5.9.orig/ov511-decomp.c	2008-09-28 12:58:09.000000000 +0200
+++ ov51x-jpeg-1.5.9/ov511-decomp.c	2011-06-25 14:40:22.180000231 +0200
@@ -22,7 +22,7 @@
  * Free Software Foundation; version 2 of the License.
  */
 
-#include <linux/autoconf.h>
+#include <generated/autoconf.h>
 #include <linux/version.h>
 
 #include "ov51x-jpeg.h"
@@ -508,6 +508,5 @@
 struct ov51x_decomp_ops ov511_decomp_ops = {
 	.decomp_400 =	Decompress400,
 	.decomp_420 =	Decompress420,
-	.owner =	THIS_MODULE,
 };
 
diff -Naur ov51x-jpeg-1.5.9.orig/ov518-decomp.c ov51x-jpeg-1.5.9/ov518-decomp.c
--- ov51x-jpeg-1.5.9.orig/ov518-decomp.c	2008-09-28 12:58:09.000000000 +0200
+++ ov51x-jpeg-1.5.9/ov518-decomp.c	2011-06-25 14:40:22.180000231 +0200
@@ -25,7 +25,7 @@
  * Free Software Foundation; version 2 of the License.
  */
 
-#include <linux/autoconf.h>
+#include <generated/autoconf.h>
 #include <linux/version.h>
 
 #include "ov51x-jpeg.h"
@@ -1488,6 +1488,5 @@
 struct ov51x_decomp_ops ov518_decomp_ops = {
 	.decomp_400 =	Decompress400,	
 	.decomp_420 =	Decompress420,	
-	.owner =	THIS_MODULE,
 };
 
diff -Naur ov51x-jpeg-1.5.9.orig/ov519-decomp.c ov51x-jpeg-1.5.9/ov519-decomp.c
--- ov51x-jpeg-1.5.9.orig/ov519-decomp.c	2008-09-28 12:58:09.000000000 +0200
+++ ov51x-jpeg-1.5.9/ov519-decomp.c	2011-06-25 14:40:22.180000231 +0200
@@ -24,7 +24,7 @@
 * See: http://zc0302.sourceforge.net/zc0302.php
 */
 
-#include <linux/autoconf.h>
+#include <generated/autoconf.h>
 #include <linux/version.h>
 
 #include "ov51x-jpeg.h"
@@ -1534,7 +1534,6 @@
 struct ov51x_decomp_ops ov519_decomp_ops = {
 	.decomp_400 =	Decompress400,	
 	.decomp_420 =	Decompress420,	
-	.owner =	THIS_MODULE,
 };
 
 
diff -Naur ov51x-jpeg-1.5.9.orig/ov51x-jpeg-core.c ov51x-jpeg-1.5.9/ov51x-jpeg-core.c
--- ov51x-jpeg-1.5.9.orig/ov51x-jpeg-core.c	2008-09-28 12:58:09.000000000 +0200
+++ ov51x-jpeg-1.5.9/ov51x-jpeg-core.c	2011-06-25 14:40:48.720000244 +0200
@@ -12,6 +12,9 @@
 * To support OV7670 sensors as found in Creative Live! Vista IM webcam
 * With reference to One Laptop Per Child sourced kernel patches in 2.6.20 kernel
 * contributed to kernel by Jonathan Corbet.
+*
+* Modified to work with 2.6.29 kernels by Onur Küçük <onur@pardus.org.tr>
+*
 */
 
 
@@ -84,7 +87,7 @@
  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/autoconf.h>
+#include <generated/autoconf.h>
 
 #define OV51x_JPEG_VERSION "1.5.9"
 
@@ -534,13 +537,13 @@
 static int sensor_get_picture(struct usb_ov511 *, struct video_picture *);
 static int sensor_get_exposure(struct usb_ov511 *, unsigned char *);
 static int ov51x_check_snapshot(struct usb_ov511 *);
-static int ov51x_control_ioctl(struct inode *, struct file *, unsigned int,
+static long ov51x_control_ioctl(struct inode *, struct file *, unsigned int,
 			       unsigned long);
 
 static struct file_operations ov511_control_fops = {
-	.ioctl =	ov51x_control_ioctl,
+	.unlocked_ioctl =	ov51x_control_ioctl,
 #ifdef CONFIG_COMPAT 
-	.compat_ioctl =	v4l_compat_ioctl32,
+	.compat_ioctl =	v4l2_compat_ioctl32,
 #endif
 };
 
@@ -678,7 +681,6 @@
 	ov->proc_devdir = create_proc_entry(dirname, S_IFDIR, ov51x_jpeg_proc_entry);
 	if (!ov->proc_devdir)
 		return;
-	ov->proc_devdir->owner = THIS_MODULE;
 
 	/* Create "info" entry (human readable device information) */
 	PDEBUG(4, "creating /proc/ov51x-jpeg/ov51x/%s/info", dirname);
@@ -686,7 +688,6 @@
 		ov->proc_devdir, ov511_read_proc_info, ov);
 	if (!ov->proc_info)
 		return;
-	ov->proc_info->owner = THIS_MODULE;
 
 	/* Don't create it if old snapshot mode on (would cause race cond.) */
 	if (!snapshot) {
@@ -697,7 +698,6 @@
 			ov511_read_proc_button, ov);
 		if (!ov->proc_button)
 			return;
-		ov->proc_button->owner = THIS_MODULE;
 	}
 
 	/* Create "control" entry (ioctl() interface) */
@@ -709,7 +709,6 @@
 		unlock_kernel();
 		return;
 	}
-	ov->proc_control->owner = THIS_MODULE;
 	ov->proc_control->data = ov;
 	ov->proc_control->proc_fops = &ov511_control_fops;
 	unlock_kernel();
@@ -762,9 +761,7 @@
 	 */
 
 	ov51x_jpeg_proc_entry = create_proc_entry("ov51x-jpeg", S_IFDIR, &proc_root);
-	if (ov51x_jpeg_proc_entry)
-		ov51x_jpeg_proc_entry->owner = THIS_MODULE;
-	else
+	if (!ov51x_jpeg_proc_entry)
 		err("Unable to create /proc/ov51x-jpeg");
 
 }
@@ -5733,7 +5730,7 @@
 {
 #else
 static int
-ov51x_v4l1_open(struct inode *inode, struct file *file)
+ov51x_v4l1_open(struct file *file)
 {
 	struct video_device *vdev = video_devdata(file);
 #endif
@@ -5804,7 +5801,7 @@
 {
 #else
 static int
-ov51x_v4l1_close(struct inode *inode, struct file *file)
+ov51x_v4l1_close(struct file *file)
 {
 	struct video_device *vdev = file->private_data;
 #endif
@@ -5850,13 +5847,14 @@
 }
 
 /* Do not call this function directly! */
-static int
 #ifdef OV511_OLD_V4L
+static long
 ov51x_v4l1_ioctl_internal(struct usb_ov511 *ov, unsigned int cmd,
 			  void *arg)
 {
 #else
-ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file,
+static long
+ov51x_v4l1_ioctl_internal(struct file *file,
 			  unsigned int cmd, void *arg)
 {
 	struct video_device *vdev = file->private_data;
@@ -6355,7 +6353,7 @@
 	return err;
 }
 
-static int
+static long
 ov51x_v4l1_ioctl(struct video_device *vdev, unsigned int cmd, void *arg)
 {
 	struct usb_ov511 *ov = vdev->priv;
@@ -6372,8 +6370,8 @@
 
 #else	/* If new V4L API */
 
-static int
-ov51x_v4l1_ioctl(struct inode *inode, struct file *file,
+static long
+ov51x_v4l1_ioctl(struct file *file,
 		 unsigned int cmd, unsigned long arg)
 {
 	struct video_device *vdev = file->private_data;
@@ -6383,7 +6381,7 @@
 	if (down_interruptible(&ov->lock))
 		return -EINTR;
 
-	rc = video_usercopy(inode, file, cmd, arg, ov51x_v4l1_ioctl_internal);
+	rc = video_usercopy(file, cmd, arg, ov51x_v4l1_ioctl_internal);
 
 	up(&ov->lock);
 	return rc;
@@ -6609,7 +6607,6 @@
 
 #ifdef OV511_OLD_V4L
 static struct video_device vdev_template = {
-	.owner =	THIS_MODULE,
 	.name =		"OV511 USB Camera",
 	.type =		VID_TYPE_CAPTURE,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
@@ -6624,22 +6621,19 @@
 
 #else	/* New V4L API */
 
-static struct file_operations ov511_fops = {
-	.owner =	THIS_MODULE,
+static struct v4l2_file_operations ov511_fops = {
 	.open =		ov51x_v4l1_open,
 	.release =	ov51x_v4l1_close,
 	.read =		ov51x_v4l1_read,
 	.mmap =		ov51x_v4l1_mmap,
 	.ioctl =	ov51x_v4l1_ioctl,
-#ifdef CONFIG_COMPAT 
-	.compat_ioctl =	v4l_compat_ioctl32,
-#endif
-	.llseek =	no_llseek,
+/*#ifdef CONFIG_COMPAT 
+	.compat_ioctl =	v4l2_compat_ioctl32,
+#endif*/
 };
 
 static struct video_device vdev_template = {
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
-	.owner =	THIS_MODULE,
 #endif
 	.name =		"OV51x USB Camera",
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
@@ -6654,7 +6648,7 @@
 };
 #endif	/* OV511_OLD_V4L */
 
-static int
+static long
 ov51x_control_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 		    unsigned long ularg)
 {
@@ -8304,11 +8298,11 @@
 
 	init_waitqueue_head(&ov->wq);
 
-	init_MUTEX(&ov->lock);	/* to 1 == available */
-	init_MUTEX(&ov->buf_lock);
-	init_MUTEX(&ov->param_lock);
-	init_MUTEX(&ov->i2c_lock);
-	init_MUTEX(&ov->cbuf_lock);
+	sema_init(&ov->lock,1);	/* to 1 == available */
+	sema_init(&ov->buf_lock,1);
+	sema_init(&ov->param_lock,1);
+	sema_init(&ov->i2c_lock,1);
+	sema_init(&ov->cbuf_lock,1);
 
 	ov->buf_state = BUF_NOT_ALLOCATED;
 
@@ -8374,7 +8368,7 @@
 
 	memcpy(ov->vdev, &vdev_template, sizeof(*ov->vdev));
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
-	ov->vdev->dev = dev->dev;
+	ov->vdev->parent = &dev->dev;
 #else
 	ov->vdev->dev = &dev->dev;
 #endif
diff -Naur ov51x-jpeg-1.5.9.orig/ov51x-jpeg.h ov51x-jpeg-1.5.9/ov51x-jpeg.h
--- ov51x-jpeg-1.5.9.orig/ov51x-jpeg.h	2008-09-28 12:58:09.000000000 +0200
+++ ov51x-jpeg-1.5.9/ov51x-jpeg.h	2011-06-25 14:40:15.801000231 +0200
@@ -63,6 +63,12 @@
 #include <media/v4l2-ioctl.h>
 #endif
 
+/* Add missing info and warn macros by hand for new kernels */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
+#define info(args...) printk(KERN_INFO KBUILD_MODNAME args)
+#define warn(args...) printk(KERN_WARNING KBUILD_MODNAME args)
+#endif
+
 /* --------------------------------- */
 /* DEFINES FOR OV511 AND OTHER CHIPS */
 /* --------------------------------- */
@@ -582,7 +588,6 @@
 			  int, int, int);
 	int (*decomp_422)(unsigned char *, unsigned char *, unsigned char *,
 			  int, int, int);
-	struct module *owner;
 };
 
 extern struct ov51x_decomp_ops ov511_decomp_ops;