diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-05-04 07:25:50 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-04-14 22:29:57 -0300 |
commit | 20efc1e9fc43e7e8a57996a6b2d1ca747363a738 (patch) | |
tree | 3aeeff4006da9151d2ebc7720e5330dd5f980eaf /drivers/media | |
parent | 961f0ab75e3ec67541ae5f2b2cca7b12b138cd83 (diff) |
[media] mt9v022: avoid calling mt9v022_find_datafmt() twice
Simplify mt9v022_s_fmt and mt9v022_set_fmt.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/i2c/soc_camera/mt9v022.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c index f3b5cf45c056..762f06919329 100644 --- a/drivers/media/i2c/soc_camera/mt9v022.c +++ b/drivers/media/i2c/soc_camera/mt9v022.c @@ -403,6 +403,7 @@ static int mt9v022_get_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 i2c_client *client = v4l2_get_subdevdata(sd); @@ -441,9 +442,8 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd, if (!ret) { mf->width = mt9v022->rect.width; mf->height = mt9v022->rect.height; - mt9v022->fmt = mt9v022_find_datafmt(mf->code, - mt9v022->fmts, mt9v022->num_fmts); - mf->colorspace = mt9v022->fmt->colorspace; + mt9v022->fmt = fmt; + mf->colorspace = fmt->colorspace; } return ret; @@ -478,7 +478,7 @@ static int mt9v022_set_fmt(struct v4l2_subdev *sd, mf->colorspace = fmt->colorspace; if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) - return mt9v022_s_fmt(sd, mf); + return mt9v022_s_fmt(sd, fmt, mf); cfg->try_fmt = *mf; return 0; } |