Hi,
+static struct sg_table *virtgpu_gem_map_dma_buf(
struct dma_buf_attachment *attach,
enum dma_data_direction dir)
checkpatch doesn't like that:
-:47: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #47: FILE: drivers/gpu/drm/virtio/virtgpu_prime.c:46: +static struct sg_table *virtgpu_gem_map_dma_buf(
+{
- struct drm_gem_object *obj = attach->dmabuf->priv;
- struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj);
- if (virtio_gpu_is_vram(bo))
return virtio_gpu_vram_map_dma_buf(bo, attach->dev, dir);
- return drm_gem_map_dma_buf(attach, dir);
+}
+static void virtgpu_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
struct sg_table *sgt,
enum dma_data_direction dir)
+{
- struct drm_gem_object *obj = attach->dmabuf->priv;
- struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj);
- if (virtio_gpu_is_vram(bo))
virtio_gpu_vram_unmap_dma_buf(attach->dev, sgt, dir);
- else
drm_gem_unmap_dma_buf(attach, sgt, dir);
+}
Minor nit: Can we use the same logic in both functions? I like the virtgpu_gem_map_dma_buf variant (without else) more.
Otherwise looks sane to me.
thanks, Gerd