Replace the open-coded self-import check with the drm core helper drm_gem_prime_self_import(), which performs the same ops and device match and returns the backing GEM object with a reference.
Assisted-by: GitHub-Copilot:claude-opus-4.8 Signed-off-by: Niranjana Vishwanathapura <[email protected]> --- drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c index 30cf1cdc1aa3..fd479dc3c01e 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c +++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c @@ -102,17 +102,9 @@ struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev, struct sg_table *sgt; int ret; - if (dma_buf->ops == &omap_dmabuf_ops) { - obj = dma_buf->priv; - if (obj->dev == dev) { - /* - * Importing dmabuf exported from out own gem increases - * refcount on gem itself instead of f_count of dmabuf. - */ - drm_gem_object_get(obj); - return obj; - } - } + obj = drm_gem_prime_self_import(dev, dma_buf, &omap_dmabuf_ops); + if (obj) + return obj; attach = dma_buf_attach(dma_buf, dev->dev); if (IS_ERR(attach)) -- 2.43.0
