drm/ttm: fix the type mismatch error on sparc64
Subsystems (3)
PATCH 1/1 drm/ttm: fix the type mismatch error on sparc64
__fls() on sparc64 return "int", but here it is expected as "unsigned long" (x86). It will cause the build errors because the warning becomes fatal while it is using sparc configuration. As suggested by Linus, it can use min_t instead of min to force the type as "unsigned int".
--- drivers/gpu/drm/ttm/ttm_pool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_pool.c +2 -1
@@ -382,7 +382,8 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,else gfp_flags |=GFP_HIGHUSER ; -for (order =min (MAX_ORDER -1UL ,__fls (num_pages)); num_pages; + for (order = min_t(unsigned int, MAX_ORDER - 1, __fls(num_pages)); + num_pages; order = min_t(unsigned int, order, __fls(num_pages))) {bool apply_caching = false;struct ttm_pool_type *pt;
Signature · 1 line
2.25.1
Am 07.09.21 um 12:03 schrieb Huang Rui:
Quoted 8 lines
__fls()on sparc64 return "int", but here it is expected as "unsigned long" (x86). It will cause the build errors because the warning becomes fatal while it is using sparc configuration. As suggested by Linus, it can usemin_tinstead of min to force the type as "unsigned int".Suggested-by Linus Torvalds <[email protected]>Signed-off-by Huang Rui <[email protected]>Cc Christian König <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/ttm/ttm_pool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/ttm/ttm_pool.c +2
-1@@ -382,7 +382,8 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,else gfp_flags |=GFP_HIGHUSER ; -for (order =min (MAX_ORDER -1UL ,__fls (num_pages)); num_pages; + for (order = min_t(unsigned int, MAX_ORDER - 1, __fls(num_pages)); + num_pages; order = min_t(unsigned int, order, __fls(num_pages))) {bool apply_caching = false;struct ttm_pool_type *pt;
Quoted 7 lines · Christian König
Am 07.09.21 um 12:03 schrieb Huang Rui:
Quoted 5 lines
__fls()on sparc64 return "int", but here it is expected as "unsigned long" (x86). It will cause the build errors because the warning becomes fatal while it is using sparc configuration. As suggested by Linus, it can usemin_tinstead of min to force the type as "unsigned int".
Quoted 5 lines
Quoted 3 lines
Suggested-by Linus Torvalds <[email protected]>Signed-off-by Huang Rui <[email protected]>Cc Christian König <[email protected]>Reviewed-by Christian König <[email protected]>
Is one of you going to push this to drm-misc?
Alex
Quoted 20 lines
Quoted 19 lines
--- drivers/gpu/drm/ttm/ttm_pool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/ttm/ttm_pool.c +2
-1@@ -382,7 +382,8 @@ int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,else gfp_flags |=GFP_HIGHUSER ; -for (order =min (MAX_ORDER -1UL ,__fls (num_pages)); num_pages; + for (order = min_t(unsigned int, MAX_ORDER - 1, __fls(num_pages)); + num_pages; order = min_t(unsigned int, order, __fls(num_pages))) {bool apply_caching = false;struct ttm_pool_type *pt;
Quoted 7 lines · Alex Deucher
Quoted 3 lines · Christian König
Reviewed-by Christian König <[email protected]>Is one of you going to push this to drm-misc?
I was assuming it was there already.
I guess I'll just apply it directly.
Linus
Am 14.09.21 um 22:03 schrieb Linus Torvalds:
Quoted 8 lines · Alex Deucher
Quoted 4 lines · Christian König
Quoted 2 lines
Reviewed-by Christian König <[email protected]>Is one of you going to push this to drm-misc?
I was assuming it was there already.
I guess I'll just apply it directly.
I had it already prepared and just forgot to push it.
Just did so a few minutes ago before reading this mail.
Sorry for the noise,
Christian.
Quoted 2 lines
Linus