V4L/DVB (13110): tda18271: use temporary variables in tda18271_rf_tracking_filters_init
authorMichael Krufky <mkrufky@kernellabs.com>
Sun, 27 Sep 2009 20:00:13 +0000 (17:00 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Dec 2009 20:40:23 +0000 (18:40 -0200)
Use temporary variables for signed calulations between unsigned values

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/common/tuners/tda18271-fe.c

index 3a50ce96fcb9a6b0224254c2db369a3a7e53d28b..8b515a7d93f8117e700e8c46e6191b27beed3c73 100644 (file)
@@ -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;
        unsigned char *regs = priv->tda18271_regs;
        int bcal, rf, i;
+       s32 divisor, dividend;
 #define RF1 0
 #define RF2 1
 #define RF3 2
@@ -614,15 +615,17 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
                        map[i].rf1   = rf_freq[RF1] / 1000;
                        break;
                case RF2:
-                       map[i].rf_a1 = (prog_cal[RF2] - prog_tab[RF2] -
-                                       prog_cal[RF1] + prog_tab[RF1]) /
-                               (s32)((rf_freq[RF2] - rf_freq[RF1]) / 1000);
+                       dividend = (s32)(prog_cal[RF2] - prog_tab[RF2]) -
+                                  (s32)(prog_cal[RF1] + prog_tab[RF1]);
+                       divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000;
+                       map[i].rf_a1 = (dividend / divisor);
                        map[i].rf2   = rf_freq[RF2] / 1000;
                        break;
                case RF3:
-                       map[i].rf_a2 = (prog_cal[RF3] - prog_tab[RF3] -
-                                       prog_cal[RF2] + prog_tab[RF2]) /
-                               (s32)((rf_freq[RF3] - rf_freq[RF2]) / 1000);
+                       dividend = (s32)(prog_cal[RF3] - prog_tab[RF3]) -
+                                  (s32)(prog_cal[RF2] + prog_tab[RF2]);
+                       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].rf3   = rf_freq[RF3] / 1000;
                        break;