diff options
author | Frank Schaefer <fschaefer.oss@googlemail.com> | 2017-04-16 13:35:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-04-19 07:58:41 -0400 |
commit | 38eeb491cf81dc8552d8b2e29f4f1807cb6e4d11 (patch) | |
tree | 1867517c2ff58903c832e629d0ae0b29cdcb0cf9 | |
parent | 2f7711b2ad3b2e2aa3e9e3db4d3a2887e38b52b3 (diff) |
[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: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/i2c/ov2640.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c index 07a51f255db5..8acdb6098d3f 100644 --- a/drivers/media/i2c/ov2640.c +++ b/drivers/media/i2c/ov2640.c | |||
@@ -778,21 +778,16 @@ static int ov2640_s_power(struct v4l2_subdev *sd, int on) | |||
778 | } | 778 | } |
779 | 779 | ||
780 | /* Select the nearest higher resolution for capture */ | 780 | /* Select the nearest higher resolution for capture */ |
781 | static const struct ov2640_win_size *ov2640_select_win(u32 *width, u32 *height) | 781 | static const struct ov2640_win_size *ov2640_select_win(u32 width, u32 height) |
782 | { | 782 | { |
783 | int i, default_size = ARRAY_SIZE(ov2640_supported_win_sizes) - 1; | 783 | int i, default_size = ARRAY_SIZE(ov2640_supported_win_sizes) - 1; |
784 | 784 | ||
785 | for (i = 0; i < ARRAY_SIZE(ov2640_supported_win_sizes); i++) { | 785 | for (i = 0; i < ARRAY_SIZE(ov2640_supported_win_sizes); i++) { |
786 | if (ov2640_supported_win_sizes[i].width >= *width && | 786 | if (ov2640_supported_win_sizes[i].width >= width && |
787 | ov2640_supported_win_sizes[i].height >= *height) { | 787 | ov2640_supported_win_sizes[i].height >= height) |
788 | *width = ov2640_supported_win_sizes[i].width; | ||
789 | *height = ov2640_supported_win_sizes[i].height; | ||
790 | return &ov2640_supported_win_sizes[i]; | 788 | return &ov2640_supported_win_sizes[i]; |
791 | } | ||
792 | } | 789 | } |
793 | 790 | ||
794 | *width = ov2640_supported_win_sizes[default_size].width; | ||
795 | *height = ov2640_supported_win_sizes[default_size].height; | ||
796 | return &ov2640_supported_win_sizes[default_size]; | 791 | return &ov2640_supported_win_sizes[default_size]; |
797 | } | 792 | } |
798 | 793 | ||
@@ -883,8 +878,7 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd, | |||
883 | return -EINVAL; | 878 | return -EINVAL; |
884 | 879 | ||
885 | if (!priv->win) { | 880 | if (!priv->win) { |
886 | u32 width = SVGA_WIDTH, height = SVGA_HEIGHT; | 881 | priv->win = ov2640_select_win(SVGA_WIDTH, SVGA_HEIGHT); |
887 | priv->win = ov2640_select_win(&width, &height); | ||
888 | priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8; | 882 | priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8; |
889 | } | 883 | } |
890 | 884 | ||
@@ -909,7 +903,9 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd, | |||
909 | return -EINVAL; | 903 | return -EINVAL; |
910 | 904 | ||
911 | /* select suitable win */ | 905 | /* select suitable win */ |
912 | win = ov2640_select_win(&mf->width, &mf->height); | 906 | win = ov2640_select_win(mf->width, mf->height); |
907 | mf->width = win->width; | ||
908 | mf->height = win->height; | ||
913 | 909 | ||
914 | mf->field = V4L2_FIELD_NONE; | 910 | mf->field = V4L2_FIELD_NONE; |
915 | mf->colorspace = V4L2_COLORSPACE_SRGB; | 911 | mf->colorspace = V4L2_COLORSPACE_SRGB; |