[PATCH] drm: powerplay: use div64_s64 instead of do_div

2016-01-04 Thread Christian König
On 01.01.2016 14:07, Arnd Bergmann wrote:
> 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 

Reviewed-by: Christian König 

> Fixes: 770911a3cfbb ("drm/amd/powerplay: add/update headers for Fiji SMU and 
> DPM")
> ---
> 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;
>



[PATCH] drm: powerplay: use div64_s64 instead of do_div

2016-01-04 Thread Alex Deucher
On Fri, Jan 1, 2016 at 8:07 AM, Arnd Bergmann  wrote:
> 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")

Applied.  thanks!

Alex

> ---
> 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;
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm: powerplay: use div64_s64 instead of do_div

2016-01-04 Thread Thierry Reding
On Fri, Jan 01, 2016 at 02:07:41PM +0100, Arnd Bergmann wrote:
> 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")
> ---
> Found on ARM allmodconfig on yesterday's linux-next 

Reviewed-by: Thierry Reding 
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 



[PATCH] drm: powerplay: use div64_s64 instead of do_div

2016-01-01 Thread Arnd Bergmann
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")
---
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;