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

V4L/DVB (10820): meye: Don't need to zero ioctl parameter fields

The v4l2 core code in v4l2_ioctl will zero out the structure the driver is
supposed to fill in for read-only ioctls.  For read/write ioctls, all the
fields which aren't supplied from userspace will be zeroed out.

Zeroing code is removed from querycap, enum_input, enum_fmt_vid_cap, and
g_fmt_vid_cap.
Signed-off-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c6a976e4
...@@ -1017,7 +1017,6 @@ static int meyeioc_stilljcapt(int *len) ...@@ -1017,7 +1017,6 @@ static int meyeioc_stilljcapt(int *len)
static int vidioc_querycap(struct file *file, void *fh, static int vidioc_querycap(struct file *file, void *fh,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
memset(cap, 0, sizeof(*cap));
strcpy(cap->driver, "meye"); strcpy(cap->driver, "meye");
strcpy(cap->card, "meye"); strcpy(cap->card, "meye");
sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev)); sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev));
...@@ -1036,8 +1035,6 @@ static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) ...@@ -1036,8 +1035,6 @@ static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
if (i->index != 0) if (i->index != 0)
return -EINVAL; return -EINVAL;
memset(i, 0, sizeof(*i));
i->index = 0;
strcpy(i->name, "Camera"); strcpy(i->name, "Camera");
i->type = V4L2_INPUT_TYPE_CAMERA; i->type = V4L2_INPUT_TYPE_CAMERA;
...@@ -1264,16 +1261,12 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *fh, ...@@ -1264,16 +1261,12 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *fh,
if (f->index == 0) { if (f->index == 0) {
/* standard YUV 422 capture */ /* standard YUV 422 capture */
memset(f, 0, sizeof(*f));
f->index = 0;
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
f->flags = 0; f->flags = 0;
strcpy(f->description, "YUV422"); strcpy(f->description, "YUV422");
f->pixelformat = V4L2_PIX_FMT_YUYV; f->pixelformat = V4L2_PIX_FMT_YUYV;
} else { } else {
/* compressed MJPEG capture */ /* compressed MJPEG capture */
memset(f, 0, sizeof(*f));
f->index = 1;
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
f->flags = V4L2_FMT_FLAG_COMPRESSED; f->flags = V4L2_FMT_FLAG_COMPRESSED;
strcpy(f->description, "MJPEG"); strcpy(f->description, "MJPEG");
...@@ -1322,9 +1315,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *fh, ...@@ -1322,9 +1315,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *fh,
if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL; return -EINVAL;
memset(&f->fmt.pix, 0, sizeof(struct v4l2_pix_format));
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
switch (meye.mchip_mode) { switch (meye.mchip_mode) {
case MCHIP_HIC_MODE_CONT_OUT: case MCHIP_HIC_MODE_CONT_OUT:
default: default:
...@@ -1341,8 +1331,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *fh, ...@@ -1341,8 +1331,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *fh,
f->fmt.pix.bytesperline = f->fmt.pix.width * 2; f->fmt.pix.bytesperline = f->fmt.pix.width * 2;
f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.sizeimage = f->fmt.pix.height *
f->fmt.pix.bytesperline; f->fmt.pix.bytesperline;
f->fmt.pix.colorspace = 0;
f->fmt.pix.priv = 0;
return 0; return 0;
} }
......
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