]> git.baikalelectronics.ru Git - kernel.git/commit
drm: powerplay: use div64_s64 instead of do_div
authorArnd Bergmann <arnd@arndb.de>
Fri, 1 Jan 2016 13:07:41 +0000 (14:07 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Jan 2016 15:36:58 +0000 (10:36 -0500)
commitb5216cb8a1dc78365071fe5b1a30849cfd32fdec
tree855a3ba3d3cfd2297141a7431e6cf3e54f47b151
parent1c96a56b834d80545f89cd85de55b393c7944fe4
drm: powerplay: use div64_s64 instead of do_div

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.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a380ff6dd187 ("drm/amd/powerplay: add/update headers for Fiji SMU and DPM")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/ppevvmath.h