summaryrefslogtreecommitdiff
blob: 4813e6c1b3288a1d267c0da23e16610dd10af4d7 (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
--- qc-usb-messenger-1.8/qc-memory.c	2006-11-05 06:36:51.000000000 +0000
+++ qc-usb-messenger-1.8/qc-memory.c	2008-10-07 01:32:40.000000000 +0100
@@ -81,12 +81,14 @@
 #define pte_offset(pmd,adr)	pte_offset_map(pmd,adr)	/* Emulation for a kernel using the new rmap-vm */
 #endif							/* Fix by Michele Balistreri <brain87@gmx.net> */
 
+#if LINUX_VERSION_CODE>=KERNEL_VERSION(2,5,3) &&  LINUX_VERSION_CODE<KERNEL_VERSION(2,6,26)
 #ifndef SetPageReserved
 #define SetPageReserved(p)	mem_map_reserve(p)
 #endif
 #ifndef ClearPageReserved
 #define ClearPageReserved(p)	mem_map_unreserve(p)
 #endif
+#endif
 /* }}} */
 
 /* {{{ [fold] kvirt_to_pa(): obtain physical address from virtual address obtained by vmalloc() */
--- qc-usb-messenger-1.8/qc-driver.c	2008-05-26 12:29:16.000000000 +0100
+++ qc-usb-messenger-1.8/qc-driver.c	2008-10-07 01:07:48.000000000 +0100
@@ -1616,7 +1616,7 @@
 	fd->maxrawdatalen = 0;		/* Hopefully stops all ongoing captures, might need locking though */
 	wake_up(&fd->wq);
 	if (qcdebug&QC_DEBUGFRAME) PDEBUG("waiting=%i",fd->waiting);
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_exit() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_exit() : %i", qc, 0);
 	up(&qc->lock);			/* The lock was down when entering this function */
 	while (fd->waiting > 0) {
 		schedule();
@@ -1627,7 +1627,7 @@
 		}
 #endif
 	}
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_exit() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_exit() : %i", qc, 0);
 	down(&qc->lock);
 	vfree(fd->rawdatabuf);
 	POISON(fd->rawdatabuf);
@@ -1656,14 +1656,14 @@
 	/* Wait until the next frame is available */
 	if (qcdebug&QC_DEBUGFRAME) PDEBUG("qc_frame_get/consume(qc=%p,tail=%i,head=%i)",qc,fd->tail,fd->head);
 	fd->waiting++;
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_get() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_frame_get() : %i", qc, 0);
 	up(&qc->lock);					/* Release lock while waiting */
 
 	ret = wait_event_interruptible(fd->wq, fd->head!=fd->tail || fd->exiting);	//FIXME:What if we get -ERESTARTSYS?
 	if(ret == -ERESTARTSYS) {
 	  PDEBUG("wait_event_interruptible() returned ERESTARTSYS");
 	}
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_get() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_frame_get() : %i", qc, 0);
 	down(&qc->lock);
 	if (!ret) {
 		if (!fd->exiting) {
@@ -2685,12 +2685,12 @@
 	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_INC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE));
 	MOD_INC_USE_COUNT;
 
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list) in qc_v4l_open() : %i", sem_getcount(&quickcam_list_lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list) in qc_v4l_open() : %i", 0);
 
 	r = qc_lock(qc);
 	if (r<0) goto fail1;
 
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_open() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_open() : %i", qc, 0);
 	if (down_interruptible(&qc->lock)) {
 		r = -ERESTARTSYS;
 		goto fail2;
@@ -2705,15 +2705,15 @@
 		if (qcdebug&QC_DEBUGLOGIC) PDEBUG("First user, initializing");
 		if ((r = qc_v4l_init(qc))<0) goto fail4;
 	}
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open() : %i",qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open() : %i",qc, 0);
 	up(&qc->lock);
 	up(&quickcam_list_lock);
 	return 0;
 
 fail4:	qc->users--;
-fail3:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open()=failed : %i",qc, sem_getcount(&qc->lock));
+fail3:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_open()=failed : %i",qc, 0);
 	up(&qc->lock);
-fail2:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_open()=failed : %i", sem_getcount(&qc->lock));
+fail2:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_open()=failed : %i", 0);
 	up(&quickcam_list_lock);
 fail1:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_open() : %i",GET_USE_COUNT(THIS_MODULE));
 	MOD_DEC_USE_COUNT;
@@ -2747,9 +2747,9 @@
 #else
 	TEST_BUG_MSG(qc==NULL, "qc==NULL");
 #endif
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_v4l_close() : %i", sem_getcount(&quickcam_list_lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_v4l_close() : %i", 0);
 	down(&quickcam_list_lock);	/* Can not interrupt, we must success */
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_v4l_close() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_v4l_close() : %i", qc, 0);
 	down(&qc->lock);		/* Can not interrupt, we must success */
 	qc->users--;
 	PDEBUG("close users=%i", qc->users);
@@ -2764,10 +2764,10 @@
 		}
 	}
 	if (qc) {
-		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_close() : %i", qc, sem_getcount(&qc->lock));
+		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_close() : %i", qc, 0);
 		up(&qc->lock);
 	}
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_close() : %i", sem_getcount(&quickcam_list_lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_v4l_close() : %i", 0);
 	up(&quickcam_list_lock);
 	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_v4l_close() : %i", GET_USE_COUNT(THIS_MODULE));
 	MOD_DEC_USE_COUNT;
@@ -2801,7 +2801,7 @@
 		PDEBUG("qc_read: no video_device available or no buffer attached :( EFAULT");
 		return -EFAULT;
 	}
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_read() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_read() : %i", qc, 0);
 	if (down_interruptible(&qc->lock)) return -ERESTARTSYS;
 	if (!qc->connected) {
 		r = -ENODEV;
@@ -2823,7 +2823,7 @@
 	}
 	r = count;
 
-fail:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_read() : %i", qc, sem_getcount(&qc->lock));
+fail:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_read() : %i", qc, 0);
 	up(&qc->lock);
 	if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) if (r<0) PDEBUG("failed qc_v4l_read()=%i", (int)r);
 	return r;
@@ -2852,14 +2852,14 @@
 	struct vm_area_struct *vma = NULL;
 #endif
 	if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGUSER) PDEBUG("qc_v4l_mmap(dev=%p,size=%li,qc=%p)",dev,size,qc);
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_mmap() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_mmap() : %i", qc, 0);
 	if (down_interruptible(&qc->lock)) return -ERESTARTSYS;
 	if (!qc->connected) { ret = -ENODEV; goto fail; }
 	frame_size = qc_capt_frameaddr(qc, &frame);
 	if (frame_size<0) { ret = frame_size; goto fail; }		/* Should never happen */
 	ret = qc_mm_remap(vma, frame, frame_size, start, size);
 
-fail:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_mmap() : %i", qc, sem_getcount(&qc->lock));
+fail:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_mmap() : %i", qc, 0);
 	up(&qc->lock);
 	if (ret<0) if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) PDEBUG("failed qc_v4l_mmap()=%i",ret);
 	return ret;
@@ -2881,7 +2881,7 @@
 	int i, retval = 0;
 
 	if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGUSER) PDEBUG("qc_v4l_ioctl(dev=%p,cmd=%u,arg=%p,qc=%p)",dev,cmd,argp,qc);
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_ioctl() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_v4l_ioctl() : %i", qc, 0);
 	if (down_interruptible(&qc->lock)) return -ERESTARTSYS;
 	if (!qc->connected) {
 		retval = -ENODEV;
@@ -3452,7 +3452,7 @@
 			retval = -ENOIOCTLCMD;
 			break;
 	}
-fail:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_ioctl() : %i", qc, sem_getcount(&qc->lock));
+fail:	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_v4l_ioctl() : %i", qc, 0);
 	up(&qc->lock);
 	if (retval<0) if (qcdebug&(QC_DEBUGLOGIC|QC_DEBUGUSER|QC_DEBUGERRORS)) PDEBUG("failed qc_v4l_ioctl()=%i",retval);
 	return retval;
@@ -3547,21 +3547,21 @@
 
 	/* Check if there is already a suitable quickcam struct that can be reused */
 	reuse_qc = FALSE;
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list_lock) in qc_usb_init() : %i", sem_getcount(&quickcam_list_lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(quickcam_list_lock) in qc_usb_init() : %i", 0);
 	if (down_interruptible(&quickcam_list_lock)) return NULL;
 	list_for_each_entry(qc, &quickcam_list, list) {
 		if (qc->dev != NULL) {
 		  continue;			/* quickcam_list_lock protects this test */
 		}
-		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_usb_init() : %i",qc, sem_getcount(&qc->lock));
+		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down_intr(%p) in qc_usb_init() : %i",qc, 0);
 		if (down_interruptible(&qc->lock)) {
 			/* Failed to lock the camera. Move on in the list, skipping this camera */
-			if (qcdebug&QC_DEBUGMUTEX) PDEBUG("failed locking the camera %p in qc_usb_init() : %i",qc,sem_getcount(&qc->lock));
+			if (qcdebug&QC_DEBUGMUTEX) PDEBUG("failed locking the camera %p in qc_usb_init() : %i",qc,0);
 			continue;
 		}
 		if (qc->users<=0) {
 			PRINTK(KERN_NOTICE, "Unplugged unused camera detected!");
-			if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, sem_getcount(&qc->lock));
+			if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, 0);
 			up(&qc->lock);
 			continue;
 		}
@@ -3662,7 +3662,7 @@
 #endif
 	/* Register input device for button */
 	qc->input_ptr->name = "Quickcam snapshot button";
-	qc->input_ptr->private = qc;
+	//qc->input_ptr->private = qc;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
 	qc->input_ptr->evbit[0] = BIT_MASK(EV_KEY);
 	qc->input_ptr->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
@@ -3769,9 +3769,9 @@
 	qc_v4l_exit(qc);
 #endif
 
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init() : %i",qc, 0);
 	up(&qc->lock);
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init() : %i", sem_getcount(&quickcam_list_lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init() : %i", 0);
 	up(&quickcam_list_lock);
 	return qc;
 
@@ -3781,14 +3781,14 @@
 fail2:	
 	qc->dev = NULL;
 	qc->connected = FALSE;
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init()=failed : %i",qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_init()=failed : %i",qc, 0);
 	up(&qc->lock);
 
 	if (!reuse_qc) {
 	  kfree(qc);
 	}
 fail1:	if (qcdebug&QC_DEBUGLOGIC || qcdebug&QC_DEBUGERRORS) PDEBUG("failed qc_usb_init()=%i",r);
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init()=failed : %i", sem_getcount(&quickcam_list_lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_init()=failed : %i", 0);
 	up(&quickcam_list_lock);
 	return NULL;
 }
@@ -4057,9 +4057,9 @@
 	 */
 	qc->connected = FALSE;
 
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_usb_disconnect() : %i", sem_getcount(&quickcam_list_lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(quickcam_list) in qc_usb_disconnect() : %i", 0);
 	down(&quickcam_list_lock);		/* Also avoids race condition with open() */
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_usb_disconnect() : %i", qc, sem_getcount(&qc->lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("down(%p) in qc_usb_disconnect() : %i", qc, 0);
 	down(&qc->lock);			/* Can not interrupt, we must success */
 
 	if (qc->users <= 0) {
@@ -4072,11 +4072,11 @@
 		qc_isoc_stop(qc);		/* Unlink and free isochronous URBs */
 		qc_int_exit(qc);
 		qc->dev = NULL;			/* Must be set to NULL only after interrupts are guaranteed to be disabled! */
-		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_disconnect() : %i",qc, sem_getcount(&qc->lock));
+		if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(%p) in qc_usb_disconnect() : %i",qc, 0);
 		up(&qc->lock);
 	}
 
-	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_disconnect() : %i", sem_getcount(&quickcam_list_lock));
+	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("up(quickcam_list) in qc_usb_disconnect() : %i", 0);
 	up(&quickcam_list_lock);
 	if (qcdebug&QC_DEBUGMUTEX) PDEBUG("MOD_DEC_USE_COUNT in qc_usb_disconnect() : %i",GET_USE_COUNT(THIS_MODULE));
 	MOD_DEC_USE_COUNT;	/* Release lock--if device is not open, module can be now freed */