Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 11:09:17 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/linux: linux_dma_fence.c

Log Message:
linux dma-fence: Fix up more callback uses.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/linux/linux_dma_fence.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_dma_fence.c
diff -u src/sys/external/bsd/drm2/linux/linux_dma_fence.c:1.14 src/sys/external/bsd/drm2/linux/linux_dma_fence.c:1.15
--- src/sys/external/bsd/drm2/linux/linux_dma_fence.c:1.14	Sun Dec 19 11:09:09 2021
+++ src/sys/external/bsd/drm2/linux/linux_dma_fence.c	Sun Dec 19 11:09:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_dma_fence.c,v 1.14 2021/12/19 11:09:09 riastradh Exp $	*/
+/*	$NetBSD: linux_dma_fence.c,v 1.15 2021/12/19 11:09:17 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.14 2021/12/19 11:09:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.15 2021/12/19 11:09:17 riastradh Exp $");
 
 #include <sys/atomic.h>
 #include <sys/condvar.h>
@@ -330,6 +330,7 @@ dma_fence_ensure_signal_enabled(struct d
 		return 0;
 
 	/* Otherwise, note that we've called it and call it.  */
+	KASSERT(fence->ops->enable_signaling);
 	if (!(*fence->ops->enable_signaling)(fence)) {
 		/* If it failed, signal and return -ENOENT.  */
 		dma_fence_signal_locked(fence);
@@ -766,7 +767,11 @@ dma_fence_wait(struct dma_fence *fence, 
 
 	KASSERT(dma_fence_referenced_p(fence));
 
-	ret = (*fence->ops->wait)(fence, intr, MAX_SCHEDULE_TIMEOUT);
+	if (fence->ops->wait)
+		ret = (*fence->ops->wait)(fence, intr, MAX_SCHEDULE_TIMEOUT);
+	else
+		ret = dma_fence_default_wait(fence, intr,
+		    MAX_SCHEDULE_TIMEOUT);
 	KASSERT(ret != 0);
 
 	return (ret < 0 ? ret : 0);

Reply via email to