Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1299903 > unrolled thread

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

Started byArnd Bergmann <arnd@arndb.de>
First post2016-01-01 14:10 +0100
Last post2016-01-04 16:50 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm: powerplay: use div64_s64 instead of do_div Arnd Bergmann <arnd@arndb.de> - 2016-01-01 14:10 +0100
    Re: [PATCH] drm: powerplay: use div64_s64 instead of do_div Thierry Reding <thierry.reding@gmail.com> - 2016-01-04 09:20 +0100
    Re: [PATCH] drm: powerplay: use div64_s64 instead of do_div Christian König <christian.koenig@amd.com> - 2016-01-04 13:50 +0100
    Re: [PATCH] drm: powerplay: use div64_s64 instead of do_div Alex Deucher <alexdeucher@gmail.com> - 2016-01-04 16:50 +0100

#1299903 — [PATCH] drm: powerplay: use div64_s64 instead of do_div

FromArnd Bergmann <arnd@arndb.de>
Date2016-01-01 14:10 +0100
Subject[PATCH] drm: powerplay: use div64_s64 instead of do_div
Message-ID<qM7CV-2R6-1@gated-at.bofh.it>
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 <arnd@arndb.de>
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;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1300541

FromThierry Reding <thierry.reding@gmail.com>
Date2016-01-04 09:20 +0100
Message-ID<qN8wW-VH-17@gated-at.bofh.it>
In reply to#1299903

[Multipart message — attachments visible in raw view] — view raw

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 <arnd@arndb.de>
> 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 <treding@nvidia.com>

[toc] | [prev] | [next] | [standalone]


#1300732

FromChristian König <christian.koenig@amd.com>
Date2016-01-04 13:50 +0100
Message-ID<qNcKe-3wM-17@gated-at.bofh.it>
In reply to#1299903
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 <arnd@arndb.de>

Reviewed-by: Christian König <christian.koenig@amd.com>

> 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;
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300836

FromAlex Deucher <alexdeucher@gmail.com>
Date2016-01-04 16:50 +0100
Message-ID<qNfyq-5lo-7@gated-at.bofh.it>
In reply to#1299903
On Fri, Jan 1, 2016 at 8:07 AM, Arnd Bergmann <arnd@arndb.de> 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 <arnd@arndb.de>
> 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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web