hid: Add missing input enter/exit epoch pairs.

This was affecting unloading keyboard driver and kdb-related code.
This commit is contained in:
Vladimir Kondratyev 2021-01-14 22:48:53 +03:00
parent b62f6dfaed
commit b360682ac9
2 changed files with 20 additions and 0 deletions

View File

@ -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);
}

View File

@ -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);
}