virtio: Rework virtio_gpu_object_kmap()
Currently, virtio_gpu_object_kmap() is only called by virtio_gpufb_create(), when a DRM framebuffer is created. Thus, instead of returning the vmap'ed address, emit a warning if virtio_gpu_object_kmap is called on an already mapped object. With this change, kmap/kunmap calls are now balanced. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Link: http://patchwork.freedesktop.org/patch/msgid/20180925161606.17980-3-ezequiel@collabora.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:

committed by
Gerd Hoffmann

parent
02c87cabd6
commit
a20c4173c4
@@ -107,22 +107,17 @@ void virtio_gpu_object_kunmap(struct virtio_gpu_object *bo)
|
||||
ttm_bo_kunmap(&bo->kmap);
|
||||
}
|
||||
|
||||
int virtio_gpu_object_kmap(struct virtio_gpu_object *bo, void **ptr)
|
||||
int virtio_gpu_object_kmap(struct virtio_gpu_object *bo)
|
||||
{
|
||||
bool is_iomem;
|
||||
int r;
|
||||
|
||||
if (bo->vmap) {
|
||||
if (ptr)
|
||||
*ptr = bo->vmap;
|
||||
return 0;
|
||||
}
|
||||
WARN_ON(bo->vmap);
|
||||
|
||||
r = ttm_bo_kmap(&bo->tbo, 0, bo->tbo.num_pages, &bo->kmap);
|
||||
if (r)
|
||||
return r;
|
||||
bo->vmap = ttm_kmap_obj_virtual(&bo->kmap, &is_iomem);
|
||||
if (ptr)
|
||||
*ptr = bo->vmap;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user