amdgpu exports with the default PRIME dma_buf_ops and replaces them afterwards. Instead of open-code the replacement of the DMA-BUF operations, use the new helper drm_gem_prime_export_with_ops() to export amdgpu_dmabuf_ops directly.
Signed-off-by: Maíra Canal <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c index 4031ebe075d8..2e4a1d1b6322 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c @@ -407,7 +407,7 @@ const struct dma_buf_ops amdgpu_dmabuf_ops = { * @gobj: GEM BO * @flags: Flags such as DRM_CLOEXEC and DRM_RDWR. * - * The main work is done by the &drm_gem_prime_export helper. + * The main work is done by drm_gem_prime_export_with_ops(). * * Returns: * Shared DMA buffer representing the GEM BO from the given device. @@ -416,7 +416,6 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_gem_object *gobj, int flags) { struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj); - struct dma_buf *buf; struct ttm_operation_ctx ctx = { .interruptible = true, .no_wait_gpu = true, @@ -434,11 +433,7 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_gem_object *gobj, if (ret) return ERR_PTR(ret); - buf = drm_gem_prime_export(gobj, flags); - if (!IS_ERR(buf)) - buf->ops = &amdgpu_dmabuf_ops; - - return buf; + return drm_gem_prime_export_with_ops(gobj, &amdgpu_dmabuf_ops, flags); } /** -- 2.56.0
