Commit ecefa105 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Hans Verkuil

media: Zero-initialize all structures passed to subdev pad operations

Several drivers call subdev pad operations, passing structures that are
not fully zeroed. While the drivers initialize the fields they care
about explicitly, this results in reserved fields having uninitialized
values. Future kernel API changes that make use of those fields thus
risk breaking proper driver operation in ways that could be hard to
detect.

To avoid this, make the code more robust by zero-initializing all the
structures passed to subdev pad operation. Maintain a consistent coding
style by preferring designated initializers (which zero-initialize all
the fields that are not specified) over memset() where possible, and
make variable declarations local to inner scopes where applicable. One
notable exception to this rule is in the ipu3 driver, where a memset()
is needed as the structure is not a local variable but a function
parameter provided by the caller.

Not all fields of those structures can be initialized when declaring the
variables, as the values for those fields are computed later in the
code. Initialize the 'which' field in all cases, and other fields when
the variable declaration is so close to the v4l2_subdev_call() call that
it keeps all the context easily visible when reading the code, to avoid
hindering readability.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org> # For vimc
Reviewed-by: Lad Prabhakar <prabhakar.csengg@gmail.com> # For am437x
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # For drivers/staging/media/imx/
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent a8ca0cf1
...@@ -708,7 +708,6 @@ static int cobalt_g_fmt_vid_cap(struct file *file, void *priv_fh, ...@@ -708,7 +708,6 @@ static int cobalt_g_fmt_vid_cap(struct file *file, void *priv_fh,
{ {
struct cobalt_stream *s = video_drvdata(file); struct cobalt_stream *s = video_drvdata(file);
struct v4l2_pix_format *pix = &f->fmt.pix; struct v4l2_pix_format *pix = &f->fmt.pix;
struct v4l2_subdev_format sd_fmt;
pix->width = s->width; pix->width = s->width;
pix->height = s->height; pix->height = s->height;
...@@ -718,8 +717,11 @@ static int cobalt_g_fmt_vid_cap(struct file *file, void *priv_fh, ...@@ -718,8 +717,11 @@ static int cobalt_g_fmt_vid_cap(struct file *file, void *priv_fh,
if (s->input == 1) { if (s->input == 1) {
pix->colorspace = V4L2_COLORSPACE_SRGB; pix->colorspace = V4L2_COLORSPACE_SRGB;
} else { } else {
sd_fmt.pad = s->pad_source; struct v4l2_subdev_format sd_fmt = {
sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; .pad = s->pad_source,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
v4l2_subdev_call(s->sd, pad, get_fmt, NULL, &sd_fmt); v4l2_subdev_call(s->sd, pad, get_fmt, NULL, &sd_fmt);
v4l2_fill_pix_format(pix, &sd_fmt.format); v4l2_fill_pix_format(pix, &sd_fmt.format);
} }
...@@ -735,7 +737,6 @@ static int cobalt_try_fmt_vid_cap(struct file *file, void *priv_fh, ...@@ -735,7 +737,6 @@ static int cobalt_try_fmt_vid_cap(struct file *file, void *priv_fh,
{ {
struct cobalt_stream *s = video_drvdata(file); struct cobalt_stream *s = video_drvdata(file);
struct v4l2_pix_format *pix = &f->fmt.pix; struct v4l2_pix_format *pix = &f->fmt.pix;
struct v4l2_subdev_format sd_fmt;
/* Check for min (QCIF) and max (Full HD) size */ /* Check for min (QCIF) and max (Full HD) size */
if ((pix->width < 176) || (pix->height < 144)) { if ((pix->width < 176) || (pix->height < 144)) {
...@@ -760,8 +761,11 @@ static int cobalt_try_fmt_vid_cap(struct file *file, void *priv_fh, ...@@ -760,8 +761,11 @@ static int cobalt_try_fmt_vid_cap(struct file *file, void *priv_fh,
pix->height = 1080; pix->height = 1080;
pix->colorspace = V4L2_COLORSPACE_SRGB; pix->colorspace = V4L2_COLORSPACE_SRGB;
} else { } else {
sd_fmt.pad = s->pad_source; struct v4l2_subdev_format sd_fmt = {
sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; .pad = s->pad_source,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
v4l2_subdev_call(s->sd, pad, get_fmt, NULL, &sd_fmt); v4l2_subdev_call(s->sd, pad, get_fmt, NULL, &sd_fmt);
v4l2_fill_pix_format(pix, &sd_fmt.format); v4l2_fill_pix_format(pix, &sd_fmt.format);
} }
......
...@@ -1305,6 +1305,7 @@ static int cio2_subdev_link_validate_get_format(struct media_pad *pad, ...@@ -1305,6 +1305,7 @@ static int cio2_subdev_link_validate_get_format(struct media_pad *pad,
struct v4l2_subdev *sd = struct v4l2_subdev *sd =
media_entity_to_v4l2_subdev(pad->entity); media_entity_to_v4l2_subdev(pad->entity);
memset(fmt, 0, sizeof(*fmt));
fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE; fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE;
fmt->pad = pad->index; fmt->pad = pad->index;
return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt);
......
...@@ -342,7 +342,9 @@ static struct v4l2_subdev *video_remote_subdev(struct camss_video *video, ...@@ -342,7 +342,9 @@ static struct v4l2_subdev *video_remote_subdev(struct camss_video *video,
static int video_get_subdev_format(struct camss_video *video, static int video_get_subdev_format(struct camss_video *video,
struct v4l2_format *format) struct v4l2_format *format)
{ {
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
u32 pad; u32 pad;
int ret; int ret;
...@@ -353,7 +355,6 @@ static int video_get_subdev_format(struct camss_video *video, ...@@ -353,7 +355,6 @@ static int video_get_subdev_format(struct camss_video *video,
memset(&fmt, 0, sizeof(fmt)); memset(&fmt, 0, sizeof(fmt));
fmt.pad = pad; fmt.pad = pad;
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
if (ret) if (ret)
......
...@@ -62,7 +62,9 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad) ...@@ -62,7 +62,9 @@ vsp1_video_remote_subdev(struct media_pad *local, u32 *pad)
static int vsp1_video_verify_format(struct vsp1_video *video) static int vsp1_video_verify_format(struct vsp1_video *video)
{ {
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
int ret; int ret;
...@@ -70,7 +72,6 @@ static int vsp1_video_verify_format(struct vsp1_video *video) ...@@ -70,7 +72,6 @@ static int vsp1_video_verify_format(struct vsp1_video *video)
if (subdev == NULL) if (subdev == NULL)
return -EINVAL; return -EINVAL;
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
if (ret < 0) if (ret < 0)
return ret == -ENOIOCTLCMD ? -EINVAL : ret; return ret == -ENOIOCTLCMD ? -EINVAL : ret;
......
...@@ -854,7 +854,7 @@ static int fimc_get_sensor_frame_desc(struct v4l2_subdev *sensor, ...@@ -854,7 +854,7 @@ static int fimc_get_sensor_frame_desc(struct v4l2_subdev *sensor,
struct v4l2_plane_pix_format *plane_fmt, struct v4l2_plane_pix_format *plane_fmt,
unsigned int num_planes, bool try) unsigned int num_planes, bool try)
{ {
struct v4l2_mbus_frame_desc fd; struct v4l2_mbus_frame_desc fd = { };
int i, ret; int i, ret;
int pad; int pad;
...@@ -1095,7 +1095,12 @@ static int fimc_cap_g_input(struct file *file, void *priv, unsigned int *i) ...@@ -1095,7 +1095,12 @@ static int fimc_cap_g_input(struct file *file, void *priv, unsigned int *i)
*/ */
static int fimc_pipeline_validate(struct fimc_dev *fimc) static int fimc_pipeline_validate(struct fimc_dev *fimc)
{ {
struct v4l2_subdev_format sink_fmt, src_fmt; struct v4l2_subdev_format sink_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev_format src_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct fimc_vid_cap *vc = &fimc->vid_cap; struct fimc_vid_cap *vc = &fimc->vid_cap;
struct v4l2_subdev *sd = &vc->subdev; struct v4l2_subdev *sd = &vc->subdev;
struct fimc_pipeline *p = to_fimc_pipeline(vc->ve.pipe); struct fimc_pipeline *p = to_fimc_pipeline(vc->ve.pipe);
...@@ -1132,7 +1137,6 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc) ...@@ -1132,7 +1137,6 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc)
sink_fmt.format.code = ff->fmt ? ff->fmt->mbus_code : 0; sink_fmt.format.code = ff->fmt ? ff->fmt->mbus_code : 0;
} else { } else {
sink_fmt.pad = sink_pad->index; sink_fmt.pad = sink_pad->index;
sink_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sink_fmt); ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sink_fmt);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
return -EPIPE; return -EPIPE;
...@@ -1141,7 +1145,6 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc) ...@@ -1141,7 +1145,6 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc)
/* Retrieve format at the source pad */ /* Retrieve format at the source pad */
sd = media_entity_to_v4l2_subdev(src_pad->entity); sd = media_entity_to_v4l2_subdev(src_pad->entity);
src_fmt.pad = src_pad->index; src_fmt.pad = src_pad->index;
src_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &src_fmt); ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &src_fmt);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
return -EPIPE; return -EPIPE;
......
...@@ -449,17 +449,22 @@ static int isp_video_s_fmt_mplane(struct file *file, void *priv, ...@@ -449,17 +449,22 @@ static int isp_video_s_fmt_mplane(struct file *file, void *priv,
static int isp_video_pipeline_validate(struct fimc_isp *isp) static int isp_video_pipeline_validate(struct fimc_isp *isp)
{ {
struct v4l2_subdev *sd = &isp->subdev; struct v4l2_subdev *sd = &isp->subdev;
struct v4l2_subdev_format sink_fmt, src_fmt;
struct media_pad *pad; struct media_pad *pad;
int ret; int ret;
while (1) { while (1) {
struct v4l2_subdev_format sink_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev_format src_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
/* Retrieve format at the sink pad */ /* Retrieve format at the sink pad */
pad = &sd->entity.pads[0]; pad = &sd->entity.pads[0];
if (!(pad->flags & MEDIA_PAD_FL_SINK)) if (!(pad->flags & MEDIA_PAD_FL_SINK))
break; break;
sink_fmt.pad = pad->index; sink_fmt.pad = pad->index;
sink_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sink_fmt); ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sink_fmt);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
return -EPIPE; return -EPIPE;
...@@ -471,7 +476,6 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp) ...@@ -471,7 +476,6 @@ static int isp_video_pipeline_validate(struct fimc_isp *isp)
sd = media_entity_to_v4l2_subdev(pad->entity); sd = media_entity_to_v4l2_subdev(pad->entity);
src_fmt.pad = pad->index; src_fmt.pad = pad->index;
src_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &src_fmt); ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &src_fmt);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
return -EPIPE; return -EPIPE;
......
...@@ -765,7 +765,12 @@ static int fimc_lite_s_fmt_mplane(struct file *file, void *priv, ...@@ -765,7 +765,12 @@ static int fimc_lite_s_fmt_mplane(struct file *file, void *priv,
static int fimc_pipeline_validate(struct fimc_lite *fimc) static int fimc_pipeline_validate(struct fimc_lite *fimc)
{ {
struct v4l2_subdev *sd = &fimc->subdev; struct v4l2_subdev *sd = &fimc->subdev;
struct v4l2_subdev_format sink_fmt, src_fmt; struct v4l2_subdev_format sink_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev_format src_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct media_pad *pad; struct media_pad *pad;
int ret; int ret;
...@@ -782,7 +787,6 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc) ...@@ -782,7 +787,6 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc)
sink_fmt.format.code = fimc->inp_frame.fmt->mbus_code; sink_fmt.format.code = fimc->inp_frame.fmt->mbus_code;
} else { } else {
sink_fmt.pad = pad->index; sink_fmt.pad = pad->index;
sink_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, ret = v4l2_subdev_call(sd, pad, get_fmt, NULL,
&sink_fmt); &sink_fmt);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
...@@ -795,7 +799,6 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc) ...@@ -795,7 +799,6 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc)
sd = media_entity_to_v4l2_subdev(pad->entity); sd = media_entity_to_v4l2_subdev(pad->entity);
src_fmt.pad = pad->index; src_fmt.pad = pad->index;
src_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &src_fmt); ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &src_fmt);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
return -EPIPE; return -EPIPE;
......
...@@ -806,7 +806,9 @@ static int s3c_camif_vidioc_s_fmt(struct file *file, void *priv, ...@@ -806,7 +806,9 @@ static int s3c_camif_vidioc_s_fmt(struct file *file, void *priv,
/* Only check pixel formats at the sensor and the camif subdev pads */ /* Only check pixel formats at the sensor and the camif subdev pads */
static int camif_pipeline_validate(struct camif_dev *camif) static int camif_pipeline_validate(struct camif_dev *camif)
{ {
struct v4l2_subdev_format src_fmt; struct v4l2_subdev_format src_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct media_pad *pad; struct media_pad *pad;
int ret; int ret;
...@@ -816,7 +818,6 @@ static int camif_pipeline_validate(struct camif_dev *camif) ...@@ -816,7 +818,6 @@ static int camif_pipeline_validate(struct camif_dev *camif)
return -EPIPE; return -EPIPE;
src_fmt.pad = pad->index; src_fmt.pad = pad->index;
src_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(camif->sensor.sd, pad, get_fmt, NULL, &src_fmt); ret = v4l2_subdev_call(camif->sensor.sd, pad, get_fmt, NULL, &src_fmt);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
return -EPIPE; return -EPIPE;
......
...@@ -190,7 +190,9 @@ static int camif_register_sensor(struct camif_dev *camif) ...@@ -190,7 +190,9 @@ static int camif_register_sensor(struct camif_dev *camif)
struct s3c_camif_sensor_info *sensor = &camif->pdata.sensor; struct s3c_camif_sensor_info *sensor = &camif->pdata.sensor;
struct v4l2_device *v4l2_dev = &camif->v4l2_dev; struct v4l2_device *v4l2_dev = &camif->v4l2_dev;
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
struct v4l2_subdev_format format; struct v4l2_subdev_format format = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
int ret; int ret;
...@@ -220,7 +222,6 @@ static int camif_register_sensor(struct camif_dev *camif) ...@@ -220,7 +222,6 @@ static int camif_register_sensor(struct camif_dev *camif)
/* Get initial pixel format and set it at the camif sink pad */ /* Get initial pixel format and set it at the camif sink pad */
format.pad = 0; format.pad = 0;
format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &format); ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &format);
if (ret < 0) if (ret < 0)
......
...@@ -1285,13 +1285,13 @@ static int __subdev_get_format(struct vpfe_device *vpfe, ...@@ -1285,13 +1285,13 @@ static int __subdev_get_format(struct vpfe_device *vpfe,
struct v4l2_mbus_framefmt *fmt) struct v4l2_mbus_framefmt *fmt)
{ {
struct v4l2_subdev *sd = vpfe->current_subdev->sd; struct v4l2_subdev *sd = vpfe->current_subdev->sd;
struct v4l2_subdev_format sd_fmt; struct v4l2_subdev_format sd_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
.pad = 0,
};
struct v4l2_mbus_framefmt *mbus_fmt = &sd_fmt.format; struct v4l2_mbus_framefmt *mbus_fmt = &sd_fmt.format;
int ret; int ret;
sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
sd_fmt.pad = 0;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt); ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt);
if (ret) if (ret)
return ret; return ret;
...@@ -1309,12 +1309,13 @@ static int __subdev_set_format(struct vpfe_device *vpfe, ...@@ -1309,12 +1309,13 @@ static int __subdev_set_format(struct vpfe_device *vpfe,
struct v4l2_mbus_framefmt *fmt) struct v4l2_mbus_framefmt *fmt)
{ {
struct v4l2_subdev *sd = vpfe->current_subdev->sd; struct v4l2_subdev *sd = vpfe->current_subdev->sd;
struct v4l2_subdev_format sd_fmt; struct v4l2_subdev_format sd_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
.pad = 0,
};
struct v4l2_mbus_framefmt *mbus_fmt = &sd_fmt.format; struct v4l2_mbus_framefmt *mbus_fmt = &sd_fmt.format;
int ret; int ret;
sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
sd_fmt.pad = 0;
*mbus_fmt = *fmt; *mbus_fmt = *fmt;
ret = v4l2_subdev_call(sd, pad, set_fmt, NULL, &sd_fmt); ret = v4l2_subdev_call(sd, pad, set_fmt, NULL, &sd_fmt);
...@@ -1393,7 +1394,9 @@ static int vpfe_try_fmt(struct file *file, void *priv, ...@@ -1393,7 +1394,9 @@ static int vpfe_try_fmt(struct file *file, void *priv,
struct vpfe_device *vpfe = video_drvdata(file); struct vpfe_device *vpfe = video_drvdata(file);
struct v4l2_subdev *sd = vpfe->current_subdev->sd; struct v4l2_subdev *sd = vpfe->current_subdev->sd;
const struct vpfe_fmt *fmt; const struct vpfe_fmt *fmt;
struct v4l2_subdev_frame_size_enum fse; struct v4l2_subdev_frame_size_enum fse = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
int ret, found; int ret, found;
fmt = find_format_by_pix(vpfe, f->fmt.pix.pixelformat); fmt = find_format_by_pix(vpfe, f->fmt.pix.pixelformat);
...@@ -1412,7 +1415,6 @@ static int vpfe_try_fmt(struct file *file, void *priv, ...@@ -1412,7 +1415,6 @@ static int vpfe_try_fmt(struct file *file, void *priv,
found = false; found = false;
fse.pad = 0; fse.pad = 0;
fse.code = fmt->code; fse.code = fmt->code;
fse.which = V4L2_SUBDEV_FORMAT_ACTIVE;
for (fse.index = 0; ; fse.index++) { for (fse.index = 0; ; fse.index++) {
ret = v4l2_subdev_call(sd, pad, enum_frame_size, ret = v4l2_subdev_call(sd, pad, enum_frame_size,
NULL, &fse); NULL, &fse);
......
...@@ -117,13 +117,13 @@ static int cal_legacy_enum_fmt_vid_cap(struct file *file, void *priv, ...@@ -117,13 +117,13 @@ static int cal_legacy_enum_fmt_vid_cap(struct file *file, void *priv,
static int __subdev_get_format(struct cal_ctx *ctx, static int __subdev_get_format(struct cal_ctx *ctx,
struct v4l2_mbus_framefmt *fmt) struct v4l2_mbus_framefmt *fmt)
{ {
struct v4l2_subdev_format sd_fmt; struct v4l2_subdev_format sd_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
.pad = 0,
};
struct v4l2_mbus_framefmt *mbus_fmt = &sd_fmt.format; struct v4l2_mbus_framefmt *mbus_fmt = &sd_fmt.format;
int ret; int ret;
sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
sd_fmt.pad = 0;
ret = v4l2_subdev_call(ctx->phy->source, pad, get_fmt, NULL, &sd_fmt); ret = v4l2_subdev_call(ctx->phy->source, pad, get_fmt, NULL, &sd_fmt);
if (ret) if (ret)
return ret; return ret;
...@@ -139,12 +139,13 @@ static int __subdev_get_format(struct cal_ctx *ctx, ...@@ -139,12 +139,13 @@ static int __subdev_get_format(struct cal_ctx *ctx,
static int __subdev_set_format(struct cal_ctx *ctx, static int __subdev_set_format(struct cal_ctx *ctx,
struct v4l2_mbus_framefmt *fmt) struct v4l2_mbus_framefmt *fmt)
{ {
struct v4l2_subdev_format sd_fmt; struct v4l2_subdev_format sd_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
.pad = 0,
};
struct v4l2_mbus_framefmt *mbus_fmt = &sd_fmt.format; struct v4l2_mbus_framefmt *mbus_fmt = &sd_fmt.format;
int ret; int ret;
sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
sd_fmt.pad = 0;
*mbus_fmt = *fmt; *mbus_fmt = *fmt;
ret = v4l2_subdev_call(ctx->phy->source, pad, set_fmt, NULL, &sd_fmt); ret = v4l2_subdev_call(ctx->phy->source, pad, set_fmt, NULL, &sd_fmt);
...@@ -190,7 +191,9 @@ static int cal_legacy_try_fmt_vid_cap(struct file *file, void *priv, ...@@ -190,7 +191,9 @@ static int cal_legacy_try_fmt_vid_cap(struct file *file, void *priv,
{ {
struct cal_ctx *ctx = video_drvdata(file); struct cal_ctx *ctx = video_drvdata(file);
const struct cal_format_info *fmtinfo; const struct cal_format_info *fmtinfo;
struct v4l2_subdev_frame_size_enum fse; struct v4l2_subdev_frame_size_enum fse = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
int found; int found;
fmtinfo = find_format_by_pix(ctx, f->fmt.pix.pixelformat); fmtinfo = find_format_by_pix(ctx, f->fmt.pix.pixelformat);
...@@ -209,7 +212,6 @@ static int cal_legacy_try_fmt_vid_cap(struct file *file, void *priv, ...@@ -209,7 +212,6 @@ static int cal_legacy_try_fmt_vid_cap(struct file *file, void *priv,
found = false; found = false;
fse.pad = 0; fse.pad = 0;
fse.code = fmtinfo->code; fse.code = fmtinfo->code;
fse.which = V4L2_SUBDEV_FORMAT_ACTIVE;
for (fse.index = 0; ; fse.index++) { for (fse.index = 0; ; fse.index++) {
int ret; int ret;
...@@ -302,7 +304,11 @@ static int cal_legacy_enum_framesizes(struct file *file, void *fh, ...@@ -302,7 +304,11 @@ static int cal_legacy_enum_framesizes(struct file *file, void *fh,
{ {
struct cal_ctx *ctx = video_drvdata(file); struct cal_ctx *ctx = video_drvdata(file);
const struct cal_format_info *fmtinfo; const struct cal_format_info *fmtinfo;
struct v4l2_subdev_frame_size_enum fse; struct v4l2_subdev_frame_size_enum fse = {
.index = fsize->index,
.pad = 0,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
int ret; int ret;
/* check for valid format */ /* check for valid format */
...@@ -313,10 +319,7 @@ static int cal_legacy_enum_framesizes(struct file *file, void *fh, ...@@ -313,10 +319,7 @@ static int cal_legacy_enum_framesizes(struct file *file, void *fh,
return -EINVAL; return -EINVAL;
} }
fse.index = fsize->index;
fse.pad = 0;
fse.code = fmtinfo->code; fse.code = fmtinfo->code;
fse.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(ctx->phy->source, pad, enum_frame_size, NULL, ret = v4l2_subdev_call(ctx->phy->source, pad, enum_frame_size, NULL,
&fse); &fse);
......
...@@ -1118,7 +1118,9 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) ...@@ -1118,7 +1118,9 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
const struct v4l2_rect *crop; const struct v4l2_rect *crop;
const struct isp_format_info *fmt_info; const struct isp_format_info *fmt_info;
struct v4l2_subdev_format fmt_src; struct v4l2_subdev_format fmt_src = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
unsigned int depth_out; unsigned int depth_out;
unsigned int depth_in = 0; unsigned int depth_in = 0;
struct media_pad *pad; struct media_pad *pad;
...@@ -1150,7 +1152,6 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) ...@@ -1150,7 +1152,6 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
* input format is a non-BT.656 YUV variant. * input format is a non-BT.656 YUV variant.
*/ */
fmt_src.pad = pad->index; fmt_src.pad = pad->index;
fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE;
if (!v4l2_subdev_call(sensor, pad, get_fmt, NULL, &fmt_src)) { if (!v4l2_subdev_call(sensor, pad, get_fmt, NULL, &fmt_src)) {
fmt_info = omap3isp_video_format_info(fmt_src.format.code); fmt_info = omap3isp_video_format_info(fmt_src.format.code);
depth_in = fmt_info->width; depth_in = fmt_info->width;
......
...@@ -268,7 +268,9 @@ static int isp_video_get_graph_data(struct isp_video *video, ...@@ -268,7 +268,9 @@ static int isp_video_get_graph_data(struct isp_video *video,
static int static int
__isp_video_get_format(struct isp_video *video, struct v4l2_format *format) __isp_video_get_format(struct isp_video *video, struct v4l2_format *format)
{ {
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
u32 pad; u32 pad;
int ret; int ret;
...@@ -278,7 +280,6 @@ __isp_video_get_format(struct isp_video *video, struct v4l2_format *format) ...@@ -278,7 +280,6 @@ __isp_video_get_format(struct isp_video *video, struct v4l2_format *format)
return -EINVAL; return -EINVAL;
fmt.pad = pad; fmt.pad = pad;
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
mutex_lock(&video->mutex); mutex_lock(&video->mutex);
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
...@@ -731,7 +732,9 @@ static int ...@@ -731,7 +732,9 @@ static int
isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format) isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
{ {
struct isp_video *video = video_drvdata(file); struct isp_video *video = video_drvdata(file);
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
u32 pad; u32 pad;
int ret; int ret;
...@@ -746,7 +749,6 @@ isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format) ...@@ -746,7 +749,6 @@ isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
isp_video_pix_to_mbus(&format->fmt.pix, &fmt.format); isp_video_pix_to_mbus(&format->fmt.pix, &fmt.format);
fmt.pad = pad; fmt.pad = pad;
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
if (ret) if (ret)
return ret == -ENOIOCTLCMD ? -ENOTTY : ret; return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
...@@ -759,7 +761,9 @@ static int ...@@ -759,7 +761,9 @@ static int
isp_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel) isp_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel)
{ {
struct isp_video *video = video_drvdata(file); struct isp_video *video = video_drvdata(file);
struct v4l2_subdev_format format; struct v4l2_subdev_format format = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
struct v4l2_subdev_selection sdsel = { struct v4l2_subdev_selection sdsel = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE, .which = V4L2_SUBDEV_FORMAT_ACTIVE,
...@@ -799,7 +803,6 @@ isp_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel) ...@@ -799,7 +803,6 @@ isp_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel)
return ret; return ret;
format.pad = pad; format.pad = pad;
format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &format); ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &format);
if (ret < 0) if (ret < 0)
return ret == -ENOIOCTLCMD ? -ENOTTY : ret; return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
...@@ -957,7 +960,9 @@ static int isp_video_check_external_subdevs(struct isp_video *video, ...@@ -957,7 +960,9 @@ static int isp_video_check_external_subdevs(struct isp_video *video,
struct media_pad *source_pad; struct media_pad *source_pad;
struct media_entity *source = NULL; struct media_entity *source = NULL;
struct media_entity *sink; struct media_entity *sink;
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_ext_controls ctrls; struct v4l2_ext_controls ctrls;
struct v4l2_ext_control ctrl; struct v4l2_ext_control ctrl;
unsigned int i; unsigned int i;
...@@ -993,7 +998,6 @@ static int isp_video_check_external_subdevs(struct isp_video *video, ...@@ -993,7 +998,6 @@ static int isp_video_check_external_subdevs(struct isp_video *video,
pipe->external = media_entity_to_v4l2_subdev(source); pipe->external = media_entity_to_v4l2_subdev(source);
fmt.pad = source_pad->index; fmt.pad = source_pad->index;
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(media_entity_to_v4l2_subdev(sink), ret = v4l2_subdev_call(media_entity_to_v4l2_subdev(sink),
pad, get_fmt, NULL, &fmt); pad, get_fmt, NULL, &fmt);
if (unlikely(ret < 0)) { if (unlikely(ret < 0)) {
......
...@@ -56,7 +56,9 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad) ...@@ -56,7 +56,9 @@ xvip_dma_remote_subdev(struct media_pad *local, u32 *pad)
static int xvip_dma_verify_format(struct xvip_dma *dma) static int xvip_dma_verify_format(struct xvip_dma *dma)
{ {
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
int ret; int ret;
...@@ -64,7 +66,6 @@ static int xvip_dma_verify_format(struct xvip_dma *dma) ...@@ -64,7 +66,6 @@ static int xvip_dma_verify_format(struct xvip_dma *dma)
if (subdev == NULL) if (subdev == NULL)
return -EPIPE; return -EPIPE;
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
if (ret < 0) if (ret < 0)
return ret == -ENOIOCTLCMD ? -EINVAL : ret; return ret == -ENOIOCTLCMD ? -EINVAL : ret;
......
...@@ -241,13 +241,13 @@ static int vimc_get_pix_format(struct media_pad *pad, ...@@ -241,13 +241,13 @@ static int vimc_get_pix_format(struct media_pad *pad,
if (is_media_entity_v4l2_subdev(pad->entity)) { if (is_media_entity_v4l2_subdev(pad->entity)) {
struct v4l2_subdev *sd = struct v4l2_subdev *sd =
media_entity_to_v4l2_subdev(pad->entity); media_entity_to_v4l2_subdev(pad->entity);
struct v4l2_subdev_format sd_fmt; struct v4l2_subdev_format sd_fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
.pad = pad->index,
};
const struct vimc_pix_map *pix_map; const struct vimc_pix_map *pix_map;
int ret; int ret;
sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
sd_fmt.pad = pad->index;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt); ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt);
if (ret) if (ret)
return ret; return ret;
......
...@@ -353,12 +353,13 @@ static int capture_legacy_enum_fmt_vid_cap(struct file *file, void *fh, ...@@ -353,12 +353,13 @@ static int capture_legacy_enum_fmt_vid_cap(struct file *file, void *fh,
{ {
struct capture_priv *priv = video_drvdata(file); struct capture_priv *priv = video_drvdata(file);
const struct imx_media_pixfmt *cc_src; const struct imx_media_pixfmt *cc_src;
struct v4l2_subdev_format fmt_src; struct v4l2_subdev_format fmt_src = {
.pad = priv->src_sd_pad,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
u32 fourcc; u32 fourcc;
int ret; int ret;
fmt_src.pad = priv->src_sd_pad;
fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(priv->src_sd, pad, get_fmt, NULL, &fmt_src); ret = v4l2_subdev_call(priv->src_sd, pad, get_fmt, NULL, &fmt_src);
if (ret) { if (ret) {
dev_err(priv->dev, "failed to get src_sd format\n"); dev_err(priv->dev, "failed to get src_sd format\n");
...@@ -426,11 +427,12 @@ static int capture_legacy_try_fmt_vid_cap(struct file *file, void *fh, ...@@ -426,11 +427,12 @@ static int capture_legacy_try_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct capture_priv *priv = video_drvdata(file); struct capture_priv *priv = video_drvdata(file);
struct v4l2_subdev_format fmt_src; struct v4l2_subdev_format fmt_src = {
.pad = priv->src_sd_pad,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
int ret; int ret;
fmt_src.pad = priv->src_sd_pad;
fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(priv->src_sd, pad, get_fmt, NULL, &fmt_src); ret = v4l2_subdev_call(priv->src_sd, pad, get_fmt, NULL, &fmt_src);
if (ret) if (ret)
return ret; return ret;
...@@ -445,7 +447,10 @@ static int capture_legacy_s_fmt_vid_cap(struct file *file, void *fh, ...@@ -445,7 +447,10 @@ static int capture_legacy_s_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct capture_priv *priv = video_drvdata(file); struct capture_priv *priv = video_drvdata(file);
struct v4l2_subdev_format fmt_src; struct v4l2_subdev_format fmt_src = {
.pad = priv->src_sd_pad,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
const struct imx_media_pixfmt *cc; const struct imx_media_pixfmt *cc;
int ret; int ret;
...@@ -454,8 +459,6 @@ static int capture_legacy_s_fmt_vid_cap(struct file *file, void *fh, ...@@ -454,8 +459,6 @@ static int capture_legacy_s_fmt_vid_cap(struct file *file, void *fh,
return -EBUSY; return -EBUSY;
} }
fmt_src.pad = priv->src_sd_pad;
fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(priv->src_sd, pad, get_fmt, NULL, &fmt_src); ret = v4l2_subdev_call(priv->src_sd, pad, get_fmt, NULL, &fmt_src);
if (ret) if (ret)
return ret; return ret;
...@@ -670,13 +673,14 @@ static void capture_buf_queue(struct vb2_buffer *vb) ...@@ -670,13 +673,14 @@ static void capture_buf_queue(struct vb2_buffer *vb)
static int capture_validate_fmt(struct capture_priv *priv) static int capture_validate_fmt(struct capture_priv *priv)
{ {
struct v4l2_subdev_format fmt_src; struct v4l2_subdev_format fmt_src = {
.pad = priv->src_sd_pad,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
const struct imx_media_pixfmt *cc; const struct imx_media_pixfmt *cc;
int ret; int ret;
/* Retrieve the media bus format on the source subdev. */ /* Retrieve the media bus format on the source subdev. */
fmt_src.pad = priv->src_sd_pad;
fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(priv->src_sd, pad, get_fmt, NULL, &fmt_src); ret = v4l2_subdev_call(priv->src_sd, pad, get_fmt, NULL, &fmt_src);
if (ret) if (ret)
return ret; return ret;
......
...@@ -610,7 +610,9 @@ static int ...@@ -610,7 +610,9 @@ static int
iss_video_try_format(struct file *file, void *fh, struct v4l2_format *format) iss_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
{ {
struct iss_video *video = video_drvdata(file); struct iss_video *video = video_drvdata(file);
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
u32 pad; u32 pad;
int ret; int ret;
...@@ -625,7 +627,6 @@ iss_video_try_format(struct file *file, void *fh, struct v4l2_format *format) ...@@ -625,7 +627,6 @@ iss_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
iss_video_pix_to_mbus(&format->fmt.pix, &fmt.format); iss_video_pix_to_mbus(&format->fmt.pix, &fmt.format);
fmt.pad = pad; fmt.pad = pad;
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
if (ret) if (ret)
return ret; return ret;
...@@ -638,7 +639,9 @@ static int ...@@ -638,7 +639,9 @@ static int
iss_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel) iss_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel)
{ {
struct iss_video *video = video_drvdata(file); struct iss_video *video = video_drvdata(file);
struct v4l2_subdev_format format; struct v4l2_subdev_format format = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
struct v4l2_subdev_selection sdsel = { struct v4l2_subdev_selection sdsel = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE, .which = V4L2_SUBDEV_FORMAT_ACTIVE,
...@@ -679,7 +682,6 @@ iss_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel) ...@@ -679,7 +682,6 @@ iss_video_get_selection(struct file *file, void *fh, struct v4l2_selection *sel)
return ret; return ret;
format.pad = pad; format.pad = pad;
format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &format); ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &format);
if (ret < 0) if (ret < 0)
return ret == -ENOIOCTLCMD ? -ENOTTY : ret; return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
......
...@@ -493,7 +493,9 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan, ...@@ -493,7 +493,9 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan,
const struct tegra_video_format *fmtinfo; const struct tegra_video_format *fmtinfo;
static struct lock_class_key key; static struct lock_class_key key;
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {
.which = V4L2_SUBDEV_FORMAT_TRY,
};
struct v4l2_subdev_state *sd_state; struct v4l2_subdev_state *sd_state;
struct v4l2_subdev_frame_size_enum fse = { struct v4l2_subdev_frame_size_enum fse = {
.which = V4L2_SUBDEV_FORMAT_TRY, .which = V4L2_SUBDEV_FORMAT_TRY,
...@@ -529,7 +531,6 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan, ...@@ -529,7 +531,6 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan,
} }
pix->field = V4L2_FIELD_NONE; pix->field = V4L2_FIELD_NONE;
fmt.which = V4L2_SUBDEV_FORMAT_TRY;
fmt.pad = 0; fmt.pad = 0;
v4l2_fill_mbus_format(&fmt.format, pix, fmtinfo->code); v4l2_fill_mbus_format(&fmt.format, pix, fmtinfo->code);
...@@ -590,7 +591,9 @@ static int tegra_channel_set_format(struct file *file, void *fh, ...@@ -590,7 +591,9 @@ static int tegra_channel_set_format(struct file *file, void *fh,
{ {
struct tegra_vi_channel *chan = video_drvdata(file); struct tegra_vi_channel *chan = video_drvdata(file);
const struct tegra_video_format *fmtinfo; const struct tegra_video_format *fmtinfo;
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
struct v4l2_pix_format *pix = &format->fmt.pix; struct v4l2_pix_format *pix = &format->fmt.pix;
int ret; int ret;
...@@ -605,7 +608,6 @@ static int tegra_channel_set_format(struct file *file, void *fh, ...@@ -605,7 +608,6 @@ static int tegra_channel_set_format(struct file *file, void *fh,
fmtinfo = tegra_get_format_by_fourcc(chan->vi, pix->pixelformat); fmtinfo = tegra_get_format_by_fourcc(chan->vi, pix->pixelformat);
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
fmt.pad = 0; fmt.pad = 0;
v4l2_fill_mbus_format(&fmt.format, pix, fmtinfo->code); v4l2_fill_mbus_format(&fmt.format, pix, fmtinfo->code);
subdev = tegra_channel_get_remote_source_subdev(chan); subdev = tegra_channel_get_remote_source_subdev(chan);
......
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