V4L/DVB (9447): stb6100: improve rounding
authorReinhard Nissl <rnissl@gmx.de>
Mon, 21 Jan 2008 19:15:14 +0000 (16:15 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 29 Dec 2008 19:53:21 +0000 (17:53 -0200)
Optimization: Round the requested value to achieve a
+/-1MHz error instead of +0/-2MHz

Signed-off-by: Reinhard Nissl <rnissl@gmx.de>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/stb6100.c

index 0259a468950766357f172cfe0584650fc5d77b9d..5c6d06775dd5a545ccd2d9424c22132a6e1054ea 100644 (file)
@@ -276,7 +276,7 @@ static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
        else if (bandwidth <= 5000000)  /* bw/2 min = 5Mhz for F=0                      */
                tmp = 0;
        else                            /* if 5 < bw/2 < 36                             */
-               tmp = bandwidth / 1000000 - 5;
+               tmp = (bandwidth + 500000) / 1000000 - 5;
 
        /* Turn on LPF bandwidth setting clock control,
         * set bandwidth, wait 10ms, turn off.