Commit 38eeb491 authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] ov2640: fix duplicate width+height returning from ov2640_select_win()

ov2640_select_win() returns height and width values as part of struct
ov2640_win_size, so there is no point in modifying the passed height and
width parameters, too.
Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 2f7711b2
...@@ -778,21 +778,16 @@ static int ov2640_s_power(struct v4l2_subdev *sd, int on) ...@@ -778,21 +778,16 @@ static int ov2640_s_power(struct v4l2_subdev *sd, int on)
} }
/* Select the nearest higher resolution for capture */ /* Select the nearest higher resolution for capture */
static const struct ov2640_win_size *ov2640_select_win(u32 *width, u32 *height) static const struct ov2640_win_size *ov2640_select_win(u32 width, u32 height)
{ {
int i, default_size = ARRAY_SIZE(ov2640_supported_win_sizes) - 1; int i, default_size = ARRAY_SIZE(ov2640_supported_win_sizes) - 1;
for (i = 0; i < ARRAY_SIZE(ov2640_supported_win_sizes); i++) { for (i = 0; i < ARRAY_SIZE(ov2640_supported_win_sizes); i++) {
if (ov2640_supported_win_sizes[i].width >= *width && if (ov2640_supported_win_sizes[i].width >= width &&
ov2640_supported_win_sizes[i].height >= *height) { ov2640_supported_win_sizes[i].height >= height)
*width = ov2640_supported_win_sizes[i].width;
*height = ov2640_supported_win_sizes[i].height;
return &ov2640_supported_win_sizes[i]; return &ov2640_supported_win_sizes[i];
} }
}
*width = ov2640_supported_win_sizes[default_size].width;
*height = ov2640_supported_win_sizes[default_size].height;
return &ov2640_supported_win_sizes[default_size]; return &ov2640_supported_win_sizes[default_size];
} }
...@@ -883,8 +878,7 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd, ...@@ -883,8 +878,7 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd,
return -EINVAL; return -EINVAL;
if (!priv->win) { if (!priv->win) {
u32 width = SVGA_WIDTH, height = SVGA_HEIGHT; priv->win = ov2640_select_win(SVGA_WIDTH, SVGA_HEIGHT);
priv->win = ov2640_select_win(&width, &height);
priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8; priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8;
} }
...@@ -909,7 +903,9 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd, ...@@ -909,7 +903,9 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
return -EINVAL; return -EINVAL;
/* select suitable win */ /* select suitable win */
win = ov2640_select_win(&mf->width, &mf->height); win = ov2640_select_win(mf->width, mf->height);
mf->width = win->width;
mf->height = win->height;
mf->field = V4L2_FIELD_NONE; mf->field = V4L2_FIELD_NONE;
mf->colorspace = V4L2_COLORSPACE_SRGB; mf->colorspace = V4L2_COLORSPACE_SRGB;
......
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