Date: Mon, 15 Aug 2016 09:00:46 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r304125 - stable/10/sys/dev/usb/input Message-ID: <201608150900.u7F90kn4057319@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Aug 15 09:00:46 2016 New Revision: 304125 URL: https://svnweb.freebsd.org/changeset/base/304125 Log: 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> Modified: stable/10/sys/dev/usb/input/ukbd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/10/sys/dev/usb/input/ukbd.c Mon Aug 15 08:58:55 2016 (r304124) +++ stable/10/sys/dev/usb/input/ukbd.c Mon Aug 15 09:00:46 2016 (r304125) @@ -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 {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608150900.u7F90kn4057319>