Module Name: src
Committed By: riastradh
Date: Sat Dec 25 13:41:12 UTC 2021
Modified Files:
src/sys/dev/usb: ukbd.c
Log Message:
ukbd(4): Wait for callouts and blinking to complete in detach.
This detach routine (and whole driver) has got a lotta other
problems, but let's fix 'em one at a time...
To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/dev/usb/ukbd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.153 src/sys/dev/usb/ukbd.c:1.154
--- src/sys/dev/usb/ukbd.c:1.153 Mon Oct 11 00:00:03 2021
+++ src/sys/dev/usb/ukbd.c Sat Dec 25 13:41:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ukbd.c,v 1.153 2021/10/11 00:00:03 jmcneill Exp $ */
+/* $NetBSD: ukbd.c,v 1.154 2021/12/25 13:41:12 riastradh Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.153 2021/10/11 00:00:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.154 2021/12/25 13:41:12 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -572,6 +572,10 @@ ukbd_detach(device_t self, int flags)
if (sc->sc_wskbddev != NULL)
rv = config_detach(sc->sc_wskbddev, flags);
+ callout_halt(&sc->sc_delay, NULL);
+ usb_rem_task_wait(sc->sc_hdev.sc_parent->sc_udev, &sc->sc_ledtask,
+ USB_TASKQ_DRIVER, NULL);
+
/* The console keyboard does not get a disable call, so check pipe. */
if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
uhidev_close(&sc->sc_hdev);