media: cxd2820r: use DIV_ROUND_CLOSEST_ULL()
authorJavi Merino <javi.merino@arm.com>
Thu, 16 Apr 2015 19:43:54 +0000 (12:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Apr 2015 13:03:56 +0000 (09:03 -0400)
Now that the kernel provides DIV_ROUND_CLOSEST_ULL(), drop the internal
implementation and use the kernel one.

Signed-off-by: Javi Merino <javi.merino@arm.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/media/dvb-frontends/cxd2820r_c.c
drivers/media/dvb-frontends/cxd2820r_core.c
drivers/media/dvb-frontends/cxd2820r_priv.h
drivers/media/dvb-frontends/cxd2820r_t.c
drivers/media/dvb-frontends/cxd2820r_t2.c

index 149fdca3fb44e33fd60cda6c44de66041019c86c..72b0e2db3aab27f013db7e48c9335da6933f7f5d 100644 (file)
@@ -79,7 +79,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
 
        num = if_freq / 1000; /* Hz => kHz */
        num *= 0x4000;
-       if_ctl = 0x4000 - cxd2820r_div_u64_round_closest(num, 41000);
+       if_ctl = 0x4000 - DIV_ROUND_CLOSEST_ULL(num, 41000);
        buf[0] = (if_ctl >> 8) & 0x3f;
        buf[1] = (if_ctl >> 0) & 0xff;
 
index 422e84bbb008ffe685fb149f529c27ce4957cc70..490e090048ef639330cdb57290895b3e2e8787da 100644 (file)
@@ -244,12 +244,6 @@ error:
        return ret;
 }
 
-/* 64 bit div with round closest, like DIV_ROUND_CLOSEST but 64 bit */
-u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor)
-{
-       return div_u64(dividend + (divisor / 2), divisor);
-}
-
 static int cxd2820r_set_frontend(struct dvb_frontend *fe)
 {
        struct cxd2820r_priv *priv = fe->demodulator_priv;
index 7ff5f60c83e1f29d7600c1bd3169c813a6045d8e..4b428959b16e70317962a5c74eec0f8508fa61cb 100644 (file)
@@ -64,8 +64,6 @@ int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val,
 int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
        int len);
 
-u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor);
-
 int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
        int len);
 
index 51401d036530fbfd42d021c293a2a979b43af9c9..008cb2ac84804ff40aab36696bcb2eb3a0650082 100644 (file)
@@ -103,7 +103,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe)
 
        num = if_freq / 1000; /* Hz => kHz */
        num *= 0x1000000;
-       if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
+       if_ctl = DIV_ROUND_CLOSEST_ULL(num, 41000);
        buf[0] = ((if_ctl >> 16) & 0xff);
        buf[1] = ((if_ctl >>  8) & 0xff);
        buf[2] = ((if_ctl >>  0) & 0xff);
index 9c0c4f42175c5d3f9289a81e0fdbc90fc3b169c1..35fe364c7182182db6bc1874a942dee83f656933 100644 (file)
@@ -120,7 +120,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe)
 
        num = if_freq / 1000; /* Hz => kHz */
        num *= 0x1000000;
-       if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
+       if_ctl = DIV_ROUND_CLOSEST_ULL(num, 41000);
        buf[0] = ((if_ctl >> 16) & 0xff);
        buf[1] = ((if_ctl >>  8) & 0xff);
        buf[2] = ((if_ctl >>  0) & 0xff);