diff options
author | Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com> | 2016-04-27 03:07:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-06-09 14:58:32 -0400 |
commit | 917d11a4e0c8c9e3d375a7baa945fe0da6b15f88 (patch) | |
tree | 21488c9916d561b7ddd1039e010f81d39dae8942 | |
parent | d10f89cc36c3a302165d9d800ef97449793b9e6a (diff) |
[media] mt2063: use lib gcd
This patch removes the local MT2063_gcd function, uses lib gcd instead
Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/tuners/mt2063.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/drivers/media/tuners/mt2063.c b/drivers/media/tuners/mt2063.c index 6457ac91ef09..7f0b9d5940db 100644 --- a/drivers/media/tuners/mt2063.c +++ b/drivers/media/tuners/mt2063.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/string.h> | 25 | #include <linux/string.h> |
26 | #include <linux/videodev2.h> | 26 | #include <linux/videodev2.h> |
27 | #include <linux/gcd.h> | ||
27 | 28 | ||
28 | #include "mt2063.h" | 29 | #include "mt2063.h" |
29 | 30 | ||
@@ -665,27 +666,6 @@ static u32 MT2063_ChooseFirstIF(struct MT2063_AvoidSpursData_t *pAS_Info) | |||
665 | } | 666 | } |
666 | 667 | ||
667 | /** | 668 | /** |
668 | * gcd() - Uses Euclid's algorithm | ||
669 | * | ||
670 | * @u, @v: Unsigned values whose GCD is desired. | ||
671 | * | ||
672 | * Returns THE greatest common divisor of u and v, if either value is 0, | ||
673 | * the other value is returned as the result. | ||
674 | */ | ||
675 | static u32 MT2063_gcd(u32 u, u32 v) | ||
676 | { | ||
677 | u32 r; | ||
678 | |||
679 | while (v != 0) { | ||
680 | r = u % v; | ||
681 | u = v; | ||
682 | v = r; | ||
683 | } | ||
684 | |||
685 | return u; | ||
686 | } | ||
687 | |||
688 | /** | ||
689 | * IsSpurInBand() - Checks to see if a spur will be present within the IF's | 669 | * IsSpurInBand() - Checks to see if a spur will be present within the IF's |
690 | * bandwidth. (fIFOut +/- fIFBW, -fIFOut +/- fIFBW) | 670 | * bandwidth. (fIFOut +/- fIFBW, -fIFOut +/- fIFBW) |
691 | * | 671 | * |
@@ -731,12 +711,12 @@ static u32 IsSpurInBand(struct MT2063_AvoidSpursData_t *pAS_Info, | |||
731 | ** of f_LO1, f_LO2 and the edge value. Use the larger of this | 711 | ** of f_LO1, f_LO2 and the edge value. Use the larger of this |
732 | ** gcd-based scale factor or f_Scale. | 712 | ** gcd-based scale factor or f_Scale. |
733 | */ | 713 | */ |
734 | lo_gcd = MT2063_gcd(f_LO1, f_LO2); | 714 | lo_gcd = gcd(f_LO1, f_LO2); |
735 | gd_Scale = max((u32) MT2063_gcd(lo_gcd, d), f_Scale); | 715 | gd_Scale = max((u32) gcd(lo_gcd, d), f_Scale); |
736 | hgds = gd_Scale / 2; | 716 | hgds = gd_Scale / 2; |
737 | gc_Scale = max((u32) MT2063_gcd(lo_gcd, c), f_Scale); | 717 | gc_Scale = max((u32) gcd(lo_gcd, c), f_Scale); |
738 | hgcs = gc_Scale / 2; | 718 | hgcs = gc_Scale / 2; |
739 | gf_Scale = max((u32) MT2063_gcd(lo_gcd, f), f_Scale); | 719 | gf_Scale = max((u32) gcd(lo_gcd, f), f_Scale); |
740 | hgfs = gf_Scale / 2; | 720 | hgfs = gf_Scale / 2; |
741 | 721 | ||
742 | n0 = DIV_ROUND_UP(f_LO2 - d, f_LO1 - f_LO2); | 722 | n0 = DIV_ROUND_UP(f_LO2 - d, f_LO1 - f_LO2); |