media: imx: capture: Simplify capture_validate_fmt() implementation
capture_validate_fmt() delegates the media bus format to pixel format
conversion to __capture_legacy_try_fmt(). It turns out that this can be
simplified quite a lot:
- The format lookup from media bus code can be performed by the recently
added capture_find_format() function instead of receiving the
information from a side effect of __capture_legacy_try_fmt().
- The validation of the pixel format size isn't needed, as they
duplicate the validation of the compose rectangle. The pixel format
size is directly derived from the size of the incoming stream, which
is stored in the compose rectangle. If the compose rectangle is valid,
the pixel format size will be valid too.
By removing the validation of the pixel format size and using
capture_find_format() to lookup the format, we can stop using
__capture_legacy_try_fmt() and simplify capture_validate_fmt().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 file changed