All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: Simplify nouveau_cli_work
@ 2026-06-12 16:54 ` Tvrtko Ursulin
  0 siblings, 0 replies; 20+ messages in thread
From: Tvrtko Ursulin @ 2026-06-12 16:54 UTC (permalink / raw)
  To: dri-devel
  Cc: kernel-dev, Tvrtko Ursulin, Philipp Stanner, Lyude Paul,
	Danilo Krummrich, nouveau

I don't claim this fixes anything but the code certainly was a bit
roundabout and this at least cleans it up.

The only semantic difference is releasing the fence reference after
the work callback is called. Which kind of make sense anyway.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Philipp Stanner <phasta@kernel.org>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: nouveau@lists.freedesktop.org
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 42a81166f3a9..7de174537fc7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -153,22 +153,6 @@ nouveau_name(struct drm_device *dev)
 		return nouveau_platform_name(to_platform_device(dev->dev));
 }
 
-static inline bool
-nouveau_cli_work_ready(struct dma_fence *fence)
-{
-	unsigned long flags;
-	bool ret = true;
-
-	dma_fence_lock_irqsave(fence, flags);
-	if (!dma_fence_is_signaled_locked(fence))
-		ret = false;
-	dma_fence_unlock_irqrestore(fence, flags);
-
-	if (ret == true)
-		dma_fence_put(fence);
-	return ret;
-}
-
 static void
 nouveau_cli_work(struct work_struct *w)
 {
@@ -176,9 +160,10 @@ nouveau_cli_work(struct work_struct *w)
 	struct nouveau_cli_work *work, *wtmp;
 	mutex_lock(&cli->lock);
 	list_for_each_entry_safe(work, wtmp, &cli->worker, head) {
-		if (!work->fence || nouveau_cli_work_ready(work->fence)) {
+		if (!work->fence || dma_fence_is_signaled(work->fence)) {
 			list_del(&work->head);
 			work->func(work);
+			dma_fence_put(work->fence);
 		}
 	}
 	mutex_unlock(&cli->lock);
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-06-21 15:30 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12 16:54 [PATCH] drm/nouveau: Simplify nouveau_cli_work Tvrtko Ursulin
2026-06-12 16:54 ` Tvrtko Ursulin
2026-06-12 17:01 ` sashiko-bot
2026-06-12 17:14 ` Philipp Stanner
2026-06-12 17:14   ` Philipp Stanner
2026-06-12 17:18   ` Tvrtko Ursulin
2026-06-12 17:18     ` Tvrtko Ursulin
2026-06-12 17:29     ` Tvrtko Ursulin
2026-06-12 17:29       ` Tvrtko Ursulin
2026-06-12 17:22 ` [PATCH v2] " Tvrtko Ursulin
2026-06-12 17:22   ` Tvrtko Ursulin
2026-06-12 17:33   ` sashiko-bot
2026-06-15  9:26 ` [PATCH v3] " Tvrtko Ursulin
2026-06-15  9:26   ` Tvrtko Ursulin
2026-06-15  9:31   ` Philipp Stanner
2026-06-15  9:31     ` Philipp Stanner
2026-06-21 15:29   ` Danilo Krummrich
2026-06-21 15:29     ` Danilo Krummrich
2026-06-21 15:30   ` Danilo Krummrich
2026-06-21 15:30     ` Danilo Krummrich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.