mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Thompson <daniel.thompson@linaro.org>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Jingoo Han <jingoohan1@gmail.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] backlight: pwm_bl: eliminate a 64/32 division
Date: Mon, 7 Oct 2019 16:13:19 +0100	[thread overview]
Message-ID: <20191007151319.de6ko7n5dypqgyce@holly.lan> (raw)
In-Reply-To: <20190919140620.32407-2-linux@rasmusvillemoes.dk>

On Thu, Sep 19, 2019 at 04:06:17PM +0200, Rasmus Villemoes wrote:
> lightness*1000 is nowhere near overflowing 32 bits, so we can just use
> an ordinary 32/32 division, which is much cheaper than the 64/32 done
> via do_div().
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>

> ---
>  drivers/video/backlight/pwm_bl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index be36be1cacb7..9252d51f31b9 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -177,7 +177,7 @@ static u64 cie1931(unsigned int lightness, unsigned int scale)
>  	 */
>  	lightness *= 100;
>  	if (lightness <= (8 * scale)) {
> -		retval = DIV_ROUND_CLOSEST_ULL(lightness * 10, 9033);
> +		retval = DIV_ROUND_CLOSEST(lightness * 10, 9033);
>  	} else {
>  		retval = int_pow((lightness + (16 * scale)) / 116, 3);
>  		retval = DIV_ROUND_CLOSEST_ULL(retval, (scale * scale));
> -- 
> 2.20.1

  reply	other threads:[~2019-10-07 15:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 14:06 [PATCH 1/5] backlight: pwm_bl: fix cie1913 comments and constant Rasmus Villemoes
2019-09-19 14:06 ` [PATCH 2/5] backlight: pwm_bl: eliminate a 64/32 division Rasmus Villemoes
2019-10-07 15:13   ` Daniel Thompson [this message]
2019-09-19 14:06 ` [PATCH 3/5] backlight: pwm_bl: drop use of int_pow() Rasmus Villemoes
2019-10-07 15:28   ` Daniel Thompson
2019-10-07 18:43     ` Rasmus Villemoes
2019-10-08  9:31       ` Daniel Thompson
2019-10-08 10:02         ` Rasmus Villemoes
2019-10-08 10:43           ` Daniel Thompson
2019-09-19 14:06 ` [PATCH 4/5] backlight: pwm_bl: switch to power-of-2 base for fixed-point math Rasmus Villemoes
2019-10-07 15:32   ` Daniel Thompson
2019-09-19 14:06 ` [PATCH 5/5] lib/math: remove int_pow() Rasmus Villemoes
2019-09-19 14:36   ` Andy Shevchenko
2019-09-21 15:19   ` kbuild test robot
2019-09-21 15:22   ` kbuild test robot
2019-09-20 10:14 ` [PATCH 1/5] backlight: pwm_bl: fix cie1913 comments and constant Daniel Thompson
2019-09-20 10:36   ` Rasmus Villemoes
2019-10-07 15:08 ` Daniel Thompson

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=20191007151319.de6ko7n5dypqgyce@holly.lan \
    --to=daniel.thompson@linaro.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jingoohan1@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=thierry.reding@gmail.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

all inboxes | Powered by JetHome®