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/dist/drm drm_dp_mst_topology: Fix wake...



details:   https://anonhg.NetBSD.org/src/rev/656149d75a3d
branches:  trunk
changeset: 369598:656149d75a3d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 22 18:30:50 2022 +0000

description:
drm_dp_mst_topology: Fix wakeups: must hold lock for DRM_WAKEUP_ALL.

While here, omit NetBSD conditionals; write waits and wakeups in
terms of drm_waitqueue.

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_dp_mst_topology.c |  39 ++-----------------
 1 files changed, 5 insertions(+), 34 deletions(-)

diffs (105 lines):

diff -r df0ab0cd3327 -r 656149d75a3d sys/external/bsd/drm2/dist/drm/drm_dp_mst_topology.c
--- a/sys/external/bsd/drm2/dist/drm/drm_dp_mst_topology.c      Mon Aug 22 18:09:04 2022 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_dp_mst_topology.c      Mon Aug 22 18:30:50 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_dp_mst_topology.c,v 1.11 2021/12/19 09:45:10 riastradh Exp $       */
+/*     $NetBSD: drm_dp_mst_topology.c,v 1.12 2022/08/22 18:30:50 riastradh Exp $       */
 
 /*
  * Copyright © 2014 Red Hat
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_dp_mst_topology.c,v 1.11 2021/12/19 09:45:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_dp_mst_topology.c,v 1.12 2022/08/22 18:30:50 riastradh Exp $");
 
 #include <linux/delay.h>
 #include <linux/errno.h>
@@ -1193,16 +1193,9 @@
        struct drm_dp_mst_topology_mgr *mgr = mstb->mgr;
        int ret;
 
-#ifdef __NetBSD__
        mutex_lock(&mstb->mgr->qlock);
        DRM_TIMED_WAIT_UNTIL(ret, &mgr->tx_waitq, &mstb->mgr->qlock, 4*HZ,
            check_txmsg_state(mgr, txmsg));
-#else
-       ret = wait_event_timeout(mgr->tx_waitq,
-                                check_txmsg_state(mgr, txmsg),
-                                (4 * HZ));
-       mutex_lock(&mstb->mgr->qlock);
-#endif
        if (ret > 0) {
                if (txmsg->state == DRM_DP_SIDEBAND_TX_TIMEOUT) {
                        ret = -EIO;
@@ -2827,11 +2820,7 @@
                if (txmsg->seqno != -1)
                        txmsg->dst->tx_slots[txmsg->seqno] = NULL;
                txmsg->state = DRM_DP_SIDEBAND_TX_TIMEOUT;
-#ifdef __NetBSD__
                DRM_WAKEUP_ALL(&mgr->tx_waitq, &mgr->qlock);
-#else
-               wake_up_all(&mgr->tx_waitq);
-#endif
        }
 }
 
@@ -3823,14 +3812,9 @@
        txmsg->state = DRM_DP_SIDEBAND_TX_RX;
        mstb->tx_slots[slot] = NULL;
        mgr->is_waiting_for_dwn_reply = false;
+       DRM_WAKEUP_ALL(&mgr->tx_waitq, &mgr->qlock);
        mutex_unlock(&mgr->qlock);
 
-#ifdef __NetBSD__
-       DRM_WAKEUP_ALL(&mgr->tx_waitq, &mgr->qlock);
-#else
-       wake_up_all(&mgr->tx_waitq);
-#endif
-
        return 0;
 
 no_msg:
@@ -4717,17 +4701,10 @@
                mstb->tx_slots[1] = NULL;
                wake_tx = true;
        }
+       if (wake_tx)
+               DRM_WAKEUP_ALL(&mstb->mgr->tx_waitq, &mstb->mgr->qlock);
        mutex_unlock(&mstb->mgr->qlock);
 
-       if (wake_tx)
-       {
-#ifdef __NetBSD__
-               DRM_WAKEUP_ALL(&mstb->mgr->tx_waitq, &mstb->mgr->qlock);
-#else
-               wake_up_all(&mstb->mgr->tx_waitq);
-#endif
-       }
-
        drm_dp_mst_put_mstb_malloc(mstb);
 }
 
@@ -5164,11 +5141,7 @@
        INIT_WORK(&mgr->tx_work, drm_dp_tx_work);
        INIT_WORK(&mgr->delayed_destroy_work, drm_dp_delayed_destroy_work);
        INIT_WORK(&mgr->up_req_work, drm_dp_mst_up_req_work);
-#ifdef __NetBSD__
        DRM_INIT_WAITQUEUE(&mgr->tx_waitq, "dpmstwait");
-#else
-       init_waitqueue_head(&mgr->tx_waitq);
-#endif
        mgr->dev = dev;
        mgr->aux = aux;
        mgr->max_dpcd_transaction_bytes = max_dpcd_transaction_bytes;
@@ -5220,9 +5193,7 @@
        drm_atomic_private_obj_fini(&mgr->base);
        mgr->funcs = NULL;
 
-#ifdef __NetBSD__
        DRM_DESTROY_WAITQUEUE(&mgr->tx_waitq);
-#endif
        mutex_destroy(&mgr->delayed_destroy_lock);
        mutex_destroy(&mgr->payload_lock);
        mutex_destroy(&mgr->qlock);



Home | Main Index | Thread Index | Old Index