summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/m88ds3103.c
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2013-11-20 05:37:55 +0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-12-19 15:21:11 +0400
commit39c0029e60fe72da96dabfef5b469184d2011fcd (patch)
tree4b1fbb8c2aed71c62676ed9cf4a508c574e29d9c /drivers/media/dvb-frontends/m88ds3103.c
parent44b9055b4b058d7b02bf0380158627f9be79b9e5 (diff)
downloadlinux-39c0029e60fe72da96dabfef5b469184d2011fcd.tar.xz
[media] m88ds3103: use kernel macro to round division
DIV_ROUND_CLOSEST does the job and looks better. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends/m88ds3103.c')
-rw-r--r--drivers/media/dvb-frontends/m88ds3103.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c
index e07e8d6f5162..bd9effa985c0 100644
--- a/drivers/media/dvb-frontends/m88ds3103.c
+++ b/drivers/media/dvb-frontends/m88ds3103.c
@@ -460,8 +460,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
- u16tmp = (((c->symbol_rate / 1000) << 15) + (M88DS3103_MCLK_KHZ / 4)) /
- (M88DS3103_MCLK_KHZ / 2);
+ u16tmp = DIV_ROUND_CLOSEST((c->symbol_rate / 1000) << 15, M88DS3103_MCLK_KHZ / 2);
buf[0] = (u16tmp >> 0) & 0xff;
buf[1] = (u16tmp >> 8) & 0xff;
ret = m88ds3103_wr_regs(priv, 0x61, buf, 2);
@@ -484,7 +483,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
(tuner_frequency - c->frequency));
s32tmp = 0x10000 * (tuner_frequency - c->frequency);
- s32tmp = (2 * s32tmp + M88DS3103_MCLK_KHZ) / (2 * M88DS3103_MCLK_KHZ);
+ s32tmp = DIV_ROUND_CLOSEST(s32tmp, M88DS3103_MCLK_KHZ);
if (s32tmp < 0)
s32tmp += 0x10000;