Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4424280ybp; Mon, 7 Oct 2019 08:16:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxA+N/QwDh2ms2PI8KgShApsS8AK+pi76j4rfS7zvz2W8m15onCdUTsAz8UeV6lcNXXbo4k X-Received: by 2002:a17:907:2067:: with SMTP id qp7mr7875598ejb.138.1570461372632; Mon, 07 Oct 2019 08:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570461372; cv=none; d=google.com; s=arc-20160816; b=ywnkyhLcqtamZ1ZblaJnB4FKYyKrt0HtKSdNtjbJ9W3VK4/3TXYlq8NtZBZHDcwLhl CBwueIeHtPlIGLQYCYObzruCf53zWF8Zu2sl/X04wa8CZDb1WtYHTglgyfjDkjvjtYkx DEmZUvSdzvkV9bznyl/mOUQZ485eI5l0+x4lCHl7z8LVQu7BXdQY+IKlC/KsliJ9De/x Rz9Ve4vWJ0HGFa/ByaDHsyStXr3jA5Mu9+T23XdiLjxMeezYwlJg9CyxGKGJhQO7HQ9z z9FUzz31dJnKJgXvz4Jiy/qMhXrKOA9nPFk52/wM3RahlU8M8SutQDF5vXKMEax+mBSO Tnzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zZhWwemYig8kkhxldGf4LKemMdD16O7Dc8IYXL4Z9nQ=; b=kZd5uWRxQLNmYxrwoSFTygKaogkA0I+iiVmQstIMiwRl8vyS18booR/KCmJx8+pjfw dGQ+nYZ8lmLMUBZCXD+7Pv93vI9j2Opz2WolvmwOZRocXwmm6p6F8ckd9blJJOt5eY7b XvWKZSzfRiUopF44SO9d3NEV+bXlj0whygFYKdhVSr8Pv+JFutZz9i4mlV44IbtigIXq ggGiDr18/QuY7Cc1FBQXW61slnJ5yFaEf1nV37Zwm491WL7yVkbQSkm2r9EGSTQdbTvz ZFdsVmOpqJnIzA9ThJa/F3KouMizF/lh6JCO+YZnDPp48oXzoZFPomq4eDJO6PNF11aQ RdFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TtfturaR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bq16si7328629ejb.221.2019.10.07.08.15.47; Mon, 07 Oct 2019 08:16:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TtfturaR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728263AbfJGPNY (ORCPT + 99 others); Mon, 7 Oct 2019 11:13:24 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53899 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727745AbfJGPNY (ORCPT ); Mon, 7 Oct 2019 11:13:24 -0400 Received: by mail-wm1-f66.google.com with SMTP id i16so13092193wmd.3 for ; Mon, 07 Oct 2019 08:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zZhWwemYig8kkhxldGf4LKemMdD16O7Dc8IYXL4Z9nQ=; b=TtfturaR8liADnZGl/3TkUOAnWRUKqPN60ooxnYYL6Va4SHdSH7tCSecNi7Y8dNBVv Sih8Zsx/P0NdmRovUTDJe4OefM0M3fYYZkH4Ua62ocK1kMsPnqFa7Jd7GlevAYguTp8W XGGqQNl9SfdSzxtH9TLnymc2P6hPk/2NiYyKUnEGd4D/dnQH8a7AYyfhHKZ+gSY2rhs0 f+Kp+YX+VBKSaaD4RCxkq1pJfGPNK5hjrT6zv/Q2jqxp3rScWis3JE7VYfsz9L5mpSK3 AJIWz6NA29ya4ZFpE6PfdJ1qGWzJ1SRoQjz583M8TK5FJWxbHjLuKCHxNOdeu1MiCL7R Cc1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zZhWwemYig8kkhxldGf4LKemMdD16O7Dc8IYXL4Z9nQ=; b=FbS1WNAOwKVhn5di1Wd3leObQoNmq1BFgz3fOi1P694oB/Gyg9d/8TBPYyDk4Oz+zU AjbqxUgLCYjRRdT+0uaTmk2yAb625oipGR20xVLJQckx3F4BZNn3dp80Lb2GMcgQ9PPD kL1z5TBAXMDbneJoK+9P19zMoLm2Mov9cqDiuWhfV27k0jMUdcsKAifu87Br1H3xO5xy RwqkKQpJcsp1jMtN6ofUA4GWn/aGTKBbvAjVQdv0YJz3NVxgIJTWTbsDnQw/KAicJPOn NPHwyLgFZw2sZaIoLtU7eUwwrcwURO9HrgwZ/AL5SIyCb7MtFxwmDQvT80k7S66x4jCJ W6bw== X-Gm-Message-State: APjAAAVbRdP/Z9V9cvhPWzA3OQk/zNgj7FIHeq6LY04WRckfDUkektzg 2Ah4PwhpqjtHnsS8w653cx5WMg== X-Received: by 2002:a7b:c148:: with SMTP id z8mr12606425wmi.95.1570461201869; Mon, 07 Oct 2019 08:13:21 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id a3sm28051120wmc.3.2019.10.07.08.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 08:13:21 -0700 (PDT) Date: Mon, 7 Oct 2019 16:13:19 +0100 From: Daniel Thompson To: Rasmus Villemoes Cc: Thierry Reding , Lee Jones , Jingoo Han , Bartlomiej Zolnierkiewicz , 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 Message-ID: <20191007151319.de6ko7n5dypqgyce@holly.lan> References: <20190919140620.32407-1-linux@rasmusvillemoes.dk> <20190919140620.32407-2-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190919140620.32407-2-linux@rasmusvillemoes.dk> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Daniel Thompson > --- > 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