diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-09-22 09:49:27 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-18 09:14:57 -0500 |
commit | 0545629e50af60e7afad9d6023a546aed1081a8e (patch) | |
tree | 89d227585f2e724bc09853c4daad2614d38bc825 /drivers/media/v4l2-core | |
parent | 01154ef5820a756283686247405a599c4ef7dc48 (diff) |
media: v4l2-common: get rid of struct v4l2_discrete_probe
This struct is there just two store two arguments of
v4l2_find_nearest_format(). The other two arguments are passed
as parameter.
IMHO, there isn't much sense on doing that, and that will just
add one more struct to document ;)
So, let's get rid of the struct, passing the parameters directly.
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-common.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index a5ea1f517291..35f20e7e6307 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -371,18 +371,19 @@ void v4l_bound_align_image(u32 *w, unsigned int wmin, unsigned int wmax, } EXPORT_SYMBOL_GPL(v4l_bound_align_image); -const struct v4l2_frmsize_discrete *v4l2_find_nearest_format( - const struct v4l2_discrete_probe *probe, - s32 width, s32 height) +const struct v4l2_frmsize_discrete * +v4l2_find_nearest_format(const struct v4l2_frmsize_discrete *sizes, + size_t num_sizes, + s32 width, s32 height) { int i; u32 error, min_error = UINT_MAX; const struct v4l2_frmsize_discrete *size, *best = NULL; - if (!probe) - return best; + if (!sizes) + return NULL; - for (i = 0, size = probe->sizes; i < probe->num_sizes; i++, size++) { + for (i = 0, size = sizes; i < num_sizes; i++, size++) { error = abs(size->width - width) + abs(size->height - height); if (error < min_error) { min_error = error; |