diff options
Diffstat (limited to 'drivers/media/common/saa7146/saa7146_video.c')
-rw-r--r-- | drivers/media/common/saa7146/saa7146_video.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/media/common/saa7146/saa7146_video.c b/drivers/media/common/saa7146/saa7146_video.c index 2b631eaa65b3..5dfc1f27d1cf 100644 --- a/drivers/media/common/saa7146/saa7146_video.c +++ b/drivers/media/common/saa7146/saa7146_video.c @@ -4,6 +4,7 @@ #include <media/v4l2-event.h> #include <media/v4l2-ctrls.h> #include <linux/module.h> +#include <linux/kernel.h> static int max_memory = 32; @@ -86,13 +87,11 @@ static struct saa7146_format formats[] = { due to this, it's impossible to provide additional *packed* formats, which are simply byte swapped (like V4L2_PIX_FMT_YUYV) ... 8-( */ -static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); - struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc) { - int i, j = NUM_FORMATS; + int i; - for (i = 0; i < j; i++) { + for (i = 0; i < ARRAY_SIZE(formats); i++) { if (formats[i].pixelformat == fourcc) { return formats+i; } @@ -524,7 +523,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuf static int vidioc_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *f) { - if (f->index >= NUM_FORMATS) + if (f->index >= ARRAY_SIZE(formats)) return -EINVAL; strlcpy((char *)f->description, formats[f->index].name, sizeof(f->description)); |