Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp238265ybj; Thu, 19 Sep 2019 13:37:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBEOOSFyYIZ5etOYwsAqGbpHbwPuw41w1C7f3XB6OFO6G41Rk7bBCMDCuZAOMax7fqxuzY X-Received: by 2002:a17:906:6c98:: with SMTP id s24mr6699643ejr.28.1568925433821; Thu, 19 Sep 2019 13:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568925433; cv=none; d=google.com; s=arc-20160816; b=bal7A5qxquUXQ7O0trJkP0P//PNcw1x3m0TyOcdy7fJ0agKc/2Ny6EcKc2ZtJGlLl4 WxDhpC2WTqQsoiPPYXPfftvMb/eUDMP36M89wOdd1huxlfUAgx86+OvMXT9R8UNHCTLJ HOkPH/VaaN7R+sibL1ogOutJ5ZjvKlCQA3X+fp4K8OYgitzp1+Rl8lWTbQ4hY93BVtWV 26k8VxD0tR/d//QF3BN1B9MoF4PQQpOZ/jiMTN+mZX4ZoZrFZgWJFF/+r3Q12i5TSJjP A7BGoH0C5g57MaVuOIC9iOxgjDQcKq5TNWqtHnjzDKizlgMCoq5iklC5PtO8ckyYobjQ dK8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zBTcMpOyl2bLXBXPvlZrHA8WBZZACi7gNqiyseLnytg=; b=e+K7VDrEOfocUmNjHvcqXzeIS/4727yjYYy3pc4EnhSAornGrlOOUUcYCHuiQ8Vcov VzMphoj4TX/Yx/UfJR9fg3AjZrW2hEzhakhi6WYwrgXfm+L8ttJVaVvaKGgBDN6DbzLT FkbdNQ4FCKi0iSU+J3XbSUi4nuXNgPxANiQ0M/twUELAn2akGawXk0RXfl1OX0NOyQQ5 k6d73FAHhHmPypMIw6ulT40GZp8ILsxaKA25H+Bb3P8uCqCV1SfkuW/pq2mgoyEl7ZPF tYe2uIehtMxBAousgfW8P2A/kzYerSyEp2IbRjFXHkwiM74pG/K1lM4mo9X2wiOIQ0ZO KRKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=A48WL858; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k17si4888149ejz.227.2019.09.19.13.36.22; Thu, 19 Sep 2019 13:37:13 -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=@rasmusvillemoes.dk header.s=google header.b=A48WL858; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389368AbfISOGd (ORCPT + 99 others); Thu, 19 Sep 2019 10:06:33 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:33739 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389025AbfISOGd (ORCPT ); Thu, 19 Sep 2019 10:06:33 -0400 Received: by mail-lj1-f193.google.com with SMTP id a22so3793812ljd.0 for ; Thu, 19 Sep 2019 07:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zBTcMpOyl2bLXBXPvlZrHA8WBZZACi7gNqiyseLnytg=; b=A48WL858gPJVbFagBB2BTpTgHdTGMt1R9BC01trDu5z3ENfmhWS7RiqjnfWx20RoUY E0iQrrx0deYrkinYfpODZNFzuVCQBajUDYXy09Qkmb+GV1iPmOdfGkZktLbOEyqsuOiz 8Rwokwielo8W6w7zis9sx6uJ5V5kHfsVwrS8I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zBTcMpOyl2bLXBXPvlZrHA8WBZZACi7gNqiyseLnytg=; b=bJkL9KYgsnye1qpy5NJThl76iyW4uq9XOQeoJ5OJ64nio+Of+w9323ryoK0Q+IU/hq LITSCm564JWBcdxUPzKRhOmYxLL0P1dwAJcfINrVX9tSuBVWr/IWnSTyV9uUZ9GMIeDP /AvxBqXt8WXTA3DLKPp9/nvaqci8u2fETyKqJCdyUPAT/fcu7yr7cqnm4e4NAihjm9M+ ghk/epH8gPLp5KPEQHRlBCdgsxVCdgk9supx6GrKuAqAD5ltCoPNG3wJd75D65Uv/AKu 1HJSuWA4T2tDErnJSoJZ/Ksra8vfjzzBKf0xcNrVRTy6OueCw/sJkTujix/gb+HrjuxM 7Asw== X-Gm-Message-State: APjAAAVAnHqYsbZcrcRRzfN4D7qdeGRx+m8lXE+pMzKBe6kAOCuh/p7W BV4KJsddEf4cQ6dDh4Bzx2s+cw== X-Received: by 2002:a2e:6e18:: with SMTP id j24mr5534397ljc.158.1568901990286; Thu, 19 Sep 2019 07:06:30 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id h3sm1687886ljf.12.2019.09.19.07.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2019 07:06:29 -0700 (PDT) From: Rasmus Villemoes To: Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz Cc: Rasmus Villemoes , linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] backlight: pwm_bl: eliminate a 64/32 division Date: Thu, 19 Sep 2019 16:06:17 +0200 Message-Id: <20190919140620.32407-2-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190919140620.32407-1-linux@rasmusvillemoes.dk> References: <20190919140620.32407-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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