summaryrefslogtreecommitdiff
path: root/drivers/media/video/cx88/cx88-video.c
diff options
context:
space:
mode:
authorAndreas Bombe <aeb@debian.org>2010-03-21 19:02:45 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 15:57:13 (GMT)
commitdab7e3106ddd6cbc3b55301228407b9d17ce7773 (patch)
tree1b6caa87522844e7ea8cc01932365201271f1afd /drivers/media/video/cx88/cx88-video.c
parent0a062033f727dc041691bfd768f4cf0598f559a1 (diff)
downloadlinux-fsl-qoriq-dab7e3106ddd6cbc3b55301228407b9d17ce7773.tar.xz
V4L/DVB: V4L2: Replace loops for finding max buffers in VIDIOC_REQBUFS callbacks
Due to obvious copy and paste coding a number of video capture drivers which implement a limit on the buffer memory decremented the user supplied buffer count in a while loop until it reaches an acceptable value. This is a silly thing to do when the maximum value can be directly computed. Signed-off-by: Andreas Bombe <aeb@debian.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88/cx88-video.c')
-rw-r--r--drivers/media/video/cx88/cx88-video.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 8e414f7..0a3849c 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -561,8 +561,8 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
*size = fh->fmt->depth*fh->width*fh->height >> 3;
if (0 == *count)
*count = 32;
- while (*size * *count > vid_limit * 1024 * 1024)
- (*count)--;
+ if (*size * *count > vid_limit * 1024 * 1024)
+ *count = (vid_limit * 1024 * 1024) / *size;
return 0;
}