From patchwork Mon Jun 17 12:51:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 167019 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2823812ilk; Mon, 17 Jun 2019 05:51:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8+PBCUaAVvytoPXub27RGKt/wEGvtqWRff7MWFhCFZH6XR5dVXysaou6ds7SJXTwysmNk X-Received: by 2002:a17:902:7883:: with SMTP id q3mr106437251pll.89.1560775892219; Mon, 17 Jun 2019 05:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560775892; cv=none; d=google.com; s=arc-20160816; b=nMA0h/Bxln5QANzCS1aZ84HsANsbpZepa5m0Vm0wFzvQdUN1glJM9UC9wV9IghuqJj 0NM2umYeUDMBfvtymdN3bUoPzRw8It/NrLC08c2K/lazv7aCH28R09biJPQcL8yMt8MU PczYugVXh9GoLnOhZKSRaK6dnTWNFBU5Vg9Pkvs49miL1DUf8/roXfQ9Vf4Lnkb5ZEci HSJCp05MxVZtrOeLaMpwYFW6945o8KA0Kdityirn1YUoofHEwd8HaUrzhJCIbxkqtjlA wji/6WKpZhJ30msA6r2XX9WjekOzKgV6W5nejJo2WXyqsbOt+uvp1GEkWUHrf2QoBNge okyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=yHIDXnUikIceMs66+RPWZqgFFIzM3C2VrOsTFWVO5Wk=; b=SGtnKbywpNMasEGNLG/rPUPBRSaL2p7fKNYGSAPUqp9vgkWnBbEIm5La22JjMZ+Ioe FTuGceSlfImJBhNRYc0haeHlgkJytHFcZw0qtDrGZg2IeMQnG/gwff2DpB86VKaQxASD ubGFOMheHF/NlsOECwmyMMqj/Zt5k92aboXGbwhT95Dh2obWfgGbxk7zwkJv2eZ7g1Sv 7o/53zkO6YwvPu76KhZxM7GbwVjXl8y1xMuK70JJq1zDbfRAFYdY17B4wZqma8KtIvJs S3y84yTO0WHIjf5hTRlMKkExMuObLLlD45PsbB2OlXf2PYp8/KoGb4dBjJDYQKIxgEqf pP5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id p13si11090138pgd.347.2019.06.17.05.51.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Jun 2019 05:51:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A62278923C; Mon, 17 Jun 2019 12:51:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) by gabe.freedesktop.org (Postfix) with ESMTPS id 091728923C for ; Mon, 17 Jun 2019 12:51:27 +0000 (UTC) Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mae7u-1iDYhN3MgU-00cAt7; Mon, 17 Jun 2019 14:51:23 +0200 From: Arnd Bergmann To: "James (Qian) Wang" , Liviu Dudau , Brian Starkey , David Airlie , Daniel Vetter Subject: [PATCH] drm/komeda: fix 32-bit komeda_crtc_update_clock_ratio Date: Mon, 17 Jun 2019 14:51:04 +0200 Message-Id: <20190617125121.1414507-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:YNZWWtAS0xzrrfM3pjl8AX7tgKroNKj7VFYbWmDIWP/c+QDu9S7 gDzeeip7x3tIK53FmtWpRwGHG5N939FLMnzAsoVcZaSW6/75zGoPpl5A3CoovOmO27pN0bu +st/zT8a1j8o/NkZMy9MfDYpsgyizzJO+Zecj5us03TSbd2deNIluDsQ0DA0iiCQE4u6SJz 5dh87wbTaBXhC9/NXsyfg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:PW9GCohIInk=:aQ0AToBxA4KMITMsE6cbZd juUFYtzR/V0Dv2gTDcYLEKSU9/lX85CRt9wTtq9n2K0GuoDniFeKoMSv3kH9wQsYyBSl1GOT+ Hxc2TIgRvv2yxH80NHgQ19qoblsq+tlaPGedNOsisEoFymDHTOj1qJ4ojrTJ53Ss826ZH0MRd sDIyFNlw8Z3P0XU0qu7hDEqdY+Nu+pcACQwG3t+ywZyEcMzUoyQ4h/6DxGXUsqafWvTQSk5Bg AT6JNPDPoxwlWvFbrnY9JkNyY7dg/5J5jT8i5Wu8dA8EFKBmMxoTUyG7mJZneJHTVR25U7J8r 6NNgyAifw76O4YbYvkeMLGAV2MGjytvaKLDMI46qMwwy4wnF8ExI7ZEQoQdbnNjKIh/glQtQi n9E47x1U/LYi/9LLltQZ9QJjlYb90ntJVC0j7GfroYkHKG+dYuClIJm7rUswXLPV4INl9mTky zwMsdvJjxnkia4JBdDQjkcWNRaPXujcRI+TABRKxmt0GBRlqaKeOZ0bVC3+cUjSM0Vnpif//Z xj8WVCPbVZ6mzuNoIA3aTVTq/uUn1g7FIqF97AKKiH176ZBXmPm/YRhFh6N5qrY5focL6IMQH K8V9R7FwTpU+NQtAsoUOw0DbO4JXvdcof5aJdABDJl2e5l/Qa0DJarsKjVxmkDzKerCNBx/yo I8cY6vMFjuZOtV+DKIjXufoz25+pUl4RkYQWVEBrVzwx9ckEoPO7C9jjOORUJb2BX74ud2lMz oD0NTcn6AeHkjHNkWQEDtEUlePIiIhqs+nkvmA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Lowry Li \(Arm Technology China\)" , dri-devel@lists.freedesktop.org, Arnd Bergmann , linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: James Qian Wang (Arm Technology China) --- 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); } /**