media: rcar-vin: Handle special pixel formats in a switch

Before extending the special pixel format handling turn the multiple if
statements into a switch.

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Niklas Söderlund
2019-12-06 17:39:31 +01:00
committed by Mauro Carvalho Chehab
parent 1498dfba51
commit 9ac560d48d

View File

@@ -73,11 +73,18 @@ const struct rvin_video_format *rvin_format_from_pixel(struct rvin_dev *vin,
{
int i;
if (vin->info->model == RCAR_M1 && pixelformat == V4L2_PIX_FMT_XBGR32)
return NULL;
if (pixelformat == V4L2_PIX_FMT_NV12 && !vin->info->nv12)
return NULL;
switch (pixelformat) {
case V4L2_PIX_FMT_XBGR32:
if (vin->info->model == RCAR_M1)
return NULL;
break;
case V4L2_PIX_FMT_NV12:
if (!vin->info->nv12)
return NULL;
break;
default:
break;
}
for (i = 0; i < ARRAY_SIZE(rvin_formats); i++)
if (rvin_formats[i].fourcc == pixelformat)