diff options
author | Michael Büsch <m@bues.ch> | 2013-02-07 16:16:55 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-08 20:50:33 +0100 |
commit | 03a497d4b4c5205f6a365c4673e21298e681a8a6 (patch) | |
tree | d540e1cc7df52d601de21ce330e16ce1ac30b634 /drivers/media | |
parent | Revert "[media] [PATH,1/2] mxl5007 move reset to attach" (diff) | |
download | linux-03a497d4b4c5205f6a365c4673e21298e681a8a6.tar.xz linux-03a497d4b4c5205f6a365c4673e21298e681a8a6.zip |
[media] fc0011: Fix xin value clamping
Fix the xin value clamping and use clamp_t().
Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/tuners/fc0011.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/media/tuners/fc0011.c b/drivers/media/tuners/fc0011.c index 3089f2ebcbfe..f87aa5a8b8ea 100644 --- a/drivers/media/tuners/fc0011.c +++ b/drivers/media/tuners/fc0011.c @@ -183,8 +183,7 @@ static int fc0011_set_params(struct dvb_frontend *fe) unsigned int i, vco_retries; u32 freq = p->frequency / 1000; u32 bandwidth = p->bandwidth_hz / 1000; - u32 fvco, xin, xdiv, xdivr; - u16 frac; + u32 fvco, xin, frac, xdiv, xdivr; u8 fa, fp, vco_sel, vco_cal; u8 regs[FC11_NR_REGS] = { }; @@ -227,12 +226,8 @@ static int fc0011_set_params(struct dvb_frontend *fe) frac += 32786; if (!frac) xin = 0; - else if (frac < 511) - xin = 512; - else if (frac < 65026) - xin = frac; else - xin = 65024; + xin = clamp_t(u32, frac, 512, 65024); regs[FC11_REG_XINHI] = xin >> 8; regs[FC11_REG_XINLO] = xin; |