Commit 381ad0ea authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

[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: default avatarMichael Krufky <mkrufky@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f78028b6
...@@ -579,8 +579,8 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) ...@@ -579,8 +579,8 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
#define RF3 2 #define RF3 2
u32 rf_default[3]; u32 rf_default[3];
u32 rf_freq[3]; u32 rf_freq[3];
u8 prog_cal[3]; s32 prog_cal[3];
u8 prog_tab[3]; s32 prog_tab[3];
i = tda18271_lookup_rf_band(fe, &freq, NULL); i = tda18271_lookup_rf_band(fe, &freq, NULL);
...@@ -602,32 +602,33 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) ...@@ -602,32 +602,33 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
return bcal; return bcal;
tda18271_calc_rf_cal(fe, &rf_freq[rf]); tda18271_calc_rf_cal(fe, &rf_freq[rf]);
prog_tab[rf] = regs[R_EB14]; prog_tab[rf] = (s32)regs[R_EB14];
if (1 == bcal) if (1 == bcal)
prog_cal[rf] = tda18271_calibrate_rf(fe, rf_freq[rf]); prog_cal[rf] =
(s32)tda18271_calibrate_rf(fe, rf_freq[rf]);
else else
prog_cal[rf] = prog_tab[rf]; prog_cal[rf] = prog_tab[rf];
switch (rf) { switch (rf) {
case RF1: case RF1:
map[i].rf_a1 = 0; map[i].rf_a1 = 0;
map[i].rf_b1 = (s32)(prog_cal[RF1] - prog_tab[RF1]); map[i].rf_b1 = (prog_cal[RF1] - prog_tab[RF1]);
map[i].rf1 = rf_freq[RF1] / 1000; map[i].rf1 = rf_freq[RF1] / 1000;
break; break;
case RF2: case RF2:
dividend = (s32)(prog_cal[RF2] - prog_tab[RF2] - dividend = (prog_cal[RF2] - prog_tab[RF2] -
prog_cal[RF1] + prog_tab[RF1]); prog_cal[RF1] + prog_tab[RF1]);
divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000; divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000;
map[i].rf_a1 = (dividend / divisor); map[i].rf_a1 = (dividend / divisor);
map[i].rf2 = rf_freq[RF2] / 1000; map[i].rf2 = rf_freq[RF2] / 1000;
break; break;
case RF3: case RF3:
dividend = (s32)(prog_cal[RF3] - prog_tab[RF3] - dividend = (prog_cal[RF3] - prog_tab[RF3] -
prog_cal[RF2] + prog_tab[RF2]); prog_cal[RF2] + prog_tab[RF2]);
divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000; divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000;
map[i].rf_a2 = (dividend / divisor); map[i].rf_a2 = (dividend / divisor);
map[i].rf_b2 = (s32)(prog_cal[RF2] - prog_tab[RF2]); map[i].rf_b2 = (prog_cal[RF2] - prog_tab[RF2]);
map[i].rf3 = rf_freq[RF3] / 1000; map[i].rf3 = rf_freq[RF3] / 1000;
break; break;
default: default:
......
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