[media] tua9001: use div_u64() for frequency calculation
authorAntti Palosaari <crope@iki.fi>
Thu, 16 Apr 2015 10:36:51 +0000 (07:36 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 18 May 2015 18:55:14 +0000 (15:55 -0300)
Use div_u64() to simplify and remove home made divides.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/tuners/tua9001.c
drivers/media/tuners/tua9001_priv.h

index 09a10349dd573e60b59afc9ab33486db1cb27568..d4f6ca0c4d925cb7f055cea994a9b8b0cc935381 100644 (file)
@@ -88,7 +88,6 @@ static int tua9001_set_params(struct dvb_frontend *fe)
        struct dtv_frontend_properties *c = &fe->dtv_property_cache;
        int ret, i;
        u16 val;
-       u32 frequency;
        struct tua9001_reg_val data[2];
 
        dev_dbg(&client->dev,
@@ -122,14 +121,8 @@ static int tua9001_set_params(struct dvb_frontend *fe)
 
        data[0].reg = 0x04;
        data[0].val = val;
-
-       frequency = (c->frequency - 150000000);
-       frequency /= 100;
-       frequency *= 48;
-       frequency /= 10000;
-
        data[1].reg = 0x1f;
-       data[1].val = frequency;
+       data[1].val = div_u64((u64) (c->frequency - 150000000) * 48, 1000000);
 
        if (fe->callback) {
                ret = fe->callback(client->adapter,
index 327ead9ea2ba5c832a26f05ed6569c47d00f1d90..bc406c5ec69d2ff71d56c0a82b6a30c1f8a12cd4 100644 (file)
@@ -18,6 +18,7 @@
 #define TUA9001_PRIV_H
 
 #include "tua9001.h"
+#include <linux/math64.h>
 #include <linux/regmap.h>
 
 struct tua9001_reg_val {