Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2540066ybi; Mon, 17 Jun 2019 06:35:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzB4Rt0IuRWadO+xAfU7kdiz6r1sFo8m8fMiDt36m6zeWT+NTT15yKasJTtHwTP6IukM2xG X-Received: by 2002:a63:dc02:: with SMTP id s2mr7928640pgg.286.1560778545107; Mon, 17 Jun 2019 06:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560778545; cv=none; d=google.com; s=arc-20160816; b=o/iy7ZdlzroJVQBVh708mHLq2Q6wl9I8vk5XvhMCvX30LVZ57001Q0EuxLE9KoZgxB PYaGyfQu9TcHDPtidkxa3Uhw5UnUJTXnRwDD3oeAe/ccCGX30rCO1bOAjsxv8yz5Q/hX BlwYm9ETKVbhsN0e5H8dl7Aq27JutiHz3WrDVtY6kZHXLJM0sqfxnqAj0lthEuirkzWO O9YNNCKkfoil9WWUHx40mn4tAnsuqgGC+I1gRLvL4ctZdPEKP+S+/8ASAH7HFgIB0/v+ UvNhOh4vWpoMl8/6zfyExbdsMje8d5LDLbMM4Bw/G77UgMm/v8KF27NG/37JJSzA44C8 w7ew== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=/mWiNDbavVcRgGS4GzPemjFjFqE5XY0bzfKZQGVVG7c=; b=SJqrsQzx4lNSZu31jAwQdA7+BU9zii8+jzhzdMOTQwy8w18wGcgdUHjXqtL4MQChpj xOJ6ws/xoheyu1GEzcUaI4ca3TkkdUnSWGSiONTFzlAzdA3RA3vfD3cJ9lhyws95TTe7 yKmyai0Jtl5t8pKpfYTTM7UxdbsEYic2cgtSvEnTqHANEuNhZCsTVTzYjLpHXKNLhrb+ Cvg/U2fM5+famCzI2EAapPeLPOO9mxcgs7quRPOodVwKp+FP1EBM70hXehSYBMJzef+s kJ2068IAz0VYMC+ztxDrpX9ujFsAor5JQpUauNFxqFjHbD+BLTdKrBm+VR8xBYIBoCpJ PuGw== ARC-Authentication-Results: i=1; mx.google.com; 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 j12si11232561pgs.544.2019.06.17.06.35.28; Mon, 17 Jun 2019 06:35:45 -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; 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 S1727923AbfFQNd1 (ORCPT + 99 others); Mon, 17 Jun 2019 09:33:27 -0400 Received: from foss.arm.com ([217.140.110.172]:50190 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbfFQNd1 (ORCPT ); Mon, 17 Jun 2019 09:33:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7A2CC28; Mon, 17 Jun 2019 06:33:26 -0700 (PDT) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5AB533F246; Mon, 17 Jun 2019 06:33:26 -0700 (PDT) Received: by e110455-lin.cambridge.arm.com (Postfix, from userid 1000) id 260E9682413; Mon, 17 Jun 2019 14:33:25 +0100 (BST) Date: Mon, 17 Jun 2019 14:33:25 +0100 From: Liviu Dudau To: Arnd Bergmann Cc: "James (Qian) Wang" , Brian Starkey , David Airlie , Daniel Vetter , "Lowry Li (Arm Technology China)" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/komeda: fix 32-bit komeda_crtc_update_clock_ratio Message-ID: <20190617133325.GZ4173@e110455-lin.cambridge.arm.com> References: <20190617125121.1414507-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190617125121.1414507-1-arnd@arndb.de> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 17, 2019 at 02:51:04PM +0200, Arnd Bergmann wrote: > clang points out a bug in the clock calculation on 32-bit, that leads > to the clock_ratio always being zero: > > drivers/gpu/drm/arm/display/komeda/komeda_crtc.c:31:36: error: shift count >= width of type [-Werror,-Wshift-count-overflow] > aclk = komeda_calc_aclk(kcrtc_st) << 32; > > Move the shift into the division to make it apply on a 64-bit > variable. Also use the more expensive div64_u64() instead of div_u64() > to account for pxlclk being a 64-bit integer. > > Fixes: a962091227ed ("drm/komeda: Add engine clock requirement check for the downscaling") > Signed-off-by: Arnd Bergmann Acked-by: Liviu Dudau Thanks for the patch, I will pull it into the komeda tree. Best regards, Liviu > --- > drivers/gpu/drm/arm/display/komeda/komeda_crtc.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c > index cafb4457e187..3f222f464eb2 100644 > --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c > @@ -28,10 +28,9 @@ static void komeda_crtc_update_clock_ratio(struct komeda_crtc_state *kcrtc_st) > } > > pxlclk = kcrtc_st->base.adjusted_mode.clock * 1000; > - aclk = komeda_calc_aclk(kcrtc_st) << 32; > + aclk = komeda_calc_aclk(kcrtc_st); > > - do_div(aclk, pxlclk); > - kcrtc_st->clock_ratio = aclk; > + kcrtc_st->clock_ratio = div64_u64(aclk << 32, pxlclk); > } > > /** > -- > 2.20.0 > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯