Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Fabian Frederick and committed by
Mauro Carvalho Chehab
fd752429 cfcffe39

+1 -4
+1 -4
drivers/media/v4l2-core/v4l2-dv-timings.c
··· 665 665 struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait) 666 666 { 667 667 struct v4l2_fract aspect = { 16, 9 }; 668 - u32 tmp; 669 668 u8 ratio; 670 669 671 670 /* Nothing filled in, fallback to 16:9 */ ··· 696 697 if (hor_landscape) 697 698 return aspect; 698 699 /* The aspect ratio is for portrait, so swap numerator and denominator */ 699 - tmp = aspect.denominator; 700 - aspect.denominator = aspect.numerator; 701 - aspect.numerator = tmp; 700 + swap(aspect.denominator, aspect.numerator); 702 701 return aspect; 703 702 } 704 703 EXPORT_SYMBOL_GPL(v4l2_calc_aspect_ratio);