[PATCH] drm/ttm: Include <linux/vmalloc.h> to fix MIPS build

Thomas Zimmermann tzimmermann at suse.de
Mon Jan 16 12:10:23 UTC 2023


On MIPS, vmap() and vunmap() are undeclared in ttm_bo_util.c. An
error message is shown below.

  CC      drivers/gpu/drm/ttm/ttm_bo_util.o
  ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kmap_ttm':
  ../drivers/gpu/drm/ttm/ttm_bo_util.c:364:32: error: implicit declaration of function 'vmap'; did you mean 'kmap'? [-Werror=implicit-function-declaration]
    364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
	|                                ^~~~
	|                                kmap
  ../drivers/gpu/drm/ttm/ttm_bo_util.c:364:30: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    364 |                 map->virtual = vmap(ttm->pages + start_page, num_pages,
	|                              ^
  ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_kunmap':
  ../drivers/gpu/drm/ttm/ttm_bo_util.c:429:17: error: implicit declaration of function 'vunmap'; did you mean 'kunmap'? [-Werror=implicit-function-declaration]
    429 |                 vunmap(map->virtual);
	|                 ^~~~~~
	|                 kunmap
  ../drivers/gpu/drm/ttm/ttm_bo_util.c: In function 'ttm_bo_vmap':
  ../drivers/gpu/drm/ttm/ttm_bo_util.c:509:23: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    509 |                 vaddr = vmap(ttm->pages, ttm->num_pages, 0, prot);
	|                       ^

Fix this by including <linux/vmalloc.h>.

Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 12017ec24d9f..8e19a40cb41d 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -29,6 +29,8 @@
  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
  */
 
+#include <linux/vmalloc.h>
+
 #include <drm/ttm/ttm_bo.h>
 #include <drm/ttm/ttm_placement.h>
 #include <drm/ttm/ttm_tt.h>
-- 
2.39.0



More information about the dri-devel mailing list