Commit e5ee3f64 authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab

V4L/DVB (10933): zoran: Pass zoran_fh pointers instead of file pointers

Many functions had a struct file pointer argument, but all they wants is
the struct zoran_fh pointer from the file's private data.  Since every
caller of those functions already has the zoran_fh, just pass the that
instead.  This saves a dereference in each function change.

While I'm at it, change the code formatting of affected functions to be
kernel standard style.
Signed-off-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ee9a9d66
...@@ -535,12 +535,8 @@ zr36057_overlay (struct zoran *zr, ...@@ -535,12 +535,8 @@ zr36057_overlay (struct zoran *zr,
* and the maximum window size is BUZ_MAX_WIDTH * BUZ_MAX_HEIGHT pixels. * and the maximum window size is BUZ_MAX_WIDTH * BUZ_MAX_HEIGHT pixels.
*/ */
void void write_overlay_mask(struct zoran_fh *fh, struct v4l2_clip *vp, int count)
write_overlay_mask (struct file *file,
struct v4l2_clip *vp,
int count)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
unsigned mask_line_size = (BUZ_MAX_WIDTH + 31) / 32; unsigned mask_line_size = (BUZ_MAX_WIDTH + 31) / 32;
u32 *mask; u32 *mask;
......
...@@ -54,7 +54,7 @@ extern int jpeg_codec_reset(struct zoran *zr); ...@@ -54,7 +54,7 @@ extern int jpeg_codec_reset(struct zoran *zr);
/* zr360x7 access to raw capture */ /* zr360x7 access to raw capture */
extern void zr36057_overlay(struct zoran *zr, extern void zr36057_overlay(struct zoran *zr,
int on); int on);
extern void write_overlay_mask(struct file *file, extern void write_overlay_mask(struct zoran_fh *fh,
struct v4l2_clip *vp, struct v4l2_clip *vp,
int count); int count);
extern void zr36057_set_memgrab(struct zoran *zr, extern void zr36057_set_memgrab(struct zoran *zr,
......
...@@ -186,8 +186,8 @@ zoran_v4l2_calc_bufsize (struct zoran_jpg_settings *settings) ...@@ -186,8 +186,8 @@ zoran_v4l2_calc_bufsize (struct zoran_jpg_settings *settings)
} }
/* forward references */ /* forward references */
static void v4l_fbuffer_free(struct file *file); static void v4l_fbuffer_free(struct zoran_fh *fh);
static void jpg_fbuffer_free(struct file *file); static void jpg_fbuffer_free(struct zoran_fh *fh);
/* Set mapping mode */ /* Set mapping mode */
static void map_mode_raw(struct zoran_fh *fh) static void map_mode_raw(struct zoran_fh *fh)
...@@ -213,10 +213,8 @@ static inline const char *mode_name(enum zoran_map_mode mode) ...@@ -213,10 +213,8 @@ static inline const char *mode_name(enum zoran_map_mode mode)
* These have to be pysically contiguous. * These have to be pysically contiguous.
*/ */
static int static int v4l_fbuffer_alloc(struct zoran_fh *fh)
v4l_fbuffer_alloc (struct file *file)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
int i, off; int i, off;
unsigned char *mem; unsigned char *mem;
...@@ -236,7 +234,7 @@ v4l_fbuffer_alloc (struct file *file) ...@@ -236,7 +234,7 @@ v4l_fbuffer_alloc (struct file *file)
KERN_ERR KERN_ERR
"%s: v4l_fbuffer_alloc() - kmalloc for V4L buf %d failed\n", "%s: v4l_fbuffer_alloc() - kmalloc for V4L buf %d failed\n",
ZR_DEVNAME(zr), i); ZR_DEVNAME(zr), i);
v4l_fbuffer_free(file); v4l_fbuffer_free(fh);
return -ENOBUFS; return -ENOBUFS;
} }
fh->buffers.buffer[i].v4l.fbuffer = mem; fh->buffers.buffer[i].v4l.fbuffer = mem;
...@@ -258,10 +256,8 @@ v4l_fbuffer_alloc (struct file *file) ...@@ -258,10 +256,8 @@ v4l_fbuffer_alloc (struct file *file)
} }
/* free the V4L grab buffers */ /* free the V4L grab buffers */
static void static void v4l_fbuffer_free(struct zoran_fh *fh)
v4l_fbuffer_free (struct file *file)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
int i, off; int i, off;
unsigned char *mem; unsigned char *mem;
...@@ -311,10 +307,8 @@ v4l_fbuffer_free (struct file *file) ...@@ -311,10 +307,8 @@ v4l_fbuffer_free (struct file *file)
* and fragment buffers are not little-endian. * and fragment buffers are not little-endian.
*/ */
static int static int jpg_fbuffer_alloc(struct zoran_fh *fh)
jpg_fbuffer_alloc (struct file *file)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
int i, j, off; int i, j, off;
u8 *mem; u8 *mem;
...@@ -334,7 +328,7 @@ jpg_fbuffer_alloc (struct file *file) ...@@ -334,7 +328,7 @@ jpg_fbuffer_alloc (struct file *file)
KERN_ERR KERN_ERR
"%s: jpg_fbuffer_alloc() - get_zeroed_page (frag_tab) failed for buffer %d\n", "%s: jpg_fbuffer_alloc() - get_zeroed_page (frag_tab) failed for buffer %d\n",
ZR_DEVNAME(zr), i); ZR_DEVNAME(zr), i);
jpg_fbuffer_free(file); jpg_fbuffer_free(fh);
return -ENOBUFS; return -ENOBUFS;
} }
fh->buffers.buffer[i].jpg.frag_tab = (__le32 *)mem; fh->buffers.buffer[i].jpg.frag_tab = (__le32 *)mem;
...@@ -347,7 +341,7 @@ jpg_fbuffer_alloc (struct file *file) ...@@ -347,7 +341,7 @@ jpg_fbuffer_alloc (struct file *file)
KERN_ERR KERN_ERR
"%s: jpg_fbuffer_alloc() - kmalloc failed for buffer %d\n", "%s: jpg_fbuffer_alloc() - kmalloc failed for buffer %d\n",
ZR_DEVNAME(zr), i); ZR_DEVNAME(zr), i);
jpg_fbuffer_free(file); jpg_fbuffer_free(fh);
return -ENOBUFS; return -ENOBUFS;
} }
fh->buffers.buffer[i].jpg.frag_tab[0] = fh->buffers.buffer[i].jpg.frag_tab[0] =
...@@ -365,7 +359,7 @@ jpg_fbuffer_alloc (struct file *file) ...@@ -365,7 +359,7 @@ jpg_fbuffer_alloc (struct file *file)
KERN_ERR KERN_ERR
"%s: jpg_fbuffer_alloc() - get_zeroed_page failed for buffer %d\n", "%s: jpg_fbuffer_alloc() - get_zeroed_page failed for buffer %d\n",
ZR_DEVNAME(zr), i); ZR_DEVNAME(zr), i);
jpg_fbuffer_free(file); jpg_fbuffer_free(fh);
return -ENOBUFS; return -ENOBUFS;
} }
...@@ -391,10 +385,8 @@ jpg_fbuffer_alloc (struct file *file) ...@@ -391,10 +385,8 @@ jpg_fbuffer_alloc (struct file *file)
} }
/* free the MJPEG grab buffers */ /* free the MJPEG grab buffers */
static void static void jpg_fbuffer_free(struct zoran_fh *fh)
jpg_fbuffer_free (struct file *file)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
int i, j, off; int i, j, off;
unsigned char *mem; unsigned char *mem;
...@@ -492,11 +484,8 @@ zoran_v4l_set_format (struct zoran_fh *fh, ...@@ -492,11 +484,8 @@ zoran_v4l_set_format (struct zoran_fh *fh,
return 0; return 0;
} }
static int static int zoran_v4l_queue_frame(struct zoran_fh *fh, int num)
zoran_v4l_queue_frame (struct file *file,
int num)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
unsigned long flags; unsigned long flags;
int res = 0; int res = 0;
...@@ -574,11 +563,8 @@ zoran_v4l_queue_frame (struct file *file, ...@@ -574,11 +563,8 @@ zoran_v4l_queue_frame (struct file *file,
* Sync on a V4L buffer * Sync on a V4L buffer
*/ */
static int static int v4l_sync(struct zoran_fh *fh, int frame)
v4l_sync (struct file *file,
int frame)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
unsigned long flags; unsigned long flags;
...@@ -643,12 +629,9 @@ v4l_sync (struct file *file, ...@@ -643,12 +629,9 @@ v4l_sync (struct file *file,
* Queue a MJPEG buffer for capture/playback * Queue a MJPEG buffer for capture/playback
*/ */
static int static int zoran_jpg_queue_frame(struct zoran_fh *fh, int num,
zoran_jpg_queue_frame (struct file *file, enum zoran_codec_mode mode)
int num,
enum zoran_codec_mode mode)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
unsigned long flags; unsigned long flags;
int res = 0; int res = 0;
...@@ -738,12 +721,8 @@ zoran_jpg_queue_frame (struct file *file, ...@@ -738,12 +721,8 @@ zoran_jpg_queue_frame (struct file *file,
return res; return res;
} }
static int static int jpg_qbuf(struct zoran_fh *fh, int frame, enum zoran_codec_mode mode)
jpg_qbuf (struct file *file,
int frame,
enum zoran_codec_mode mode)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
int res = 0; int res = 0;
...@@ -770,7 +749,7 @@ jpg_qbuf (struct file *file, ...@@ -770,7 +749,7 @@ jpg_qbuf (struct file *file,
} }
} }
if ((res = zoran_jpg_queue_frame(file, frame, mode))) if ((res = zoran_jpg_queue_frame(fh, frame, mode)))
return res; return res;
/* Start the jpeg codec when the first frame is queued */ /* Start the jpeg codec when the first frame is queued */
...@@ -784,11 +763,8 @@ jpg_qbuf (struct file *file, ...@@ -784,11 +763,8 @@ jpg_qbuf (struct file *file,
* Sync on a MJPEG buffer * Sync on a MJPEG buffer
*/ */
static int static int jpg_sync(struct zoran_fh *fh, struct zoran_sync *bs)
jpg_sync (struct file *file,
struct zoran_sync *bs)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
unsigned long flags; unsigned long flags;
int frame; int frame;
...@@ -852,11 +828,9 @@ jpg_sync (struct file *file, ...@@ -852,11 +828,9 @@ jpg_sync (struct file *file,
return 0; return 0;
} }
static void static void zoran_open_init_session(struct zoran_fh *fh)
zoran_open_init_session (struct file *file)
{ {
int i; int i;
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
/* Per default, map the V4L Buffers */ /* Per default, map the V4L Buffers */
...@@ -883,10 +857,8 @@ zoran_open_init_session (struct file *file) ...@@ -883,10 +857,8 @@ zoran_open_init_session (struct file *file)
fh->buffers.active = ZORAN_FREE; fh->buffers.active = ZORAN_FREE;
} }
static void static void zoran_close_end_session(struct zoran_fh *fh)
zoran_close_end_session (struct file *file)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
/* overlay */ /* overlay */
...@@ -912,7 +884,7 @@ zoran_close_end_session (struct file *file) ...@@ -912,7 +884,7 @@ zoran_close_end_session (struct file *file)
/* v4l buffers */ /* v4l buffers */
if (fh->buffers.allocated) if (fh->buffers.allocated)
v4l_fbuffer_free(file); v4l_fbuffer_free(fh);
} else { } else {
/* jpg capture */ /* jpg capture */
if (fh->buffers.active != ZORAN_FREE) { if (fh->buffers.active != ZORAN_FREE) {
...@@ -923,7 +895,7 @@ zoran_close_end_session (struct file *file) ...@@ -923,7 +895,7 @@ zoran_close_end_session (struct file *file)
/* jpg buffers */ /* jpg buffers */
if (fh->buffers.allocated) if (fh->buffers.allocated)
jpg_fbuffer_free(file); jpg_fbuffer_free(fh);
} }
} }
...@@ -989,7 +961,7 @@ static int zoran_open(struct file *file) ...@@ -989,7 +961,7 @@ static int zoran_open(struct file *file)
/* set file_ops stuff */ /* set file_ops stuff */
file->private_data = fh; file->private_data = fh;
fh->zr = zr; fh->zr = zr;
zoran_open_init_session(file); zoran_open_init_session(fh);
unlock_kernel(); unlock_kernel();
return 0; return 0;
...@@ -1018,7 +990,7 @@ zoran_close(struct file *file) ...@@ -1018,7 +990,7 @@ zoran_close(struct file *file)
* (prevents deadlocks) */ * (prevents deadlocks) */
/*mutex_lock(&zr->resource_lock);*/ /*mutex_lock(&zr->resource_lock);*/
zoran_close_end_session(file); zoran_close_end_session(fh);
if (zr->user-- == 1) { /* Last process */ if (zr->user-- == 1) { /* Last process */
/* Clean up JPEG process */ /* Clean up JPEG process */
...@@ -1085,15 +1057,13 @@ zoran_write (struct file *file, ...@@ -1085,15 +1057,13 @@ zoran_write (struct file *file,
return -EINVAL; return -EINVAL;
} }
static int static int setup_fbuffer(struct zoran_fh *fh,
setup_fbuffer (struct file *file,
void *base, void *base,
const struct zoran_format *fmt, const struct zoran_format *fmt,
int width, int width,
int height, int height,
int bytesperline) int bytesperline)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
/* (Ronald) v4l/v4l2 guidelines */ /* (Ronald) v4l/v4l2 guidelines */
...@@ -1163,17 +1133,9 @@ setup_fbuffer (struct file *file, ...@@ -1163,17 +1133,9 @@ setup_fbuffer (struct file *file,
} }
static int static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height,
setup_window (struct file *file, struct v4l2_clip __user *clips, int clipcount, void __user *bitmap)
int x,
int y,
int width,
int height,
struct v4l2_clip __user *clips,
int clipcount,
void __user *bitmap)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
struct v4l2_clip *vcp = NULL; struct v4l2_clip *vcp = NULL;
int on, end; int on, end;
...@@ -1273,7 +1235,7 @@ setup_window (struct file *file, ...@@ -1273,7 +1235,7 @@ setup_window (struct file *file,
vfree(vcp); vfree(vcp);
return -EFAULT; return -EFAULT;
} }
write_overlay_mask(file, vcp, clipcount); write_overlay_mask(fh, vcp, clipcount);
vfree(vcp); vfree(vcp);
} }
...@@ -1289,11 +1251,8 @@ setup_window (struct file *file, ...@@ -1289,11 +1251,8 @@ setup_window (struct file *file,
return wait_grab_pending(zr); return wait_grab_pending(zr);
} }
static int static int setup_overlay(struct zoran_fh *fh, int on)
setup_overlay (struct file *file,
int on)
{ {
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
/* If there is nothing to do, return immediatly */ /* If there is nothing to do, return immediatly */
...@@ -1356,11 +1315,9 @@ setup_overlay (struct file *file, ...@@ -1356,11 +1315,9 @@ setup_overlay (struct file *file,
return wait_grab_pending(zr); return wait_grab_pending(zr);
} }
/* get the status of a buffer in the clients buffer queue */ /* get the status of a buffer in the clients buffer queue */
static int static int zoran_v4l2_buffer_status(struct zoran_fh *fh,
zoran_v4l2_buffer_status (struct zoran_fh *fh, struct v4l2_buffer *buf, int num)
struct v4l2_buffer *buf,
int num)
{ {
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
unsigned long flags; unsigned long flags;
...@@ -1727,7 +1684,7 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) ...@@ -1727,7 +1684,7 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg)
fh->buffers.num_buffers = breq->count; fh->buffers.num_buffers = breq->count;
fh->buffers.buffer_size = breq->size; fh->buffers.buffer_size = breq->size;
if (jpg_fbuffer_alloc(file)) { if (jpg_fbuffer_alloc(fh)) {
res = -ENOMEM; res = -ENOMEM;
goto jpgreqbuf_unlock_and_return; goto jpgreqbuf_unlock_and_return;
} }
...@@ -1746,7 +1703,7 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) ...@@ -1746,7 +1703,7 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg)
ZR_DEVNAME(zr), *frame); ZR_DEVNAME(zr), *frame);
mutex_lock(&zr->resource_lock); mutex_lock(&zr->resource_lock);
res = jpg_qbuf(file, *frame, BUZ_MODE_MOTION_COMPRESS); res = jpg_qbuf(fh, *frame, BUZ_MODE_MOTION_COMPRESS);
mutex_unlock(&zr->resource_lock); mutex_unlock(&zr->resource_lock);
return res; return res;
...@@ -1760,7 +1717,7 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) ...@@ -1760,7 +1717,7 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg)
ZR_DEVNAME(zr), *frame); ZR_DEVNAME(zr), *frame);
mutex_lock(&zr->resource_lock); mutex_lock(&zr->resource_lock);
res = jpg_qbuf(file, *frame, BUZ_MODE_MOTION_DECOMPRESS); res = jpg_qbuf(fh, *frame, BUZ_MODE_MOTION_DECOMPRESS);
mutex_unlock(&zr->resource_lock); mutex_unlock(&zr->resource_lock);
return res; return res;
...@@ -1781,7 +1738,7 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) ...@@ -1781,7 +1738,7 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg)
ZR_DEVNAME(zr), __func__); ZR_DEVNAME(zr), __func__);
res = -EINVAL; res = -EINVAL;
} else { } else {
res = jpg_sync(file, bsync); res = jpg_sync(fh, bsync);
} }
mutex_unlock(&zr->resource_lock); mutex_unlock(&zr->resource_lock);
...@@ -1876,7 +1833,7 @@ static int zoran_vidiocgmbuf(struct file *file, void *__fh, struct video_mbuf *v ...@@ -1876,7 +1833,7 @@ static int zoran_vidiocgmbuf(struct file *file, void *__fh, struct video_mbuf *v
/* The next mmap will map the V4L buffers */ /* The next mmap will map the V4L buffers */
map_mode_raw(fh); map_mode_raw(fh);
if (v4l_fbuffer_alloc(file)) { if (v4l_fbuffer_alloc(fh)) {
res = -ENOMEM; res = -ENOMEM;
goto v4l1reqbuf_unlock_and_return; goto v4l1reqbuf_unlock_and_return;
} }
...@@ -2168,14 +2125,10 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh, ...@@ -2168,14 +2125,10 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh,
fmt->fmt.win.clipcount, fmt->fmt.win.clipcount,
fmt->fmt.win.bitmap); fmt->fmt.win.bitmap);
mutex_lock(&zr->resource_lock); mutex_lock(&zr->resource_lock);
res = setup_window(file, fmt->fmt.win.w.left, res = setup_window(fh, fmt->fmt.win.w.left, fmt->fmt.win.w.top,
fmt->fmt.win.w.top, fmt->fmt.win.w.width, fmt->fmt.win.w.height,
fmt->fmt.win.w.width, (struct v4l2_clip __user *)fmt->fmt.win.clips,
fmt->fmt.win.w.height, fmt->fmt.win.clipcount, fmt->fmt.win.bitmap);
(struct v4l2_clip __user *)
fmt->fmt.win.clips,
fmt->fmt.win.clipcount,
fmt->fmt.win.bitmap);
mutex_unlock(&zr->resource_lock); mutex_unlock(&zr->resource_lock);
return res; return res;
} }
...@@ -2363,9 +2316,8 @@ static int zoran_s_fbuf(struct file *file, void *__fh, ...@@ -2363,9 +2316,8 @@ static int zoran_s_fbuf(struct file *file, void *__fh,
} }
mutex_lock(&zr->resource_lock); mutex_lock(&zr->resource_lock);
res = setup_fbuffer(file, fb->base, &zoran_formats[i], res = setup_fbuffer(fh, fb->base, &zoran_formats[i], fb->fmt.width,
fb->fmt.width, fb->fmt.height, fb->fmt.height, fb->fmt.bytesperline);
fb->fmt.bytesperline);
mutex_unlock(&zr->resource_lock); mutex_unlock(&zr->resource_lock);
return res; return res;
...@@ -2378,7 +2330,7 @@ static int zoran_overlay(struct file *file, void *__fh, unsigned int on) ...@@ -2378,7 +2330,7 @@ static int zoran_overlay(struct file *file, void *__fh, unsigned int on)
int res; int res;
mutex_lock(&zr->resource_lock); mutex_lock(&zr->resource_lock);
res = setup_overlay(file, on); res = setup_overlay(fh, on);
mutex_unlock(&zr->resource_lock); mutex_unlock(&zr->resource_lock);
return res; return res;
...@@ -2425,7 +2377,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe ...@@ -2425,7 +2377,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe
map_mode_raw(fh); map_mode_raw(fh);
fh->buffers.num_buffers = req->count; fh->buffers.num_buffers = req->count;
if (v4l_fbuffer_alloc(file)) { if (v4l_fbuffer_alloc(fh)) {
res = -ENOMEM; res = -ENOMEM;
goto v4l2reqbuf_unlock_and_return; goto v4l2reqbuf_unlock_and_return;
} }
...@@ -2442,7 +2394,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe ...@@ -2442,7 +2394,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe
fh->buffers.num_buffers = req->count; fh->buffers.num_buffers = req->count;
fh->buffers.buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings); fh->buffers.buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings);
if (jpg_fbuffer_alloc(file)) { if (jpg_fbuffer_alloc(fh)) {
res = -ENOMEM; res = -ENOMEM;
goto v4l2reqbuf_unlock_and_return; goto v4l2reqbuf_unlock_and_return;
} }
...@@ -2491,7 +2443,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) ...@@ -2491,7 +2443,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
goto qbuf_unlock_and_return; goto qbuf_unlock_and_return;
} }
res = zoran_v4l_queue_frame(file, buf->index); res = zoran_v4l_queue_frame(fh, buf->index);
if (res) if (res)
goto qbuf_unlock_and_return; goto qbuf_unlock_and_return;
if (!zr->v4l_memgrab_active && fh->buffers.active == ZORAN_LOCKED) 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,8 +2468,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
goto qbuf_unlock_and_return; goto qbuf_unlock_and_return;
} }
res = zoran_jpg_queue_frame(file, buf->index, res = zoran_jpg_queue_frame(fh, buf->index, codec_mode);
codec_mode);
if (res != 0) if (res != 0)
goto qbuf_unlock_and_return; goto qbuf_unlock_and_return;
if (zr->codec_mode == BUZ_MODE_IDLE && 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,7 +2514,7 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
res = -EAGAIN; res = -EAGAIN;
goto dqbuf_unlock_and_return; goto dqbuf_unlock_and_return;
} }
res = v4l_sync(file, num); res = v4l_sync(fh, num);
if (res) if (res)
goto dqbuf_unlock_and_return; goto dqbuf_unlock_and_return;
zr->v4l_sync_tail++; zr->v4l_sync_tail++;
...@@ -2595,7 +2546,7 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) ...@@ -2595,7 +2546,7 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
res = -EAGAIN; res = -EAGAIN;
goto dqbuf_unlock_and_return; goto dqbuf_unlock_and_return;
} }
res = jpg_sync(file, &bs); res = jpg_sync(fh, &bs);
if (res) if (res)
goto dqbuf_unlock_and_return; goto dqbuf_unlock_and_return;
res = zoran_v4l2_buffer_status(fh, buf, bs.frame); 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,7 +2673,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typ
if (zr->jpg_buffers.active == ZORAN_FREE) if (zr->jpg_buffers.active == ZORAN_FREE)
goto strmoff_unlock_and_return; goto strmoff_unlock_and_return;
res = jpg_qbuf(file, -1, res = jpg_qbuf(fh, -1,
(fh->map_mode == ZORAN_MAP_MODE_JPG_REC) ? (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) ?
BUZ_MODE_MOTION_COMPRESS : BUZ_MODE_MOTION_COMPRESS :
BUZ_MODE_MOTION_DECOMPRESS); BUZ_MODE_MOTION_DECOMPRESS);
...@@ -3185,8 +3136,7 @@ static void ...@@ -3185,8 +3136,7 @@ static void
zoran_vm_close (struct vm_area_struct *vma) zoran_vm_close (struct vm_area_struct *vma)
{ {
struct zoran_mapping *map = vma->vm_private_data; struct zoran_mapping *map = vma->vm_private_data;
struct file *file = map->file; struct zoran_fh *fh = map->file->private_data;
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
int i; int i;
...@@ -3222,14 +3172,14 @@ zoran_vm_close (struct vm_area_struct *vma) ...@@ -3222,14 +3172,14 @@ zoran_vm_close (struct vm_area_struct *vma)
zr->v4l_buffers.active = fh->buffers.active = ZORAN_FREE; zr->v4l_buffers.active = fh->buffers.active = ZORAN_FREE;
spin_unlock_irqrestore(&zr->spinlock, flags); spin_unlock_irqrestore(&zr->spinlock, flags);
} }
v4l_fbuffer_free(file); v4l_fbuffer_free(fh);
} else { } else {
if (fh->buffers.active != ZORAN_FREE) { if (fh->buffers.active != ZORAN_FREE) {
jpg_qbuf(file, -1, zr->codec_mode); jpg_qbuf(fh, -1, zr->codec_mode);
zr->jpg_buffers.allocated = 0; zr->jpg_buffers.allocated = 0;
zr->jpg_buffers.active = fh->buffers.active = ZORAN_FREE; zr->jpg_buffers.active = fh->buffers.active = ZORAN_FREE;
} }
jpg_fbuffer_free(file); jpg_fbuffer_free(fh);
} }
mutex_unlock(&zr->resource_lock); mutex_unlock(&zr->resource_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment