diff options
author | hselasky <hselasky@FreeBSD.org> | 2016-08-15 09:00:46 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2016-08-15 09:00:46 +0000 |
commit | 350db2751b9df6e0ba54e82eb1d11ec81f9637d8 (patch) | |
tree | 97785bc8fc4e45bc30dd0c895eba451bb5564f18 | |
parent | 5243a4edb4b1061746e70763e1ca5c70bbd77d10 (diff) | |
download | FreeBSD-src-350db2751b9df6e0ba54e82eb1d11ec81f9637d8.zip FreeBSD-src-350db2751b9df6e0ba54e82eb1d11ec81f9637d8.tar.gz |
MFC r303765:
Keep a reference count on USB keyboard polling to allow recursive
cngrab() during a panic for example, similar to what the AT-keyboard
driver is doing.
Found by: Bruce Evans <brde@optusnet.com.au>
-rw-r--r-- | sys/dev/usb/input/ukbd.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 3ee6b8bf..506ee45 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -201,6 +201,7 @@ struct ukbd_softc { int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int sc_state; /* shift/lock key state */ int sc_accents; /* accent key index (> 0) */ + int sc_polling; /* polling recursion count */ int sc_led_size; int sc_kbd_size; @@ -1986,7 +1987,16 @@ ukbd_poll(keyboard_t *kbd, int on) struct ukbd_softc *sc = kbd->kb_data; UKBD_LOCK(); - if (on) { + /* + * Keep a reference count on polling to allow recursive + * cngrab() during a panic for example. + */ + if (on) + sc->sc_polling++; + else + sc->sc_polling--; + + if (sc->sc_polling != 0) { sc->sc_flags |= UKBD_FLAG_POLLING; sc->sc_poll_thread = curthread; } else { |