Commit 512eb720 authored by Javi Merino's avatar Javi Merino Committed by Linus Torvalds

media: cxd2820r: use DIV_ROUND_CLOSEST_ULL()

Now that the kernel provides DIV_ROUND_CLOSEST_ULL(), drop the internal
implementation and use the kernel one.
Signed-off-by: default avatarJavi Merino <javi.merino@arm.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: default avatarAntti Palosaari <crope@iki.fi>
Reviewed-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ee3c86f3
...@@ -79,7 +79,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) ...@@ -79,7 +79,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
num = if_freq / 1000; /* Hz => kHz */ num = if_freq / 1000; /* Hz => kHz */
num *= 0x4000; 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[0] = (if_ctl >> 8) & 0x3f;
buf[1] = (if_ctl >> 0) & 0xff; buf[1] = (if_ctl >> 0) & 0xff;
......
...@@ -244,12 +244,6 @@ int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio) ...@@ -244,12 +244,6 @@ int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio)
return ret; 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) static int cxd2820r_set_frontend(struct dvb_frontend *fe)
{ {
struct cxd2820r_priv *priv = fe->demodulator_priv; struct cxd2820r_priv *priv = fe->demodulator_priv;
......
...@@ -64,8 +64,6 @@ int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, ...@@ -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 cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
int len); 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 cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
int len); int len);
......
...@@ -103,7 +103,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe) ...@@ -103,7 +103,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe)
num = if_freq / 1000; /* Hz => kHz */ num = if_freq / 1000; /* Hz => kHz */
num *= 0x1000000; 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[0] = ((if_ctl >> 16) & 0xff);
buf[1] = ((if_ctl >> 8) & 0xff); buf[1] = ((if_ctl >> 8) & 0xff);
buf[2] = ((if_ctl >> 0) & 0xff); buf[2] = ((if_ctl >> 0) & 0xff);
......
...@@ -120,7 +120,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe) ...@@ -120,7 +120,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe)
num = if_freq / 1000; /* Hz => kHz */ num = if_freq / 1000; /* Hz => kHz */
num *= 0x1000000; 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[0] = ((if_ctl >> 16) & 0xff);
buf[1] = ((if_ctl >> 8) & 0xff); buf[1] = ((if_ctl >> 8) & 0xff);
buf[2] = ((if_ctl >> 0) & 0xff); buf[2] = ((if_ctl >> 0) & 0xff);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment