public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: Javi Merino <javi.merino@arm.com>, akpm@linux-foundation.org
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Subject: Re: [PATCH 4/4] media: cxd2820r: use DIV_ROUND_CLOSEST_ULL()
Date: Fri, 20 Mar 2015 13:17:54 +0200	[thread overview]
Message-ID: <550C01E2.7070702@iki.fi> (raw)
In-Reply-To: <1426850083-11049-5-git-send-email-javi.merino@arm.com>

On 03/20/2015 01:14 PM, Javi Merino wrote:
> Now that the kernel provides DIV_ROUND_CLOSEST_ULL(), drop the internal
> implementation and use the kernel one.
>
> Cc: Antti Palosaari <crope@iki.fi>
> Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> Signed-off-by: Javi Merino <javi.merino@arm.com>

Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>


Antti

> ---
> I've only compile-tested it, I don't have the hardware to run it.
>
>   drivers/media/dvb-frontends/cxd2820r_c.c    | 2 +-
>   drivers/media/dvb-frontends/cxd2820r_core.c | 6 ------
>   drivers/media/dvb-frontends/cxd2820r_priv.h | 2 --
>   drivers/media/dvb-frontends/cxd2820r_t.c    | 2 +-
>   drivers/media/dvb-frontends/cxd2820r_t2.c   | 2 +-
>   5 files changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c
> index 149fdca3fb44..72b0e2db3aab 100644
> --- a/drivers/media/dvb-frontends/cxd2820r_c.c
> +++ b/drivers/media/dvb-frontends/cxd2820r_c.c
> @@ -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;
>
> diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c
> index 422e84bbb008..490e090048ef 100644
> --- a/drivers/media/dvb-frontends/cxd2820r_core.c
> +++ b/drivers/media/dvb-frontends/cxd2820r_core.c
> @@ -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;
> diff --git a/drivers/media/dvb-frontends/cxd2820r_priv.h b/drivers/media/dvb-frontends/cxd2820r_priv.h
> index 7ff5f60c83e1..4b428959b16e 100644
> --- a/drivers/media/dvb-frontends/cxd2820r_priv.h
> +++ b/drivers/media/dvb-frontends/cxd2820r_priv.h
> @@ -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);
>
> diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c
> index 51401d036530..008cb2ac8480 100644
> --- a/drivers/media/dvb-frontends/cxd2820r_t.c
> +++ b/drivers/media/dvb-frontends/cxd2820r_t.c
> @@ -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);
> diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c
> index 9c0c4f42175c..35fe364c7182 100644
> --- a/drivers/media/dvb-frontends/cxd2820r_t2.c
> +++ b/drivers/media/dvb-frontends/cxd2820r_t2.c
> @@ -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);
>

-- 
http://palosaari.fi/

  reply	other threads:[~2015-03-20 11:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 11:14 [PATCH 0/4] Consolidate DIV_ROUND_CLOSEST_ULL() Javi Merino
2015-03-20 11:14 ` [PATCH 1/4] kernel.h: Implement DIV_ROUND_CLOSEST_ULL Javi Merino
2015-03-20 13:15   ` Alex Elder
2015-03-20 18:19   ` Emil Velikov
2015-03-20 18:27     ` Javi Merino
2015-03-23  7:41   ` Daniel Vetter
2015-03-23 12:34   ` Jeff Epler
2015-03-23 17:04     ` Javi Merino
2015-03-24 11:49       ` Javi Merino
2015-03-20 11:14 ` [PATCH 2/4] clk: bcm/kona: use DIV_ROUND_CLOSEST_ULL() Javi Merino
2015-03-20 11:14 ` [PATCH 3/4] cpuidle: menu: " Javi Merino
2015-03-20 11:14 ` [PATCH 4/4] media: cxd2820r: " Javi Merino
2015-03-20 11:17   ` Antti Palosaari [this message]
2015-03-20 13:51   ` Alex Elder
2015-03-20 17:27     ` Javi Merino
2015-03-20 19:46       ` Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550C01E2.7070702@iki.fi \
    --to=crope@iki.fi \
    --cc=akpm@linux-foundation.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=javi.merino@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox