aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/zoran
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/zoran')
-rw-r--r--drivers/media/video/zoran/zoran_device.c6
-rw-r--r--drivers/media/video/zoran/zoran_device.h2
-rw-r--r--drivers/media/video/zoran/zoran_driver.c158
3 files changed, 56 insertions, 110 deletions
diff --git a/drivers/media/video/zoran/zoran_device.c b/drivers/media/video/zoran/zoran_device.c
index 4dc951322ef..f8bcd1a248c 100644
--- a/drivers/media/video/zoran/zoran_device.c
+++ b/drivers/media/video/zoran/zoran_device.c
@@ -535,12 +535,8 @@ zr36057_overlay (struct zoran *zr,
535 * and the maximum window size is BUZ_MAX_WIDTH * BUZ_MAX_HEIGHT pixels. 535 * and the maximum window size is BUZ_MAX_WIDTH * BUZ_MAX_HEIGHT pixels.
536 */ 536 */
537 537
538void 538void write_overlay_mask(struct zoran_fh *fh, struct v4l2_clip *vp, int count)
539write_overlay_mask (struct file *file,
540 struct v4l2_clip *vp,
541 int count)
542{ 539{
543 struct zoran_fh *fh = file->private_data;
544 struct zoran *zr = fh->zr; 540 struct zoran *zr = fh->zr;
545 unsigned mask_line_size = (BUZ_MAX_WIDTH + 31) / 32; 541 unsigned mask_line_size = (BUZ_MAX_WIDTH + 31) / 32;
546 u32 *mask; 542 u32 *mask;
diff --git a/drivers/media/video/zoran/zoran_device.h b/drivers/media/video/zoran/zoran_device.h
index 3520bd54c8b..85414e17524 100644
--- a/drivers/media/video/zoran/zoran_device.h
+++ b/drivers/media/video/zoran/zoran_device.h
@@ -54,7 +54,7 @@ extern int jpeg_codec_reset(struct zoran *zr);
54/* zr360x7 access to raw capture */ 54/* zr360x7 access to raw capture */
55extern void zr36057_overlay(struct zoran *zr, 55extern void zr36057_overlay(struct zoran *zr,
56 int on); 56 int on);
57extern void write_overlay_mask(struct file *file, 57extern void write_overlay_mask(struct zoran_fh *fh,
58 struct v4l2_clip *vp, 58 struct v4l2_clip *vp,
59 int count); 59 int count);
60extern void zr36057_set_memgrab(struct zoran *zr, 60extern void zr36057_set_memgrab(struct zoran *zr,
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c
index e22378a4598..5343a8aeb64 100644
--- a/drivers/media/video/zoran/zoran_driver.c
+++ b/drivers/media/video/zoran/zoran_driver.c
@@ -186,8 +186,8 @@ zoran_v4l2_calc_bufsize (struct zoran_jpg_settings *settings)
186} 186}
187 187
188/* forward references */ 188/* forward references */
189static void v4l_fbuffer_free(struct file *file); 189static void v4l_fbuffer_free(struct zoran_fh *fh);
190static void jpg_fbuffer_free(struct file *file); 190static void jpg_fbuffer_free(struct zoran_fh *fh);
191 191
192/* Set mapping mode */ 192/* Set mapping mode */
193static void map_mode_raw(struct zoran_fh *fh) 193static void map_mode_raw(struct zoran_fh *fh)
@@ -213,10 +213,8 @@ static inline const char *mode_name(enum zoran_map_mode mode)
213 * These have to be pysically contiguous. 213 * These have to be pysically contiguous.
214 */ 214 */
215 215
216static int 216static int v4l_fbuffer_alloc(struct zoran_fh *fh)
217v4l_fbuffer_alloc (struct file *file)
218{ 217{
219 struct zoran_fh *fh = file->private_data;
220 struct zoran *zr = fh->zr; 218 struct zoran *zr = fh->zr;
221 int i, off; 219 int i, off;
222 unsigned char *mem; 220 unsigned char *mem;
@@ -236,7 +234,7 @@ v4l_fbuffer_alloc (struct file *file)
236 KERN_ERR 234 KERN_ERR
237 "%s: v4l_fbuffer_alloc() - kmalloc for V4L buf %d failed\n", 235 "%s: v4l_fbuffer_alloc() - kmalloc for V4L buf %d failed\n",
238 ZR_DEVNAME(zr), i); 236 ZR_DEVNAME(zr), i);
239 v4l_fbuffer_free(file); 237 v4l_fbuffer_free(fh);
240 return -ENOBUFS; 238 return -ENOBUFS;
241 } 239 }
242 fh->buffers.buffer[i].v4l.fbuffer = mem; 240 fh->buffers.buffer[i].v4l.fbuffer = mem;
@@ -258,10 +256,8 @@ v4l_fbuffer_alloc (struct file *file)
258} 256}
259 257
260/* free the V4L grab buffers */ 258/* free the V4L grab buffers */
261static void 259static void v4l_fbuffer_free(struct zoran_fh *fh)
262v4l_fbuffer_free (struct file *file)
263{ 260{
264 struct zoran_fh *fh = file->private_data;
265 struct zoran *zr = fh->zr; 261 struct zoran *zr = fh->zr;
266 int i, off; 262 int i, off;
267 unsigned char *mem; 263 unsigned char *mem;
@@ -311,10 +307,8 @@ v4l_fbuffer_free (struct file *file)
311 * and fragment buffers are not little-endian. 307 * and fragment buffers are not little-endian.
312 */ 308 */
313 309
314static int 310static int jpg_fbuffer_alloc(struct zoran_fh *fh)
315jpg_fbuffer_alloc (struct file *file)
316{ 311{
317 struct zoran_fh *fh = file->private_data;
318 struct zoran *zr = fh->zr; 312 struct zoran *zr = fh->zr;
319 int i, j, off; 313 int i, j, off;
320 u8 *mem; 314 u8 *mem;
@@ -334,7 +328,7 @@ jpg_fbuffer_alloc (struct file *file)
334 KERN_ERR 328 KERN_ERR
335 "%s: jpg_fbuffer_alloc() - get_zeroed_page (frag_tab) failed for buffer %d\n", 329 "%s: jpg_fbuffer_alloc() - get_zeroed_page (frag_tab) failed for buffer %d\n",
336 ZR_DEVNAME(zr), i); 330 ZR_DEVNAME(zr), i);
337 jpg_fbuffer_free(file); 331 jpg_fbuffer_free(fh);
338 return -ENOBUFS; 332 return -ENOBUFS;
339 } 333 }
340 fh->buffers.buffer[i].jpg.frag_tab = (__le32 *)mem; 334 fh->buffers.buffer[i].jpg.frag_tab = (__le32 *)mem;
@@ -347,7 +341,7 @@ jpg_fbuffer_alloc (struct file *file)
347 KERN_ERR 341 KERN_ERR
348 "%s: jpg_fbuffer_alloc() - kmalloc failed for buffer %d\n", 342 "%s: jpg_fbuffer_alloc() - kmalloc failed for buffer %d\n",
349 ZR_DEVNAME(zr), i); 343 ZR_DEVNAME(zr), i);
350 jpg_fbuffer_free(file); 344 jpg_fbuffer_free(fh);
351 return -ENOBUFS; 345 return -ENOBUFS;
352 } 346 }
353 fh->buffers.buffer[i].jpg.frag_tab[0] = 347 fh->buffers.buffer[i].jpg.frag_tab[0] =
@@ -365,7 +359,7 @@ jpg_fbuffer_alloc (struct file *file)
365 KERN_ERR 359 KERN_ERR
366 "%s: jpg_fbuffer_alloc() - get_zeroed_page failed for buffer %d\n", 360 "%s: jpg_fbuffer_alloc() - get_zeroed_page failed for buffer %d\n",
367 ZR_DEVNAME(zr), i); 361 ZR_DEVNAME(zr), i);
368 jpg_fbuffer_free(file); 362 jpg_fbuffer_free(fh);
369 return -ENOBUFS; 363 return -ENOBUFS;
370 } 364 }
371 365
@@ -391,10 +385,8 @@ jpg_fbuffer_alloc (struct file *file)
391} 385}
392 386
393/* free the MJPEG grab buffers */ 387/* free the MJPEG grab buffers */
394static void 388static void jpg_fbuffer_free(struct zoran_fh *fh)
395jpg_fbuffer_free (struct file *file)
396{ 389{
397 struct zoran_fh *fh = file->private_data;
398 struct zoran *zr = fh->zr; 390 struct zoran *zr = fh->zr;
399 int i, j, off; 391 int i, j, off;
400 unsigned char *mem; 392 unsigned char *mem;
@@ -492,11 +484,8 @@ zoran_v4l_set_format (struct zoran_fh *fh,
492 return 0; 484 return 0;
493} 485}
494 486
495static int 487static int zoran_v4l_queue_frame(struct zoran_fh *fh, int num)
496zoran_v4l_queue_frame (struct file *file,
497 int num)
498{ 488{
499 struct zoran_fh *fh = file->private_data;
500 struct zoran *zr = fh->zr; 489 struct zoran *zr = fh->zr;
501 unsigned long flags; 490 unsigned long flags;
502 int res = 0; 491 int res = 0;
@@ -574,11 +563,8 @@ zoran_v4l_queue_frame (struct file *file,
574 * Sync on a V4L buffer 563 * Sync on a V4L buffer
575 */ 564 */
576 565
577static int 566static int v4l_sync(struct zoran_fh *fh, int frame)
578v4l_sync (struct file *file,
579 int frame)
580{ 567{
581 struct zoran_fh *fh = file->private_data;
582 struct zoran *zr = fh->zr; 568 struct zoran *zr = fh->zr;
583 unsigned long flags; 569 unsigned long flags;
584 570
@@ -643,12 +629,9 @@ v4l_sync (struct file *file,
643 * Queue a MJPEG buffer for capture/playback 629 * Queue a MJPEG buffer for capture/playback
644 */ 630 */
645 631
646static int 632static int zoran_jpg_queue_frame(struct zoran_fh *fh, int num,
647zoran_jpg_queue_frame (struct file *file, 633 enum zoran_codec_mode mode)
648 int num,
649 enum zoran_codec_mode mode)
650{ 634{
651 struct zoran_fh *fh = file->private_data;
652 struct zoran *zr = fh->zr; 635 struct zoran *zr = fh->zr;
653 unsigned long flags; 636 unsigned long flags;
654 int res = 0; 637 int res = 0;
@@ -738,12 +721,8 @@ zoran_jpg_queue_frame (struct file *file,
738 return res; 721 return res;
739} 722}
740 723
741static int 724static int jpg_qbuf(struct zoran_fh *fh, int frame, enum zoran_codec_mode mode)
742jpg_qbuf (struct file *file,
743 int frame,
744 enum zoran_codec_mode mode)
745{ 725{
746 struct zoran_fh *fh = file->private_data;
747 struct zoran *zr = fh->zr; 726 struct zoran *zr = fh->zr;
748 int res = 0; 727 int res = 0;
749 728
@@ -770,7 +749,7 @@ jpg_qbuf (struct file *file,
770 } 749 }
771 } 750 }
772 751
773 if ((res = zoran_jpg_queue_frame(file, frame, mode))) 752 if ((res = zoran_jpg_queue_frame(fh, frame, mode)))
774 return res; 753 return res;
775 754
776 /* Start the jpeg codec when the first frame is queued */ 755 /* Start the jpeg codec when the first frame is queued */
@@ -784,11 +763,8 @@ jpg_qbuf (struct file *file,
784 * Sync on a MJPEG buffer 763 * Sync on a MJPEG buffer
785 */ 764 */
786 765
787static int 766static int jpg_sync(struct zoran_fh *fh, struct zoran_sync *bs)
788jpg_sync (struct file *file,
789 struct zoran_sync *bs)
790{ 767{
791 struct zoran_fh *fh = file->private_data;
792 struct zoran *zr = fh->zr; 768 struct zoran *zr = fh->zr;
793 unsigned long flags; 769 unsigned long flags;
794 int frame; 770 int frame;
@@ -852,11 +828,9 @@ jpg_sync (struct file *file,
852 return 0; 828 return 0;
853} 829}
854 830
855static void 831static void zoran_open_init_session(struct zoran_fh *fh)
856zoran_open_init_session (struct file *file)
857{ 832{
858 int i; 833 int i;
859 struct zoran_fh *fh = file->private_data;
860 struct zoran *zr = fh->zr; 834 struct zoran *zr = fh->zr;
861 835
862 /* Per default, map the V4L Buffers */ 836 /* Per default, map the V4L Buffers */
@@ -883,10 +857,8 @@ zoran_open_init_session (struct file *file)
883 fh->buffers.active = ZORAN_FREE; 857 fh->buffers.active = ZORAN_FREE;
884} 858}
885 859
886static void 860static void zoran_close_end_session(struct zoran_fh *fh)
887zoran_close_end_session (struct file *file)
888{ 861{
889 struct zoran_fh *fh = file->private_data;
890 struct zoran *zr = fh->zr; 862 struct zoran *zr = fh->zr;
891 863
892 /* overlay */ 864 /* overlay */
@@ -912,7 +884,7 @@ zoran_close_end_session (struct file *file)
912 884
913 /* v4l buffers */ 885 /* v4l buffers */
914 if (fh->buffers.allocated) 886 if (fh->buffers.allocated)
915 v4l_fbuffer_free(file); 887 v4l_fbuffer_free(fh);
916 } else { 888 } else {
917 /* jpg capture */ 889 /* jpg capture */
918 if (fh->buffers.active != ZORAN_FREE) { 890 if (fh->buffers.active != ZORAN_FREE) {
@@ -923,7 +895,7 @@ zoran_close_end_session (struct file *file)
923 895
924 /* jpg buffers */ 896 /* jpg buffers */
925 if (fh->buffers.allocated) 897 if (fh->buffers.allocated)
926 jpg_fbuffer_free(file); 898 jpg_fbuffer_free(fh);
927 } 899 }
928} 900}
929 901
@@ -989,7 +961,7 @@ static int zoran_open(struct file *file)
989 /* set file_ops stuff */ 961 /* set file_ops stuff */
990 file->private_data = fh; 962 file->private_data = fh;
991 fh->zr = zr; 963 fh->zr = zr;
992 zoran_open_init_session(file); 964 zoran_open_init_session(fh);
993 unlock_kernel(); 965 unlock_kernel();
994 966
995 return 0; 967 return 0;
@@ -1018,7 +990,7 @@ zoran_close(struct file *file)
1018 * (prevents deadlocks) */ 990 * (prevents deadlocks) */
1019 /*mutex_lock(&zr->resource_lock);*/ 991 /*mutex_lock(&zr->resource_lock);*/
1020 992
1021 zoran_close_end_session(file); 993 zoran_close_end_session(fh);
1022 994
1023 if (zr->user-- == 1) { /* Last process */ 995 if (zr->user-- == 1) { /* Last process */
1024 /* Clean up JPEG process */ 996 /* Clean up JPEG process */
@@ -1085,15 +1057,13 @@ zoran_write (struct file *file,
1085 return -EINVAL; 1057 return -EINVAL;
1086} 1058}
1087 1059
1088static int 1060static int setup_fbuffer(struct zoran_fh *fh,
1089setup_fbuffer (struct file *file,
1090 void *base, 1061 void *base,
1091 const struct zoran_format *fmt, 1062 const struct zoran_format *fmt,
1092 int width, 1063 int width,
1093 int height, 1064 int height,
1094 int bytesperline) 1065 int bytesperline)
1095{ 1066{
1096 struct zoran_fh *fh = file->private_data;
1097 struct zoran *zr = fh->zr; 1067 struct zoran *zr = fh->zr;
1098 1068
1099 /* (Ronald) v4l/v4l2 guidelines */ 1069 /* (Ronald) v4l/v4l2 guidelines */
@@ -1163,17 +1133,9 @@ setup_fbuffer (struct file *file,
1163} 1133}
1164 1134
1165 1135
1166static int 1136static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height,
1167setup_window (struct file *file, 1137 struct v4l2_clip __user *clips, int clipcount, void __user *bitmap)
1168 int x,
1169 int y,
1170 int width,
1171 int height,
1172 struct v4l2_clip __user *clips,
1173 int clipcount,
1174 void __user *bitmap)
1175{ 1138{
1176 struct zoran_fh *fh = file->private_data;
1177 struct zoran *zr = fh->zr; 1139 struct zoran *zr = fh->zr;
1178 struct v4l2_clip *vcp = NULL; 1140 struct v4l2_clip *vcp = NULL;
1179 int on, end; 1141 int on, end;
@@ -1273,7 +1235,7 @@ setup_window (struct file *file,
1273 vfree(vcp); 1235 vfree(vcp);
1274 return -EFAULT; 1236 return -EFAULT;
1275 } 1237 }
1276 write_overlay_mask(file, vcp, clipcount); 1238 write_overlay_mask(fh, vcp, clipcount);
1277 vfree(vcp); 1239 vfree(vcp);
1278 } 1240 }
1279 1241
@@ -1289,11 +1251,8 @@ setup_window (struct file *file,
1289 return wait_grab_pending(zr); 1251 return wait_grab_pending(zr);
1290} 1252}
1291 1253
1292static int 1254static int setup_overlay(struct zoran_fh *fh, int on)
1293setup_overlay (struct file *file,
1294 int on)
1295{ 1255{
1296 struct zoran_fh *fh = file->private_data;
1297 struct zoran *zr = fh->zr; 1256 struct zoran *zr = fh->zr;
1298 1257
1299 /* If there is nothing to do, return immediatly */ 1258 /* If there is nothing to do, return immediatly */
@@ -1356,11 +1315,9 @@ setup_overlay (struct file *file,
1356 return wait_grab_pending(zr); 1315 return wait_grab_pending(zr);
1357} 1316}
1358 1317
1359 /* get the status of a buffer in the clients buffer queue */ 1318/* get the status of a buffer in the clients buffer queue */
1360static int 1319static int zoran_v4l2_buffer_status(struct zoran_fh *fh,
1361zoran_v4l2_buffer_status (struct zoran_fh *fh, 1320 struct v4l2_buffer *buf, int num)
1362 struct v4l2_buffer *buf,
1363 int num)
1364{ 1321{
1365 struct zoran *zr = fh->zr; 1322 struct zoran *zr = fh->zr;
1366 unsigned long flags; 1323 unsigned long flags;
@@ -1727,7 +1684,7 @@ sparams_unlock_and_return:
1727 fh->buffers.num_buffers = breq->count; 1684 fh->buffers.num_buffers = breq->count;
1728 fh->buffers.buffer_size = breq->size; 1685 fh->buffers.buffer_size = breq->size;
1729 1686
1730 if (jpg_fbuffer_alloc(file)) { 1687 if (jpg_fbuffer_alloc(fh)) {
1731 res = -ENOMEM; 1688 res = -ENOMEM;
1732 goto jpgreqbuf_unlock_and_return; 1689 goto jpgreqbuf_unlock_and_return;
1733 } 1690 }
@@ -1746,7 +1703,7 @@ jpgreqbuf_unlock_and_return:
1746 ZR_DEVNAME(zr), *frame); 1703 ZR_DEVNAME(zr), *frame);
1747 1704
1748 mutex_lock(&zr->resource_lock); 1705 mutex_lock(&zr->resource_lock);
1749 res = jpg_qbuf(file, *frame, BUZ_MODE_MOTION_COMPRESS); 1706 res = jpg_qbuf(fh, *frame, BUZ_MODE_MOTION_COMPRESS);
1750 mutex_unlock(&zr->resource_lock); 1707 mutex_unlock(&zr->resource_lock);
1751 1708
1752 return res; 1709 return res;
@@ -1760,7 +1717,7 @@ jpgreqbuf_unlock_and_return:
1760 ZR_DEVNAME(zr), *frame); 1717 ZR_DEVNAME(zr), *frame);
1761 1718
1762 mutex_lock(&zr->resource_lock); 1719 mutex_lock(&zr->resource_lock);
1763 res = jpg_qbuf(file, *frame, BUZ_MODE_MOTION_DECOMPRESS); 1720 res = jpg_qbuf(fh, *frame, BUZ_MODE_MOTION_DECOMPRESS);
1764 mutex_unlock(&zr->resource_lock); 1721 mutex_unlock(&zr->resource_lock);
1765 1722
1766 return res; 1723 return res;
@@ -1781,7 +1738,7 @@ jpgreqbuf_unlock_and_return:
1781 ZR_DEVNAME(zr), __func__); 1738 ZR_DEVNAME(zr), __func__);
1782 res = -EINVAL; 1739 res = -EINVAL;
1783 } else { 1740 } else {
1784 res = jpg_sync(file, bsync); 1741 res = jpg_sync(fh, bsync);
1785 } 1742 }
1786 mutex_unlock(&zr->resource_lock); 1743 mutex_unlock(&zr->resource_lock);
1787 1744
@@ -1876,7 +1833,7 @@ static int zoran_vidiocgmbuf(struct file *file, void *__fh, struct video_mbuf *v
1876 /* The next mmap will map the V4L buffers */ 1833 /* The next mmap will map the V4L buffers */
1877 map_mode_raw(fh); 1834 map_mode_raw(fh);
1878 1835
1879 if (v4l_fbuffer_alloc(file)) { 1836 if (v4l_fbuffer_alloc(fh)) {
1880 res = -ENOMEM; 1837 res = -ENOMEM;
1881 goto v4l1reqbuf_unlock_and_return; 1838 goto v4l1reqbuf_unlock_and_return;
1882 } 1839 }
@@ -2168,14 +2125,10 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh,
2168 fmt->fmt.win.clipcount, 2125 fmt->fmt.win.clipcount,
2169 fmt->fmt.win.bitmap); 2126 fmt->fmt.win.bitmap);
2170 mutex_lock(&zr->resource_lock); 2127 mutex_lock(&zr->resource_lock);
2171 res = setup_window(file, fmt->fmt.win.w.left, 2128 res = setup_window(fh, fmt->fmt.win.w.left, fmt->fmt.win.w.top,
2172 fmt->fmt.win.w.top, 2129 fmt->fmt.win.w.width, fmt->fmt.win.w.height,
2173 fmt->fmt.win.w.width, 2130 (struct v4l2_clip __user *)fmt->fmt.win.clips,
2174 fmt->fmt.win.w.height, 2131 fmt->fmt.win.clipcount, fmt->fmt.win.bitmap);
2175 (struct v4l2_clip __user *)
2176 fmt->fmt.win.clips,
2177 fmt->fmt.win.clipcount,
2178 fmt->fmt.win.bitmap);
2179 mutex_unlock(&zr->resource_lock); 2132 mutex_unlock(&zr->resource_lock);
2180 return res; 2133 return res;
2181} 2134}
@@ -2363,9 +2316,8 @@ static int zoran_s_fbuf(struct file *file, void *__fh,
2363 } 2316 }
2364 2317
2365 mutex_lock(&zr->resource_lock); 2318 mutex_lock(&zr->resource_lock);
2366 res = setup_fbuffer(file, fb->base, &zoran_formats[i], 2319 res = setup_fbuffer(fh, fb->base, &zoran_formats[i], fb->fmt.width,
2367 fb->fmt.width, fb->fmt.height, 2320 fb->fmt.height, fb->fmt.bytesperline);
2368 fb->fmt.bytesperline);
2369 mutex_unlock(&zr->resource_lock); 2321 mutex_unlock(&zr->resource_lock);
2370 2322
2371 return res; 2323 return res;
@@ -2378,7 +2330,7 @@ static int zoran_overlay(struct file *file, void *__fh, unsigned int on)
2378 int res; 2330 int res;
2379 2331
2380 mutex_lock(&zr->resource_lock); 2332 mutex_lock(&zr->resource_lock);
2381 res = setup_overlay(file, on); 2333 res = setup_overlay(fh, on);
2382 mutex_unlock(&zr->resource_lock); 2334 mutex_unlock(&zr->resource_lock);
2383 2335
2384 return res; 2336 return res;
@@ -2425,7 +2377,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe
2425 map_mode_raw(fh); 2377 map_mode_raw(fh);
2426 fh->buffers.num_buffers = req->count; 2378 fh->buffers.num_buffers = req->count;
2427 2379
2428 if (v4l_fbuffer_alloc(file)) { 2380 if (v4l_fbuffer_alloc(fh)) {
2429 res = -ENOMEM; 2381 res = -ENOMEM;
2430 goto v4l2reqbuf_unlock_and_return; 2382 goto v4l2reqbuf_unlock_and_return;
2431 } 2383 }
@@ -2442,7 +2394,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe
2442 fh->buffers.num_buffers = req->count; 2394 fh->buffers.num_buffers = req->count;
2443 fh->buffers.buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings); 2395 fh->buffers.buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings);
2444 2396
2445 if (jpg_fbuffer_alloc(file)) { 2397 if (jpg_fbuffer_alloc(fh)) {
2446 res = -ENOMEM; 2398 res = -ENOMEM;
2447 goto v4l2reqbuf_unlock_and_return; 2399 goto v4l2reqbuf_unlock_and_return;
2448 } 2400 }
@@ -2491,7 +2443,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
2491 goto qbuf_unlock_and_return; 2443 goto qbuf_unlock_and_return;
2492 } 2444 }
2493 2445
2494 res = zoran_v4l_queue_frame(file, buf->index); 2446 res = zoran_v4l_queue_frame(fh, buf->index);
2495 if (res) 2447 if (res)
2496 goto qbuf_unlock_and_return; 2448 goto qbuf_unlock_and_return;
2497 if (!zr->v4l_memgrab_active && fh->buffers.active == ZORAN_LOCKED) 2449 if (!zr->v4l_memgrab_active && fh->buffers.active == ZORAN_LOCKED)
@@ -2516,8 +2468,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
2516 goto qbuf_unlock_and_return; 2468 goto qbuf_unlock_and_return;
2517 } 2469 }
2518 2470
2519 res = zoran_jpg_queue_frame(file, buf->index, 2471 res = zoran_jpg_queue_frame(fh, buf->index, codec_mode);
2520 codec_mode);
2521 if (res != 0) 2472 if (res != 0)
2522 goto qbuf_unlock_and_return; 2473 goto qbuf_unlock_and_return;
2523 if (zr->codec_mode == BUZ_MODE_IDLE && 2474 if (zr->codec_mode == BUZ_MODE_IDLE &&
@@ -2563,7 +2514,7 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
2563 res = -EAGAIN; 2514 res = -EAGAIN;
2564 goto dqbuf_unlock_and_return; 2515 goto dqbuf_unlock_and_return;
2565 } 2516 }
2566 res = v4l_sync(file, num); 2517 res = v4l_sync(fh, num);
2567 if (res) 2518 if (res)
2568 goto dqbuf_unlock_and_return; 2519 goto dqbuf_unlock_and_return;
2569 zr->v4l_sync_tail++; 2520 zr->v4l_sync_tail++;
@@ -2595,7 +2546,7 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
2595 res = -EAGAIN; 2546 res = -EAGAIN;
2596 goto dqbuf_unlock_and_return; 2547 goto dqbuf_unlock_and_return;
2597 } 2548 }
2598 res = jpg_sync(file, &bs); 2549 res = jpg_sync(fh, &bs);
2599 if (res) 2550 if (res)
2600 goto dqbuf_unlock_and_return; 2551 goto dqbuf_unlock_and_return;
2601 res = zoran_v4l2_buffer_status(fh, buf, bs.frame); 2552 res = zoran_v4l2_buffer_status(fh, buf, bs.frame);
@@ -2722,7 +2673,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typ
2722 if (zr->jpg_buffers.active == ZORAN_FREE) 2673 if (zr->jpg_buffers.active == ZORAN_FREE)
2723 goto strmoff_unlock_and_return; 2674 goto strmoff_unlock_and_return;
2724 2675
2725 res = jpg_qbuf(file, -1, 2676 res = jpg_qbuf(fh, -1,
2726 (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) ? 2677 (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) ?
2727 BUZ_MODE_MOTION_COMPRESS : 2678 BUZ_MODE_MOTION_COMPRESS :
2728 BUZ_MODE_MOTION_DECOMPRESS); 2679 BUZ_MODE_MOTION_DECOMPRESS);
@@ -3185,8 +3136,7 @@ static void
3185zoran_vm_close (struct vm_area_struct *vma) 3136zoran_vm_close (struct vm_area_struct *vma)
3186{ 3137{
3187 struct zoran_mapping *map = vma->vm_private_data; 3138 struct zoran_mapping *map = vma->vm_private_data;
3188 struct file *file = map->file; 3139 struct zoran_fh *fh = map->file->private_data;
3189 struct zoran_fh *fh = file->private_data;
3190 struct zoran *zr = fh->zr; 3140 struct zoran *zr = fh->zr;
3191 int i; 3141 int i;
3192 3142
@@ -3222,14 +3172,14 @@ zoran_vm_close (struct vm_area_struct *vma)
3222 zr->v4l_buffers.active = fh->buffers.active = ZORAN_FREE; 3172 zr->v4l_buffers.active = fh->buffers.active = ZORAN_FREE;
3223 spin_unlock_irqrestore(&zr->spinlock, flags); 3173 spin_unlock_irqrestore(&zr->spinlock, flags);
3224 } 3174 }
3225 v4l_fbuffer_free(file); 3175 v4l_fbuffer_free(fh);
3226 } else { 3176 } else {
3227 if (fh->buffers.active != ZORAN_FREE) { 3177 if (fh->buffers.active != ZORAN_FREE) {
3228 jpg_qbuf(file, -1, zr->codec_mode); 3178 jpg_qbuf(fh, -1, zr->codec_mode);
3229 zr->jpg_buffers.allocated = 0; 3179 zr->jpg_buffers.allocated = 0;
3230 zr->jpg_buffers.active = fh->buffers.active = ZORAN_FREE; 3180 zr->jpg_buffers.active = fh->buffers.active = ZORAN_FREE;
3231 } 3181 }
3232 jpg_fbuffer_free(file); 3182 jpg_fbuffer_free(fh);
3233 } 3183 }
3234 3184
3235 mutex_unlock(&zr->resource_lock); 3185 mutex_unlock(&zr->resource_lock);