Commit 3986bd11 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (13110): tda18271: use temporary variables in tda18271_rf_tracking_filters_init

Use temporary variables for signed calulations between unsigned values
Signed-off-by: default avatarMichael Krufky <mkrufky@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b450b92e
...@@ -572,6 +572,7 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) ...@@ -572,6 +572,7 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state; struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
unsigned char *regs = priv->tda18271_regs; unsigned char *regs = priv->tda18271_regs;
int bcal, rf, i; int bcal, rf, i;
s32 divisor, dividend;
#define RF1 0 #define RF1 0
#define RF2 1 #define RF2 1
#define RF3 2 #define RF3 2
...@@ -614,15 +615,17 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) ...@@ -614,15 +615,17 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
map[i].rf1 = rf_freq[RF1] / 1000; map[i].rf1 = rf_freq[RF1] / 1000;
break; break;
case RF2: case RF2:
map[i].rf_a1 = (prog_cal[RF2] - prog_tab[RF2] - dividend = (s32)(prog_cal[RF2] - prog_tab[RF2]) -
prog_cal[RF1] + prog_tab[RF1]) / (s32)(prog_cal[RF1] + prog_tab[RF1]);
(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].rf2 = rf_freq[RF2] / 1000; map[i].rf2 = rf_freq[RF2] / 1000;
break; break;
case RF3: case RF3:
map[i].rf_a2 = (prog_cal[RF3] - prog_tab[RF3] - dividend = (s32)(prog_cal[RF3] - prog_tab[RF3]) -
prog_cal[RF2] + prog_tab[RF2]) / (s32)(prog_cal[RF2] + prog_tab[RF2]);
(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_b2 = 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;
......
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