`evqueue' is simple circular buffer. Its pretty enough to set head equal
to tail to make it empty.

Index: sys/dev/hotplug.c
===================================================================
RCS file: /cvs/src/sys/dev/hotplug.c,v
retrieving revision 1.24
diff -u -p -r1.24 hotplug.c
--- sys/dev/hotplug.c   22 Sep 2023 22:12:32 -0000      1.24
+++ sys/dev/hotplug.c   23 Sep 2023 11:33:14 -0000
@@ -148,11 +148,10 @@ hotplugopen(dev_t dev, int flag, int mod
 int
 hotplugclose(dev_t dev, int flag, int mode, struct proc *p)
 {
-       struct hotplug_event he;
-
        mtx_enter(&hotplug_mtx);
-       while (hotplug_get_event(&he) == 0)
-               continue;
+       evqueue_head = 0;
+       evqueue_tail = 0;
+       evqueue_count = 0;
        mtx_leave(&hotplug_mtx);
        klist_invalidate(&hotplug_klist);
        opened = 0;

Reply via email to