Commit 20efc1e9 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] mt9v022: avoid calling mt9v022_find_datafmt() twice

Simplify mt9v022_s_fmt and mt9v022_set_fmt.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 961f0ab7
...@@ -403,6 +403,7 @@ static int mt9v022_get_fmt(struct v4l2_subdev *sd, ...@@ -403,6 +403,7 @@ static int mt9v022_get_fmt(struct v4l2_subdev *sd,
} }
static int mt9v022_s_fmt(struct v4l2_subdev *sd, static int mt9v022_s_fmt(struct v4l2_subdev *sd,
const struct mt9v022_datafmt *fmt,
struct v4l2_mbus_framefmt *mf) struct v4l2_mbus_framefmt *mf)
{ {
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
...@@ -441,9 +442,8 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd, ...@@ -441,9 +442,8 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd,
if (!ret) { if (!ret) {
mf->width = mt9v022->rect.width; mf->width = mt9v022->rect.width;
mf->height = mt9v022->rect.height; mf->height = mt9v022->rect.height;
mt9v022->fmt = mt9v022_find_datafmt(mf->code, mt9v022->fmt = fmt;
mt9v022->fmts, mt9v022->num_fmts); mf->colorspace = fmt->colorspace;
mf->colorspace = mt9v022->fmt->colorspace;
} }
return ret; return ret;
...@@ -478,7 +478,7 @@ static int mt9v022_set_fmt(struct v4l2_subdev *sd, ...@@ -478,7 +478,7 @@ static int mt9v022_set_fmt(struct v4l2_subdev *sd,
mf->colorspace = fmt->colorspace; mf->colorspace = fmt->colorspace;
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return mt9v022_s_fmt(sd, mf); return mt9v022_s_fmt(sd, fmt, mf);
cfg->try_fmt = *mf; cfg->try_fmt = *mf;
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