Commit fd752429 authored by Fabian Frederick's avatar Fabian Frederick Committed by Mauro Carvalho Chehab

[media] v4l2-dv-timings: use swap() in v4l2_calc_aspect_ratio()

Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent cfcffe39
...@@ -665,7 +665,6 @@ EXPORT_SYMBOL_GPL(v4l2_detect_gtf); ...@@ -665,7 +665,6 @@ EXPORT_SYMBOL_GPL(v4l2_detect_gtf);
struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait) struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait)
{ {
struct v4l2_fract aspect = { 16, 9 }; struct v4l2_fract aspect = { 16, 9 };
u32 tmp;
u8 ratio; u8 ratio;
/* Nothing filled in, fallback to 16:9 */ /* Nothing filled in, fallback to 16:9 */
...@@ -697,9 +696,7 @@ struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait) ...@@ -697,9 +696,7 @@ struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait)
if (hor_landscape) if (hor_landscape)
return aspect; return aspect;
/* The aspect ratio is for portrait, so swap numerator and denominator */ /* The aspect ratio is for portrait, so swap numerator and denominator */
tmp = aspect.denominator; swap(aspect.denominator, aspect.numerator);
aspect.denominator = aspect.numerator;
aspect.numerator = tmp;
return aspect; return aspect;
} }
EXPORT_SYMBOL_GPL(v4l2_calc_aspect_ratio); EXPORT_SYMBOL_GPL(v4l2_calc_aspect_ratio);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment