From owner-svn-src-all@freebsd.org Mon Aug 15 09:03:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6128BBA075; Mon, 15 Aug 2016 09:03:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 986931EAD; Mon, 15 Aug 2016 09:03:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7F935UK060995; Mon, 15 Aug 2016 09:03:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7F935UF060994; Mon, 15 Aug 2016 09:03:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201608150903.u7F935UF060994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 15 Aug 2016 09:03:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r304129 - stable/9/sys/dev/usb/input X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 09:03:06 -0000 Author: hselasky Date: Mon Aug 15 09:03:05 2016 New Revision: 304129 URL: https://svnweb.freebsd.org/changeset/base/304129 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 Modified: stable/9/sys/dev/usb/input/ukbd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/9/sys/dev/usb/input/ukbd.c Mon Aug 15 09:02:09 2016 (r304128) +++ stable/9/sys/dev/usb/input/ukbd.c Mon Aug 15 09:03:05 2016 (r304129) @@ -197,6 +197,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; @@ -1967,7 +1968,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 {