From d2dc57b10ae2bd2e2e92ce26f2aaf24bcee17c53 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Wed, 21 Mar 2018 16:29:27 -0400 Subject: media: v4l: Bring back array_size parameter to v4l2_find_nearest_size An older version of the driver patches were merged accidentally which resulted in missing the array_size parameter that tells the length of the array that contains the different supported sizes. Bring it back to v4l2_find_nearest size and make the corresponding change for the drivers using it as well. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-common.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/media/v4l2-common.h') diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 54b689247937..160bca96d524 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -320,6 +320,7 @@ void v4l_bound_align_image(unsigned int *width, unsigned int wmin, * set of resolutions contained in an array of a driver specific struct. * * @array: a driver specific array of image sizes + * @array_size: the length of the driver specific array of image sizes * @width_field: the name of the width field in the driver specific struct * @height_field: the name of the height field in the driver specific struct * @width: desired width. @@ -332,13 +333,13 @@ void v4l_bound_align_image(unsigned int *width, unsigned int wmin, * * Returns the best match or NULL if the length of the array is zero. */ -#define v4l2_find_nearest_size(array, width_field, height_field, \ +#define v4l2_find_nearest_size(array, array_size, width_field, height_field, \ width, height) \ ({ \ BUILD_BUG_ON(sizeof((array)->width_field) != sizeof(u32) || \ sizeof((array)->height_field) != sizeof(u32)); \ (typeof(&(*(array))))__v4l2_find_nearest_size( \ - (array), ARRAY_SIZE(array), sizeof(*(array)), \ + (array), array_size, sizeof(*(array)), \ offsetof(typeof(*(array)), width_field), \ offsetof(typeof(*(array)), height_field), \ width, height); \ -- cgit