From 81355e40826acea76274c2ef5ff7d156ff28d183 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 24 Dec 2009 14:12:15 +0100 Subject: soc-camera: adjust coding style to match V4L preferences Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/soc_mediabus.c | 45 +++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'drivers/media/video/soc_mediabus.c') diff --git a/drivers/media/video/soc_mediabus.c b/drivers/media/video/soc_mediabus.c index f8d5c87dc2aa..0149290ee5a6 100644 --- a/drivers/media/video/soc_mediabus.c +++ b/drivers/media/video/soc_mediabus.c @@ -24,91 +24,106 @@ static const struct soc_mbus_pixelfmt mbus_fmt[] = { .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(YVYU8_2X8_LE)] = { + }, + [MBUS_IDX(YVYU8_2X8_LE)] = { .fourcc = V4L2_PIX_FMT_YVYU, .name = "YVYU", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(YUYV8_2X8_BE)] = { + }, + [MBUS_IDX(YUYV8_2X8_BE)] = { .fourcc = V4L2_PIX_FMT_UYVY, .name = "UYVY", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(YVYU8_2X8_BE)] = { + }, + [MBUS_IDX(YVYU8_2X8_BE)] = { .fourcc = V4L2_PIX_FMT_VYUY, .name = "VYUY", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(RGB555_2X8_PADHI_LE)] = { + }, + [MBUS_IDX(RGB555_2X8_PADHI_LE)] = { .fourcc = V4L2_PIX_FMT_RGB555, .name = "RGB555", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(RGB555_2X8_PADHI_BE)] = { + }, + [MBUS_IDX(RGB555_2X8_PADHI_BE)] = { .fourcc = V4L2_PIX_FMT_RGB555X, .name = "RGB555X", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(RGB565_2X8_LE)] = { + }, + [MBUS_IDX(RGB565_2X8_LE)] = { .fourcc = V4L2_PIX_FMT_RGB565, .name = "RGB565", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(RGB565_2X8_BE)] = { + }, + [MBUS_IDX(RGB565_2X8_BE)] = { .fourcc = V4L2_PIX_FMT_RGB565X, .name = "RGB565X", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(SBGGR8_1X8)] = { + }, + [MBUS_IDX(SBGGR8_1X8)] = { .fourcc = V4L2_PIX_FMT_SBGGR8, .name = "Bayer 8 BGGR", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_NONE, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(SBGGR10_1X10)] = { + }, + [MBUS_IDX(SBGGR10_1X10)] = { .fourcc = V4L2_PIX_FMT_SBGGR10, .name = "Bayer 10 BGGR", .bits_per_sample = 10, .packing = SOC_MBUS_PACKING_EXTEND16, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(GREY8_1X8)] = { + }, + [MBUS_IDX(GREY8_1X8)] = { .fourcc = V4L2_PIX_FMT_GREY, .name = "Grey", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_NONE, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(Y10_1X10)] = { + }, + [MBUS_IDX(Y10_1X10)] = { .fourcc = V4L2_PIX_FMT_Y10, .name = "Grey 10bit", .bits_per_sample = 10, .packing = SOC_MBUS_PACKING_EXTEND16, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(SBGGR10_2X8_PADHI_LE)] = { + }, + [MBUS_IDX(SBGGR10_2X8_PADHI_LE)] = { .fourcc = V4L2_PIX_FMT_SBGGR10, .name = "Bayer 10 BGGR", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(SBGGR10_2X8_PADLO_LE)] = { + }, + [MBUS_IDX(SBGGR10_2X8_PADLO_LE)] = { .fourcc = V4L2_PIX_FMT_SBGGR10, .name = "Bayer 10 BGGR", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADLO, .order = SOC_MBUS_ORDER_LE, - }, [MBUS_IDX(SBGGR10_2X8_PADHI_BE)] = { + }, + [MBUS_IDX(SBGGR10_2X8_PADHI_BE)] = { .fourcc = V4L2_PIX_FMT_SBGGR10, .name = "Bayer 10 BGGR", .bits_per_sample = 8, .packing = SOC_MBUS_PACKING_2X8_PADHI, .order = SOC_MBUS_ORDER_BE, - }, [MBUS_IDX(SBGGR10_2X8_PADLO_BE)] = { + }, + [MBUS_IDX(SBGGR10_2X8_PADLO_BE)] = { .fourcc = V4L2_PIX_FMT_SBGGR10, .name = "Bayer 10 BGGR", .bits_per_sample = 8, -- cgit v1.2.3 From 84f3751d6a6f766780dee509433bf7b3dfcdf465 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Fri, 19 Feb 2010 14:09:25 -0300 Subject: V4L/DVB: v4l: soc_camera: fix bound checking of mbus_fmt[] index When code <= V4L2_MBUS_FMT_FIXED soc_mbus_get_fmtdesc returns a pointer to mbus_fmt[x], where x < 0. Fix this. Signed-off-by: Baruch Siach Signed-off-by: Guennadi Liakhovetski CC: stable@kernel.org Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/soc_mediabus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/media/video/soc_mediabus.c') diff --git a/drivers/media/video/soc_mediabus.c b/drivers/media/video/soc_mediabus.c index 0149290ee5a6..8b63b6545e76 100644 --- a/drivers/media/video/soc_mediabus.c +++ b/drivers/media/video/soc_mediabus.c @@ -149,7 +149,8 @@ EXPORT_SYMBOL(soc_mbus_bytes_per_line); const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( enum v4l2_mbus_pixelcode code) { - if ((unsigned int)(code - V4L2_MBUS_FMT_FIXED) > ARRAY_SIZE(mbus_fmt)) + if (code - V4L2_MBUS_FMT_FIXED > ARRAY_SIZE(mbus_fmt) || + code <= V4L2_MBUS_FMT_FIXED) return NULL; return mbus_fmt + code - V4L2_MBUS_FMT_FIXED - 1; } -- cgit v1.2.3