include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / media / dvb / frontends / stb6100.c
index ff39275..f73c133 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/string.h>
 
 #include "dvb_frontend.h"
@@ -367,7 +368,9 @@ static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
        /* N(I) = floor(f(VCO) / (f(XTAL) * (PSD2 ? 2 : 1)))    */
        nint = fvco / (state->reference << psd2);
        /* N(F) = round(f(VCO) / f(XTAL) * (PSD2 ? 2 : 1) - N(I)) * 2 ^ 9       */
-       nfrac = (((fvco - (nint * state->reference << psd2)) << (9 - psd2)) + state->reference / 2) / state->reference;
+       nfrac = DIV_ROUND_CLOSEST((fvco - (nint * state->reference << psd2))
+                                        << (9 - psd2),
+                                 state->reference);
        dprintk(verbose, FE_DEBUG, 1,
                "frequency = %u, srate = %u, g = %u, odiv = %u, psd2 = %u, fxtal = %u, osm = %u, fvco = %u, N(I) = %u, N(F) = %u",
                frequency, srate, (unsigned int)g, (unsigned int)odiv,
@@ -427,11 +430,11 @@ static int stb6100_init(struct dvb_frontend *fe)
        status->refclock        = 27000000;     /* Hz   */
        status->iqsense         = 1;
        status->bandwidth       = 36000;        /* kHz  */
-       state->bandwidth        = status->bandwidth * 1000;     /* MHz  */
+       state->bandwidth        = status->bandwidth * 1000;     /* Hz   */
        state->reference        = status->refclock / 1000;      /* kHz  */
 
        /* Set default bandwidth.       */
-       return stb6100_set_bandwidth(fe, status->bandwidth);
+       return stb6100_set_bandwidth(fe, state->bandwidth);
 }
 
 static int stb6100_get_state(struct dvb_frontend *fe,