diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2016-08-05 08:58:00 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2016-08-05 08:58:00 +0000 |
commit | f87a304c8b3d6b4bfe2e4c7e763ae65a65209312 (patch) | |
tree | 1017c31d88760f782c2c74953d3f727a49b52bb0 /sys/dev | |
parent | 6fd14eb9401ff298e17c21fb5d367ec622cc7518 (diff) | |
download | src-f87a304c8b3d6b4bfe2e4c7e763ae65a65209312.tar.gz src-f87a304c8b3d6b4bfe2e4c7e763ae65a65209312.zip |
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>
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=303765
Diffstat (limited to 'sys/dev')
-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 02a6ff37e8d4..42d96cfa64db 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -198,6 +198,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; @@ -1983,7 +1984,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 { |