diff options
author | Michael Krufky <mkrufky@kernellabs.com> | 2011-04-16 12:22:10 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-04-19 10:31:52 -0400 |
commit | 381ad0ea146465406a0740f437e9971ceb6465a9 (patch) | |
tree | d519c4b147f3e20c19b8f57a87e26aff8c1cb936 /drivers | |
parent | f78028b68f01925b826979627a2498111ea11bed (diff) |
[media] tda18271: prog_cal and prog_tab variables should be s32, not u8
Fix type of prog_cal and prog_tab variables to avoid any possible
calculation errors.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/common/tuners/tda18271-fe.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 42105d1c8613..d884f5eee73c 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -579,8 +579,8 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | |||
579 | #define RF3 2 | 579 | #define RF3 2 |
580 | u32 rf_default[3]; | 580 | u32 rf_default[3]; |
581 | u32 rf_freq[3]; | 581 | u32 rf_freq[3]; |
582 | u8 prog_cal[3]; | 582 | s32 prog_cal[3]; |
583 | u8 prog_tab[3]; | 583 | s32 prog_tab[3]; |
584 | 584 | ||
585 | i = tda18271_lookup_rf_band(fe, &freq, NULL); | 585 | i = tda18271_lookup_rf_band(fe, &freq, NULL); |
586 | 586 | ||
@@ -602,32 +602,33 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | |||
602 | return bcal; | 602 | return bcal; |
603 | 603 | ||
604 | tda18271_calc_rf_cal(fe, &rf_freq[rf]); | 604 | tda18271_calc_rf_cal(fe, &rf_freq[rf]); |
605 | prog_tab[rf] = regs[R_EB14]; | 605 | prog_tab[rf] = (s32)regs[R_EB14]; |
606 | 606 | ||
607 | if (1 == bcal) | 607 | if (1 == bcal) |
608 | prog_cal[rf] = tda18271_calibrate_rf(fe, rf_freq[rf]); | 608 | prog_cal[rf] = |
609 | (s32)tda18271_calibrate_rf(fe, rf_freq[rf]); | ||
609 | else | 610 | else |
610 | prog_cal[rf] = prog_tab[rf]; | 611 | prog_cal[rf] = prog_tab[rf]; |
611 | 612 | ||
612 | switch (rf) { | 613 | switch (rf) { |
613 | case RF1: | 614 | case RF1: |
614 | map[i].rf_a1 = 0; | 615 | map[i].rf_a1 = 0; |
615 | map[i].rf_b1 = (s32)(prog_cal[RF1] - prog_tab[RF1]); | 616 | map[i].rf_b1 = (prog_cal[RF1] - prog_tab[RF1]); |
616 | map[i].rf1 = rf_freq[RF1] / 1000; | 617 | map[i].rf1 = rf_freq[RF1] / 1000; |
617 | break; | 618 | break; |
618 | case RF2: | 619 | case RF2: |
619 | dividend = (s32)(prog_cal[RF2] - prog_tab[RF2] - | 620 | dividend = (prog_cal[RF2] - prog_tab[RF2] - |
620 | prog_cal[RF1] + prog_tab[RF1]); | 621 | prog_cal[RF1] + prog_tab[RF1]); |
621 | divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000; | 622 | divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000; |
622 | map[i].rf_a1 = (dividend / divisor); | 623 | map[i].rf_a1 = (dividend / divisor); |
623 | map[i].rf2 = rf_freq[RF2] / 1000; | 624 | map[i].rf2 = rf_freq[RF2] / 1000; |
624 | break; | 625 | break; |
625 | case RF3: | 626 | case RF3: |
626 | dividend = (s32)(prog_cal[RF3] - prog_tab[RF3] - | 627 | dividend = (prog_cal[RF3] - prog_tab[RF3] - |
627 | prog_cal[RF2] + prog_tab[RF2]); | 628 | prog_cal[RF2] + prog_tab[RF2]); |
628 | divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000; | 629 | divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000; |
629 | map[i].rf_a2 = (dividend / divisor); | 630 | map[i].rf_a2 = (dividend / divisor); |
630 | map[i].rf_b2 = (s32)(prog_cal[RF2] - prog_tab[RF2]); | 631 | map[i].rf_b2 = (prog_cal[RF2] - prog_tab[RF2]); |
631 | map[i].rf3 = rf_freq[RF3] / 1000; | 632 | map[i].rf3 = rf_freq[RF3] / 1000; |
632 | break; | 633 | break; |
633 | default: | 634 | default: |