summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/s2255drv.c
diff options
context:
space:
mode:
authorAndreas Bombe <aeb@debian.org>2010-03-21 20:02:45 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 17:57:13 +0200
commitdab7e3106ddd6cbc3b55301228407b9d17ce7773 (patch)
tree1b6caa87522844e7ea8cc01932365201271f1afd /drivers/media/video/s2255drv.c
parentRevert "V4L/DVB (11906): saa7134: Use v4l bounding/alignment function" (diff)
downloadlinux-dab7e3106ddd6cbc3b55301228407b9d17ce7773.tar.xz
linux-dab7e3106ddd6cbc3b55301228407b9d17ce7773.zip
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/s2255drv.c')
-rw-r--r--drivers/media/video/s2255drv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 0092ff52bb27..5ecd41b3bf3e 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -702,8 +702,8 @@ static int buffer_setup(struct videobuf_queue *vq, unsigned int *count,
if (0 == *count)
*count = S2255_DEF_BUFS;
- while (*size * (*count) > vid_limit * 1024 * 1024)
- (*count)--;
+ if (*size * *count > vid_limit * 1024 * 1024)
+ *count = (vid_limit * 1024 * 1024) / *size;
return 0;
}