From patchwork Fri Jan 1 13:07:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101226 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp3951349lbb; Fri, 1 Jan 2016 05:07:54 -0800 (PST) X-Received: by 10.66.221.228 with SMTP id qh4mr106799469pac.68.1451653673989; Fri, 01 Jan 2016 05:07:53 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id fm5si40551440pab.89.2016.01.01.05.07.53; Fri, 01 Jan 2016 05:07:53 -0800 (PST) Received-SPF: pass (google.com: domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 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 2DEF472043; Fri, 1 Jan 2016 05:07:52 -0800 (PST) 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.130]) by gabe.freedesktop.org (Postfix) with ESMTPS id C923372043 for ; Fri, 1 Jan 2016 05:07:50 -0800 (PST) Received: from wuerfel.localnet ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue005) with ESMTPSA (Nemesis) id 0LjO9b-1ZgkXQ2Hkt-00dYF9; Fri, 01 Jan 2016 14:07:43 +0100 From: Arnd Bergmann To: Jammy Zhou , David Airlie Subject: [PATCH] drm: powerplay: use div64_s64 instead of do_div Date: Fri, 01 Jan 2016 14:07:41 +0100 Message-ID: <5249276.tkZ1gbxakA@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.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sTdz Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Alex Deucher , David Zhang , Eric Huang , Christian =?iso-8859-1?q?K=F6nig?= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The newly added code for Fiji creates a correct compiler warning about invalid use of the do_div macro: In file included from powerplay/hwmgr/ppatomctrl.c:31:0: drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/ppevvmath.h: In function 'fDivide': drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/ppevvmath.h:382:89: warning: comparison of distinct pointer types lacks a cast do_div(longlongX, longlongY); /*Q(32,32) divided by Q(16,16) = Q(16,16) Back to original format */ do_div() divides an unsigned 64-bit number by an unsigned 32-bit number. The code instead wants to divide two signed 64-bit numbers, which is done using the div64_s64 function. Signed-off-by: Arnd Bergmann Fixes: 770911a3cfbb ("drm/amd/powerplay: add/update headers for Fiji SMU and DPM") Reviewed-by: Thierry Reding Reviewed-by: Christian König --- Found on ARM allmodconfig on yesterday's linux-next diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h b/drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h index 42f2423cddea..411cb0fcdf98 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h @@ -379,7 +379,7 @@ fInt fDivide (fInt X, fInt Y) longlongX = longlongX << 16; /*Q(16,16) -> Q(32,32) */ - do_div(longlongX, longlongY); /*Q(32,32) divided by Q(16,16) = Q(16,16) Back to original format */ + div64_s64(longlongX, longlongY); /*Q(32,32) divided by Q(16,16) = Q(16,16) Back to original format */ fQuotient.full = (int)longlongX; return fQuotient;