Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/linux drm: Factor dma_fence_put out of...



details:   https://anonhg.NetBSD.org/src/rev/edc03871df17
branches:  trunk
changeset: 1028903:edc03871df17
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:26:39 2021 +0000

description:
drm: Factor dma_fence_put out of multiple dma_resv_do_poll branches.

diffstat:

 sys/external/bsd/drm2/linux/linux_dma_resv.c |  18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diffs (60 lines):

diff -r b9d3da7e203c -r edc03871df17 sys/external/bsd/drm2/linux/linux_dma_resv.c
--- a/sys/external/bsd/drm2/linux/linux_dma_resv.c      Sun Dec 19 12:26:30 2021 +0000
+++ b/sys/external/bsd/drm2/linux/linux_dma_resv.c      Sun Dec 19 12:26:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_dma_resv.c,v 1.15 2021/12/19 12:26:30 riastradh Exp $    */
+/*     $NetBSD: linux_dma_resv.c,v 1.16 2021/12/19 12:26:39 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_dma_resv.c,v 1.15 2021/12/19 12:26:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_resv.c,v 1.16 2021/12/19 12:26:39 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/poll.h>
@@ -1350,11 +1350,8 @@
                 * Test whether it is signalled.  If not, stop and
                 * request a callback.
                 */
-               if (dma_fence_is_signaled(fence)) {
-                       dma_fence_put(fence);
-                       fence = NULL;
+               if (dma_fence_is_signaled(fence))
                        break;
-               }
 
                /* Put ourselves on the selq if we haven't already.  */
                if (!recorded) {
@@ -1369,8 +1366,6 @@
                 * assume the event is not ready.
                 */
                if (!claimed || callback) {
-                       dma_fence_put(fence);
-                       fence = NULL;
                        revents = 0;
                        break;
                }
@@ -1383,16 +1378,15 @@
                 */
                if (!dma_fence_add_callback(fence, &rpoll->rp_fcb,
                        dma_resv_poll_cb)) {
-                       dma_fence_put(fence);
-                       fence = NULL;
                        revents = 0;
                        callback = true;
                        break;
                }
+       } while (0);
+       if (fence != NULL) {
                dma_fence_put(fence);
                fence = NULL;
-       } while (0);
-       KASSERT(fence == NULL);
+       }
 
        /* All done reading the fences.  */
        rcu_read_unlock();



Home | Main Index | Thread Index | Old Index