Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9530DCD98CE for ; Fri, 12 Jun 2026 16:54:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F2AE210EAD1; Fri, 12 Jun 2026 16:54:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="FSroCaAL"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C2C110EAD1; Fri, 12 Jun 2026 16:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Tebs/xgqnTOnOgdsbaKqWAXW45iBX4qAzlBi8lJe+NA=; b=FSroCaALJBuMVi6mRFKsOtBDWf Ef23eWXWA75WpHFrNgHBMwQ930rQba5Hj/M1rY1RyeJwl/3CWT7Y9THKt4gD59tBjIpMXZX+4Gkrv 8aUgM5yNI4lPQtEOp2gmUmvNOGRFT3jbOGU46jYmO4yvRdMaKqrpaK2hiqG4mzUHS/CW94zICygCY XXugD2P2sXpcj246HilbjTf43wtN3wlRM44tcSr4YHkGf2Nr4/YY8sahbP3Cup+2UGDecHRBrbCZQ CNwKLtlMZ43DP9oYYGD6ftOnTldvzThPuGa7n7tjzbodiEP7kjjRS3QDO4oO+3s8amgsBCUrPza1o 3WbkFB/Q==; Received: from [90.240.106.137] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1wY593-00GhBq-FW; Fri, 12 Jun 2026 18:54:13 +0200 From: Tvrtko Ursulin To: dri-devel@lists.freedesktop.org Cc: kernel-dev@igalia.com, Tvrtko Ursulin , Philipp Stanner , Lyude Paul , Danilo Krummrich , nouveau@lists.freedesktop.org Subject: [PATCH] drm/nouveau: Simplify nouveau_cli_work Date: Fri, 12 Jun 2026 17:54:09 +0100 Message-ID: <20260612165409.54447-1-tvrtko.ursulin@igalia.com> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Cc: Philipp Stanner Cc: Lyude Paul Cc: Danilo Krummrich 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