[PATCH] drm/shmem-helper: Fix compile error

Andi Shyti andi.shyti at linux.intel.com
Tue Feb 28 12:50:54 UTC 2023


Commit 67b7836d4458 ("drm/shmem-helper: Switch to reservation
lock") removes the drm_gem_shmem_get_pages_locked() and
drm_gem_shmem_put_pages_locked().

But then commit ddddedaa0db9 ("drm/shmem-helper: Fix locking for
drm_gem_shmem_get_pages_sgt()") reintroduces it.

Somehow these two commits got mixed up and produce the following
compile error:

drivers/gpu/drm/drm_gem_shmem_helper.c: In function ‘drm_gem_shmem_get_pages_sgt_locked’:
drivers/gpu/drm/drm_gem_shmem_helper.c:651:15: error: implicit declaration of function ‘drm_gem_shmem_get_pages_locked’; did you mean ‘drm_gem_shmem_get_pages_sgt_locked’? [-Werror=implicit-function-declaration]
  651 |         ret = drm_gem_shmem_get_pages_locked(shmem);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |               drm_gem_shmem_get_pages_sgt_locked
drivers/gpu/drm/drm_gem_shmem_helper.c:673:9: error: implicit declaration of function ‘drm_gem_shmem_put_pages_locked’; did you mean ‘drm_gem_shmem_get_pages_sgt_locked’? [-Werror=implicit-function-declaration]
  673 |         drm_gem_shmem_put_pages_locked(shmem);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         drm_gem_shmem_get_pages_sgt_locked

Remove the use of the *_locked() functions as it was intended in
the original patch.

Fixes: ddddedaa0db9 ("drm/shmem-helper: Fix locking for drm_gem_shmem_get_pages_sgt()")
Signed-off-by: Andi Shyti <andi.shyti at linux.intel.com>
Cc: Asahi Lina <lina at asahilina.net>
Cc: Dmitry Osipenko <dmitry.osipenko at collabora.com>
---
Hi,

I don't know if this issue has already been addressed, if so it
hasn't reached yet drm-tip.

Andi

 drivers/gpu/drm/drm_gem_shmem_helper.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
index 990fff32afd69..4b725aa5ce1cd 100644
--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
+++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
@@ -643,12 +643,14 @@ static struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_
 	int ret;
 	struct sg_table *sgt;
 
+	dma_resv_assert_held(shmem->base.resv);
+
 	if (shmem->sgt)
 		return shmem->sgt;
 
 	drm_WARN_ON(obj->dev, obj->import_attach);
 
-	ret = drm_gem_shmem_get_pages_locked(shmem);
+	ret = drm_gem_shmem_get_pages(shmem);
 	if (ret)
 		return ERR_PTR(ret);
 
@@ -670,7 +672,7 @@ static struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_
 	sg_free_table(sgt);
 	kfree(sgt);
 err_put_pages:
-	drm_gem_shmem_put_pages_locked(shmem);
+	drm_gem_shmem_put_pages(shmem);
 	return ERR_PTR(ret);
 }
 
-- 
2.39.1



More information about the dri-devel mailing list