drm/amdgpu: fix a warning about different types in min() macro
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix a warning about different types in min() macro
From: Nicolai Hähnle <[email protected]>
In file included from ./include/linux/list.h:8:0,
from drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:32:drivers/gpu/drm/amd/amdgpu/amdgpu_object.c: In function ‘amdgpu_bo_create_restricted’:./include/linux/kernel.h:739:16: warning: comparison of distinct pointer types lacks a cast
(void) (&min1 == &min2); \
^./include/linux/kernel.h:742:2: note: in expansion of macro ‘__min’
__min(typeof(x), typeof(y), \
^~~~~drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:434:21: note: in expansion of macro ‘min’
bo->tbo.priority = min(bo->tbo.priority, TTM_MAX_BO_PRIORITY - 1);
^~~--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -1
@@ -431,7 +431,8 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, bo->tbo.priority =ilog2 (bo->tbo.num_pages);if (kernel) bo->tbo.priority *=2 ; - bo->tbo.priority =min (bo->tbo.priority,TTM_MAX_BO_PRIORITY -1 ); + bo->tbo.priority =min (bo->tbo.priority, + (unsigned )(TTM_MAX_BO_PRIORITY -1 ));if (flags &AMDGPU_GEM_CREATE_VRAM_CLEARED && bo->tbo.mem.placement &TTM_PL_FLAG_VRAM ) {
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170214104015.4328-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Am 14.02.2017 um 11:40 schrieb Nicolai Hähnle:
Quoted 15 lines
From: Nicolai Hähnle <[email protected]>
In file included from
./include/linux/list.h:8:0,
fromdrivers/gpu/drm/amd/amdgpu/amdgpu_object.c:32:drivers/gpu/drm/amd/amdgpu/amdgpu_object.c: In function ‘amdgpu_bo_create_restricted’:./include/linux/kernel.h:739:16: warning: comparison of distinct pointer types lacks a cast(void) (&min1 == &min2); \ ^ ./include/linux/kernel.h:742:2: note: in expansion of macro ‘__min’ __min(typeof(x), typeof(y), \ ^~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:434:21: note: in expansion of macro ‘min’ bo->tbo.priority = min(bo->tbo.priority, TTM_MAX_BO_PRIORITY - 1); ^~~
Quoted 1 line
Signed-off-by Nicolai Hähnle <[email protected]>
Thanks for taking care of this, but I would prefer to fix the root cause and make the define of TTM_MAX_BO_PRIORITY unsigned.
Regards,
Christian.
Quoted 9 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create_restricted(struct amdgpu_device *adev, · line 438
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-1@@ -431,7 +431,8 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, bo->tbo.priority =ilog2 (bo->tbo.num_pages);if (kernel) bo->tbo.priority *=2 ; - bo->tbo.priority =min (bo->tbo.priority,TTM_MAX_BO_PRIORITY -1 ); + bo->tbo.priority =min (bo->tbo.priority, + (unsigned )(TTM_MAX_BO_PRIORITY -1 ));if (flags &AMDGPU_GEM_CREATE_VRAM_CLEARED && bo->tbo.mem.placement &TTM_PL_FLAG_VRAM ) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): f0110d5a-930d-ed73-e50f-3e050e54a5de-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Quoted 19 lines · Christian König
Am 14.02.2017 um 11:40 schrieb Nicolai Hähnle:
Quoted 18 lines
From: Nicolai Hähnle <[email protected]>
In file included from
./include/linux/list.h:8:0,
fromdrivers/gpu/drm/amd/amdgpu/amdgpu_object.c:32:drivers/gpu/drm/amd/amdgpu/amdgpu_object.c: In function ‘amdgpu_bo_create_restricted’:./include/linux/kernel.h:739:16: warning: comparison of distinct pointer types lacks a cast(void) (&min1 == &min2); \ ^ ./include/linux/kernel.h:742:2: note: in expansion of macro ‘__min’ __min(typeof(x), typeof(y), \ ^~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:434:21: note: in expansion of macro ‘min’ bo->tbo.priority = min(bo->tbo.priority, TTM_MAX_BO_PRIORITY - 1); ^~~
Quoted 4 lines
Quoted 1 line
Signed-off-by Nicolai Hähnle <[email protected]>Thanks for taking care of this, but I would prefer to fix the root cause and make the define of
TTM_MAX_BO_PRIORITYunsigned.
Makes sense, will do.
Quoted 8 lines
Regards,
Christian.Quoted 4 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 17 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_create_restricted(struct · line 438
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2
-1@@ -431,7 +431,8 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, bo->tbo.priority =ilog2 (bo->tbo.num_pages);if (kernel) bo->tbo.priority *=2 ; - bo->tbo.priority =min (bo->tbo.priority,TTM_MAX_BO_PRIORITY -1 ); + bo->tbo.priority =min (bo->tbo.priority, + (unsigned )(TTM_MAX_BO_PRIORITY -1 ));if (flags &AMDGPU_GEM_CREATE_VRAM_CLEARED && bo->tbo.mem.placement &TTM_PL_FLAG_VRAM ) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx