The branch main has been updated by wulf:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=b360682ac940a4cef1c922c33d685db24a67c96b

commit b360682ac940a4cef1c922c33d685db24a67c96b
Author:     Vladimir Kondratyev <w...@freebsd.org>
AuthorDate: 2021-01-14 19:48:53 +0000
Commit:     Vladimir Kondratyev <w...@freebsd.org>
CommitDate: 2021-01-14 20:04:47 +0000

    hid:  Add missing input enter/exit epoch pairs.
    
    This was affecting unloading keyboard driver and kdb-related code.
---
 sys/dev/evdev/cdev.c |  5 +++++
 sys/dev/hid/hkbd.c   | 15 +++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/sys/dev/evdev/cdev.c b/sys/dev/evdev/cdev.c
index ec60a12dbf2d..91536c119fb4 100644
--- a/sys/dev/evdev/cdev.c
+++ b/sys/dev/evdev/cdev.c
@@ -396,6 +396,7 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int 
fflag,
        struct evdev_dev *evdev = dev->si_drv1;
        struct evdev_client *client;
        struct input_keymap_entry *ke;
+       struct epoch_tracker et;
        int ret, len, limit, type_num;
        uint32_t code;
        size_t nvalues;
@@ -415,7 +416,11 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, 
int fflag,
                EVDEV_LOCK(evdev);
                if (evdev->ev_kdb_active) {
                        evdev->ev_kdb_active = false;
+                       if (evdev->ev_lock_type == EV_LOCK_EXT_EPOCH)
+                               epoch_enter_preempt(INPUT_EPOCH, &et);
                        evdev_restore_after_kdb(evdev);
+                       if (evdev->ev_lock_type == EV_LOCK_EXT_EPOCH)
+                               epoch_exit_preempt(INPUT_EPOCH, &et);
                }
                EVDEV_UNLOCK(evdev);
        }
diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c
index 63dd626cdef9..6f4b71dd49b6 100644
--- a/sys/dev/hid/hkbd.c
+++ b/sys/dev/hid/hkbd.c
@@ -598,16 +598,22 @@ static void
 hkbd_timeout(void *arg)
 {
        struct hkbd_softc *sc = arg;
+#ifdef EVDEV_SUPPORT
        struct epoch_tracker et;
+#endif
 
        HKBD_LOCK_ASSERT(sc);
 
        sc->sc_time_ms += sc->sc_delay;
        sc->sc_delay = 0;
 
+#ifdef EVDEV_SUPPORT
        epoch_enter_preempt(INPUT_EPOCH, &et);
+#endif
        hkbd_interrupt(sc);
+#ifdef EVDEV_SUPPORT
        epoch_exit_preempt(INPUT_EPOCH, &et);
+#endif
 
        /* Make sure any leftover key events gets read out */
        taskqueue_enqueue(taskqueue_swi_giant, &sc->sc_task);
@@ -1023,6 +1029,9 @@ static int
 hkbd_detach(device_t dev)
 {
        struct hkbd_softc *sc = device_get_softc(dev);
+#ifdef EVDEV_SUPPORT
+       struct epoch_tracker et;
+#endif
        int error;
 
        SYSCONS_LOCK_ASSERT();
@@ -1045,7 +1054,13 @@ hkbd_detach(device_t dev)
 
                /* process releasing of all keys */
                HKBD_LOCK(sc);
+#ifdef EVDEV_SUPPORT
+               epoch_enter_preempt(INPUT_EPOCH, &et);
+#endif
                hkbd_interrupt(sc);
+#ifdef EVDEV_SUPPORT
+               epoch_exit_preempt(INPUT_EPOCH, &et);
+#endif
                HKBD_UNLOCK(sc);
                taskqueue_drain(taskqueue_swi_giant, &sc->sc_task);
        }
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to