From nobody Mon Dec 1 22:03:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 709CA305066; Mon, 1 Dec 2025 10:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764586268; cv=none; b=lWSFFWGvoh3BqRjM0jJpLX67ulbgTGdo3ZVxtWbDHz5RhuQMdwDiHHd9TAsvwffQJbnNmVH6A++cNUs5PmdriZmDIL4M96OTvduU1ApH5I9cAji81TOrV453zELlz0RDXT8kwcWgZmygBDppUF2wJNskpOsPMbSLG5jYT2tZitU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764586268; c=relaxed/simple; bh=vLU4asfyOip/u8apYJb8xS5xSWEq5LKx5AZnLWJhf5Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cuQ5Y/bWLce/AS2U0DE2XmESfDgmNUg2+a/Hkia6/otqGro7tTKy9H0PdhGi2EVlaLZazDoeNd/Xh8nuARvHP0egynFXvexourUB2xCiFSnlpFSR1ecC0XkTLxGyJmrHvU48Mw8OVlWMMu5yaFB0Lmc1cf6vAWcdQ0m45Mb3T/k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Qr/O92Um; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qr/O92Um" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B853EC113D0; Mon, 1 Dec 2025 10:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764586268; bh=vLU4asfyOip/u8apYJb8xS5xSWEq5LKx5AZnLWJhf5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qr/O92UmvlYreeY2B2vJnfwo1e1iYbEvJk6Q2RlIH+GZj2YvMEwu1NqVImEVBRQVO VtcJ8XOnJvJHi9ZEs1SjjI/VSj7PXMWiDYSoS3n59zqvjCEeyT/ArJIZ+2iigI+jdg lxQqbybIcGCBhgR6XNUCYkZhtZvq+IZUkMPnvY860rM1GBHtpid9OrrpSHbBEPbJcF qs1xVsrmIPEqpZ3aBbNrF7Zmkz2AIfysfWQ8Ol9+O+VHuPa/6ieDua4K3/EfYvgnDd yjA/pgLDKiIE4H1YcBhcui5Uvp4mD/GjsTmJmXLM6p8IEEUUBdVov8loclOjjBHpD5 4Gj8oykZgcKkA== From: Philipp Stanner To: Sumit Semwal , Gustavo Padovan , =?UTF-8?q?Christian=20K=C3=B6nig?= , Felix Kuehling , Alex Deucher , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Huang Rui , Matthew Auld , Matthew Brost , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lucas De Marchi , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, Philipp Stanner Subject: [PATCH v2 7/8] dma-buf/dma-fence: Remove return code of signaling-functions Date: Mon, 1 Dec 2025 11:50:11 +0100 Message-ID: <20251201105011.19386-9-phasta@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20251201105011.19386-2-phasta@kernel.org> References: <20251201105011.19386-2-phasta@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable All functions used for signaling a fence return an error code whose sole purpose is to tell whether a fence was already signaled. This is racy and has been used by almost no party in the kernel, and the few users have been removed in preceding cleanup commits. Turn all signaling-functions into void-functions. Suggested-by: Christian K=C3=B6nig Signed-off-by: Philipp Stanner --- drivers/dma-buf/dma-fence.c | 40 ++++++++++--------------------------- include/linux/dma-fence.h | 9 ++++----- 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index 146de62887cf..529a44371b35 100644 --- a/drivers/dma-buf/dma-fence.c +++ b/drivers/dma-buf/dma-fence.c @@ -360,11 +360,8 @@ void __dma_fence_might_wait(void) * * Unlike dma_fence_signal_timestamp(), this function must be called with * &dma_fence.lock held. - * - * Returns 0 on success and a negative error value when @fence has been - * signalled already. */ -int dma_fence_signal_timestamp_locked(struct dma_fence *fence, +void dma_fence_signal_timestamp_locked(struct dma_fence *fence, ktime_t timestamp) { struct dma_fence_cb *cur, *tmp; @@ -374,7 +371,7 @@ int dma_fence_signal_timestamp_locked(struct dma_fence = *fence, =20 if (unlikely(test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))) - return -EINVAL; + return; =20 /* Stash the cb_list before replacing it with the timestamp */ list_replace(&fence->cb_list, &cb_list); @@ -387,8 +384,6 @@ int dma_fence_signal_timestamp_locked(struct dma_fence = *fence, INIT_LIST_HEAD(&cur->node); cur->func(fence, cur); } - - return 0; } EXPORT_SYMBOL(dma_fence_signal_timestamp_locked); =20 @@ -403,23 +398,17 @@ EXPORT_SYMBOL(dma_fence_signal_timestamp_locked); * can only go from the unsignaled to the signaled state and not back, it = will * only be effective the first time. Set the timestamp provided as the fen= ce * signal timestamp. - * - * Returns 0 on success and a negative error value when @fence has been - * signalled already. */ -int dma_fence_signal_timestamp(struct dma_fence *fence, ktime_t timestamp) +void dma_fence_signal_timestamp(struct dma_fence *fence, ktime_t timestamp) { unsigned long flags; - int ret; =20 if (WARN_ON(!fence)) - return -EINVAL; + return; =20 spin_lock_irqsave(fence->lock, flags); - ret =3D dma_fence_signal_timestamp_locked(fence, timestamp); + dma_fence_signal_timestamp_locked(fence, timestamp); spin_unlock_irqrestore(fence->lock, flags); - - return ret; } EXPORT_SYMBOL(dma_fence_signal_timestamp); =20 @@ -435,13 +424,10 @@ EXPORT_SYMBOL(dma_fence_signal_timestamp); * * Unlike dma_fence_signal(), this function must be called with &dma_fence= .lock * held. - * - * Returns 0 on success and a negative error value when @fence has been - * signalled already. */ -int dma_fence_signal_locked(struct dma_fence *fence) +void dma_fence_signal_locked(struct dma_fence *fence) { - return dma_fence_signal_timestamp_locked(fence, ktime_get()); + dma_fence_signal_timestamp_locked(fence, ktime_get()); } EXPORT_SYMBOL(dma_fence_signal_locked); =20 @@ -498,28 +484,22 @@ EXPORT_SYMBOL(dma_fence_check_and_signal); * dma_fence_add_callback(). Can be called multiple times, but since a fen= ce * can only go from the unsignaled to the signaled state and not back, it = will * only be effective the first time. - * - * Returns 0 on success and a negative error value when @fence has been - * signalled already. */ -int dma_fence_signal(struct dma_fence *fence) +void dma_fence_signal(struct dma_fence *fence) { unsigned long flags; - int ret; bool tmp; =20 if (WARN_ON(!fence)) - return -EINVAL; + return; =20 tmp =3D dma_fence_begin_signalling(); =20 spin_lock_irqsave(fence->lock, flags); - ret =3D dma_fence_signal_timestamp_locked(fence, ktime_get()); + dma_fence_signal_timestamp_locked(fence, ktime_get()); spin_unlock_irqrestore(fence->lock, flags); =20 dma_fence_end_signalling(tmp); - - return ret; } EXPORT_SYMBOL(dma_fence_signal); =20 diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h index 0504afe52c2a..d4c92fd35092 100644 --- a/include/linux/dma-fence.h +++ b/include/linux/dma-fence.h @@ -364,13 +364,12 @@ static inline void dma_fence_end_signalling(bool cook= ie) {} static inline void __dma_fence_might_wait(void) {} #endif =20 -int dma_fence_signal(struct dma_fence *fence); +void dma_fence_signal(struct dma_fence *fence); bool dma_fence_check_and_signal(struct dma_fence *fence); bool dma_fence_check_and_signal_locked(struct dma_fence *fence); -int dma_fence_signal_locked(struct dma_fence *fence); -int dma_fence_signal_timestamp(struct dma_fence *fence, ktime_t timestamp); -int dma_fence_signal_timestamp_locked(struct dma_fence *fence, - ktime_t timestamp); +void dma_fence_signal_locked(struct dma_fence *fence); +void dma_fence_signal_timestamp(struct dma_fence *fence, ktime_t timestamp= ); +void dma_fence_signal_timestamp_locked(struct dma_fence *fence, ktime_t ti= mestamp); signed long dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout); int dma_fence_add_callback(struct dma_fence *fence, --=20 2.49.0