aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2019-06-26 05:58:02 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-07-23 08:48:33 -0400
commitb61789f53d49db8ca1f6b8fed411b317b4e8f044 (patch)
tree8491fcb0a20b6365c46e5ba46873a231c095051f /drivers
parent7708065f5d51a9ae80df29d1257d91fc6a6e50a0 (diff)
media: drivers/media: don't set pix->priv = 0
The priv field of struct v4l2_pix_format shouldn't be set by drivers, it's set by the v4l2 core instead to V4L2_PIX_FMT_PRIV_MAGIC. Drop this from the few media drivers that still do this. Note that the gspca patch is slightly more involved since some of the sub-gspca drivers use the priv field internally. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [hverkuil-cisco@xs4all.nl: fix clash in gspca between priv arg and priv variable] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/pci/cobalt/cobalt-v4l2.c1
-rw-r--r--drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c2
-rw-r--r--drivers/media/pci/solo6x10/solo6x10-v4l2.c2
-rw-r--r--drivers/media/pci/tw68/tw68-video.c1
-rw-r--r--drivers/media/platform/davinci/vpif_capture.c1
-rw-r--r--drivers/media/usb/au0828/au0828-video.c2
-rw-r--r--drivers/media/usb/cpia2/cpia2_v4l.c2
-rw-r--r--drivers/media/usb/em28xx/em28xx-video.c1
-rw-r--r--drivers/media/usb/gspca/gspca.c28
-rw-r--r--drivers/media/usb/s2255/s2255drv.c2
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c2
11 files changed, 15 insertions, 29 deletions
diff --git a/drivers/media/pci/cobalt/cobalt-v4l2.c b/drivers/media/pci/cobalt/cobalt-v4l2.c
index ea96f333ee2b..c5207501d5e0 100644
--- a/drivers/media/pci/cobalt/cobalt-v4l2.c
+++ b/drivers/media/pci/cobalt/cobalt-v4l2.c
@@ -785,7 +785,6 @@ static int cobalt_try_fmt_vid_cap(struct file *file, void *priv_fh,
785 785
786 pix->sizeimage = pix->bytesperline * pix->height; 786 pix->sizeimage = pix->bytesperline * pix->height;
787 pix->field = V4L2_FIELD_NONE; 787 pix->field = V4L2_FIELD_NONE;
788 pix->priv = 0;
789 788
790 return 0; 789 return 0;
791} 790}
diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
index a02f08459e14..476d7f3b32d6 100644
--- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
@@ -879,7 +879,6 @@ static int solo_enc_try_fmt_cap(struct file *file, void *priv,
879 pix->colorspace = V4L2_COLORSPACE_SMPTE170M; 879 pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
880 pix->sizeimage = FRAME_BUF_SIZE; 880 pix->sizeimage = FRAME_BUF_SIZE;
881 pix->bytesperline = 0; 881 pix->bytesperline = 0;
882 pix->priv = 0;
883 882
884 return 0; 883 return 0;
885} 884}
@@ -934,7 +933,6 @@ static int solo_enc_get_fmt_cap(struct file *file, void *priv,
934 V4L2_FIELD_NONE; 933 V4L2_FIELD_NONE;
935 pix->sizeimage = FRAME_BUF_SIZE; 934 pix->sizeimage = FRAME_BUF_SIZE;
936 pix->colorspace = V4L2_COLORSPACE_SMPTE170M; 935 pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
937 pix->priv = 0;
938 936
939 return 0; 937 return 0;
940} 938}
diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2.c b/drivers/media/pci/solo6x10/solo6x10-v4l2.c
index 2efa539d6075..78792067e920 100644
--- a/drivers/media/pci/solo6x10/solo6x10-v4l2.c
+++ b/drivers/media/pci/solo6x10/solo6x10-v4l2.c
@@ -477,7 +477,6 @@ static int solo_try_fmt_cap(struct file *file, void *priv,
477 pix->field = V4L2_FIELD_INTERLACED; 477 pix->field = V4L2_FIELD_INTERLACED;
478 pix->pixelformat = V4L2_PIX_FMT_UYVY; 478 pix->pixelformat = V4L2_PIX_FMT_UYVY;
479 pix->colorspace = V4L2_COLORSPACE_SMPTE170M; 479 pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
480 pix->priv = 0;
481 return 0; 480 return 0;
482} 481}
483 482
@@ -507,7 +506,6 @@ static int solo_get_fmt_cap(struct file *file, void *priv,
507 pix->sizeimage = solo_image_size(solo_dev); 506 pix->sizeimage = solo_image_size(solo_dev);
508 pix->colorspace = V4L2_COLORSPACE_SMPTE170M; 507 pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
509 pix->bytesperline = solo_bytesperline(solo_dev); 508 pix->bytesperline = solo_bytesperline(solo_dev);
510 pix->priv = 0;
511 509
512 return 0; 510 return 0;
513} 511}
diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c
index 99e74c22d3be..2fb82d50c53e 100644
--- a/drivers/media/pci/tw68/tw68-video.c
+++ b/drivers/media/pci/tw68/tw68-video.c
@@ -582,7 +582,6 @@ static int tw68_g_fmt_vid_cap(struct file *file, void *priv,
582 f->fmt.pix.sizeimage = 582 f->fmt.pix.sizeimage =
583 f->fmt.pix.height * f->fmt.pix.bytesperline; 583 f->fmt.pix.height * f->fmt.pix.bytesperline;
584 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; 584 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
585 f->fmt.pix.priv = 0;
586 return 0; 585 return 0;
587} 586}
588 587
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 9fe7caf6aa13..d5eadd451587 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -972,7 +972,6 @@ static int vpif_try_fmt_vid_cap(struct file *file, void *priv,
972 pixfmt->bytesperline = common->fmt.fmt.pix.width * 2; 972 pixfmt->bytesperline = common->fmt.fmt.pix.width * 2;
973 pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height; 973 pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height;
974 } 974 }
975 pixfmt->priv = 0;
976 975
977 dev_dbg(vpif_dev, "%s: %d x %d; pitch=%d pixelformat=0x%08x, field=%d, size=%d\n", __func__, 976 dev_dbg(vpif_dev, "%s: %d x %d; pitch=%d pixelformat=0x%08x, field=%d, size=%d\n", __func__,
978 pixfmt->width, pixfmt->height, 977 pixfmt->width, pixfmt->height,
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index e390ca57520a..d1895334cbbf 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1153,7 +1153,6 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd,
1153 format->fmt.pix.sizeimage = width * height * 2; 1153 format->fmt.pix.sizeimage = width * height * 2;
1154 format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; 1154 format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
1155 format->fmt.pix.field = V4L2_FIELD_INTERLACED; 1155 format->fmt.pix.field = V4L2_FIELD_INTERLACED;
1156 format->fmt.pix.priv = 0;
1157 1156
1158 if (cmd == VIDIOC_TRY_FMT) 1157 if (cmd == VIDIOC_TRY_FMT)
1159 return 0; 1158 return 0;
@@ -1227,7 +1226,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
1227 f->fmt.pix.sizeimage = dev->frame_size; 1226 f->fmt.pix.sizeimage = dev->frame_size;
1228 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; /* NTSC/PAL */ 1227 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; /* NTSC/PAL */
1229 f->fmt.pix.field = V4L2_FIELD_INTERLACED; 1228 f->fmt.pix.field = V4L2_FIELD_INTERLACED;
1230 f->fmt.pix.priv = 0;
1231 return 0; 1229 return 0;
1232} 1230}
1233 1231
diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c
index ded7eb2dc40a..626264a56517 100644
--- a/drivers/media/usb/cpia2/cpia2_v4l.c
+++ b/drivers/media/usb/cpia2/cpia2_v4l.c
@@ -323,7 +323,6 @@ static int cpia2_try_fmt_vid_cap(struct file *file, void *fh,
323 f->fmt.pix.bytesperline = 0; 323 f->fmt.pix.bytesperline = 0;
324 f->fmt.pix.sizeimage = cam->frame_size; 324 f->fmt.pix.sizeimage = cam->frame_size;
325 f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; 325 f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
326 f->fmt.pix.priv = 0;
327 326
328 switch (cpia2_match_video_size(f->fmt.pix.width, f->fmt.pix.height)) { 327 switch (cpia2_match_video_size(f->fmt.pix.width, f->fmt.pix.height)) {
329 case VIDEOSIZE_VGA: 328 case VIDEOSIZE_VGA:
@@ -434,7 +433,6 @@ static int cpia2_g_fmt_vid_cap(struct file *file, void *fh,
434 f->fmt.pix.bytesperline = 0; 433 f->fmt.pix.bytesperline = 0;
435 f->fmt.pix.sizeimage = cam->frame_size; 434 f->fmt.pix.sizeimage = cam->frame_size;
436 f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG; 435 f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
437 f->fmt.pix.priv = 0;
438 436
439 return 0; 437 return 0;
440} 438}
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 82eb1550ec3b..fc6d37d76dc9 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -1510,7 +1510,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
1510 else 1510 else
1511 f->fmt.pix.field = v4l2->interlaced_fieldmode ? 1511 f->fmt.pix.field = v4l2->interlaced_fieldmode ?
1512 V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; 1512 V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP;
1513 f->fmt.pix.priv = 0;
1514 1513
1515 return 0; 1514 return 0;
1516} 1515}
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index 83b78a42414e..4add2b12d330 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -1027,15 +1027,15 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
1027 return 0; 1027 return 0;
1028} 1028}
1029 1029
1030static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, 1030static int vidioc_g_fmt_vid_cap(struct file *file, void *_priv,
1031 struct v4l2_format *fmt) 1031 struct v4l2_format *fmt)
1032{ 1032{
1033 struct gspca_dev *gspca_dev = video_drvdata(file); 1033 struct gspca_dev *gspca_dev = video_drvdata(file);
1034 u32 priv = fmt->fmt.pix.priv;
1034 1035
1035 fmt->fmt.pix = gspca_dev->pixfmt; 1036 fmt->fmt.pix = gspca_dev->pixfmt;
1036 /* some drivers use priv internally, zero it before giving it back to 1037 /* some drivers use priv internally, so keep the original value */
1037 the core */ 1038 fmt->fmt.pix.priv = priv;
1038 fmt->fmt.pix.priv = 0;
1039 return 0; 1039 return 0;
1040} 1040}
1041 1041
@@ -1070,27 +1070,27 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
1070 fmt->fmt.pix.height = h; 1070 fmt->fmt.pix.height = h;
1071 gspca_dev->sd_desc->try_fmt(gspca_dev, fmt); 1071 gspca_dev->sd_desc->try_fmt(gspca_dev, fmt);
1072 } 1072 }
1073 /* some drivers use priv internally, zero it before giving it back to
1074 the core */
1075 fmt->fmt.pix.priv = 0;
1076 return mode; /* used when s_fmt */ 1073 return mode; /* used when s_fmt */
1077} 1074}
1078 1075
1079static int vidioc_try_fmt_vid_cap(struct file *file, 1076static int vidioc_try_fmt_vid_cap(struct file *file, void *_priv,
1080 void *priv, 1077 struct v4l2_format *fmt)
1081 struct v4l2_format *fmt)
1082{ 1078{
1083 struct gspca_dev *gspca_dev = video_drvdata(file); 1079 struct gspca_dev *gspca_dev = video_drvdata(file);
1080 u32 priv = fmt->fmt.pix.priv;
1084 1081
1085 if (try_fmt_vid_cap(gspca_dev, fmt) < 0) 1082 if (try_fmt_vid_cap(gspca_dev, fmt) < 0)
1086 return -EINVAL; 1083 return -EINVAL;
1084 /* some drivers use priv internally, so keep the original value */
1085 fmt->fmt.pix.priv = priv;
1087 return 0; 1086 return 0;
1088} 1087}
1089 1088
1090static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, 1089static int vidioc_s_fmt_vid_cap(struct file *file, void *_priv,
1091 struct v4l2_format *fmt) 1090 struct v4l2_format *fmt)
1092{ 1091{
1093 struct gspca_dev *gspca_dev = video_drvdata(file); 1092 struct gspca_dev *gspca_dev = video_drvdata(file);
1093 u32 priv = fmt->fmt.pix.priv;
1094 int mode; 1094 int mode;
1095 1095
1096 if (vb2_is_busy(&gspca_dev->queue)) 1096 if (vb2_is_busy(&gspca_dev->queue))
@@ -1106,6 +1106,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
1106 gspca_dev->pixfmt = fmt->fmt.pix; 1106 gspca_dev->pixfmt = fmt->fmt.pix;
1107 else 1107 else
1108 gspca_dev->pixfmt = gspca_dev->cam.cam_mode[mode]; 1108 gspca_dev->pixfmt = gspca_dev->cam.cam_mode[mode];
1109 /* some drivers use priv internally, so keep the original value */
1110 fmt->fmt.pix.priv = priv;
1109 return 0; 1111 return 0;
1110} 1112}
1111 1113
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 533f7f064a44..329ec8089592 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -751,7 +751,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
751 f->fmt.pix.bytesperline = f->fmt.pix.width * (vc->fmt->depth >> 3); 751 f->fmt.pix.bytesperline = f->fmt.pix.width * (vc->fmt->depth >> 3);
752 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; 752 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
753 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; 753 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
754 f->fmt.pix.priv = 0;
755 return 0; 754 return 0;
756} 755}
757 756
@@ -803,7 +802,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
803 f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3; 802 f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3;
804 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; 803 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
805 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; 804 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
806 f->fmt.pix.priv = 0;
807 dprintk(vc->dev, 50, "%s: set width %d height %d field %d\n", __func__, 805 dprintk(vc->dev, 50, "%s: set width %d height %d field %d\n", __func__,
808 f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field); 806 f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field);
809 return 0; 807 return 0;
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 203329cadbc4..0335e69b70ab 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -253,7 +253,6 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
253 fmt->fmt.pix.bytesperline = uvc_v4l2_get_bytesperline(format, frame); 253 fmt->fmt.pix.bytesperline = uvc_v4l2_get_bytesperline(format, frame);
254 fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize; 254 fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize;
255 fmt->fmt.pix.colorspace = format->colorspace; 255 fmt->fmt.pix.colorspace = format->colorspace;
256 fmt->fmt.pix.priv = 0;
257 256
258 if (uvc_format != NULL) 257 if (uvc_format != NULL)
259 *uvc_format = format; 258 *uvc_format = format;
@@ -290,7 +289,6 @@ static int uvc_v4l2_get_format(struct uvc_streaming *stream,
290 fmt->fmt.pix.bytesperline = uvc_v4l2_get_bytesperline(format, frame); 289 fmt->fmt.pix.bytesperline = uvc_v4l2_get_bytesperline(format, frame);
291 fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize; 290 fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize;
292 fmt->fmt.pix.colorspace = format->colorspace; 291 fmt->fmt.pix.colorspace = format->colorspace;
293 fmt->fmt.pix.priv = 0;
294 292
295done: 293done:
296 mutex_unlock(&stream->mutex); 294 mutex_unlock(&stream->mutex);