Module Name: src
Committed By: riastradh
Date: Sun Jul 30 10:45:11 UTC 2023
Modified Files:
src/sys/dev/wscons: wsmouse.c
Log Message:
wsmouse(4): Make wsmouse_input safe to call from MP-safe interrupts.
XXX pullup-10
To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/wscons/wsmouse.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/wscons/wsmouse.c
diff -u src/sys/dev/wscons/wsmouse.c:1.72 src/sys/dev/wscons/wsmouse.c:1.73
--- src/sys/dev/wscons/wsmouse.c:1.72 Sun Jul 17 11:44:30 2022
+++ src/sys/dev/wscons/wsmouse.c Sun Jul 30 10:45:11 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmouse.c,v 1.72 2022/07/17 11:44:30 riastradh Exp $ */
+/* $NetBSD: wsmouse.c,v 1.73 2023/07/30 10:45:11 riastradh Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.72 2022/07/17 11:44:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.73 2023/07/30 10:45:11 riastradh Exp $");
#include "wsmouse.h"
#include "wsdisplay.h"
@@ -372,17 +372,19 @@ wsmouse_input(device_t wsmousedev, u_int
/* one for each dimension (4) + a bit for each button */
struct wscons_event events[4 + sizeof(d) * 8];
+ KERNEL_LOCK(1, NULL);
+
/*
* Discard input if not open.
*/
evar = sc->sc_base.me_evp;
if (evar == NULL)
- return;
+ goto out;
#ifdef DIAGNOSTIC
if (evar->q == NULL) {
printf("wsmouse_input: evar->q=NULL\n");
- return;
+ goto out;
}
#endif
@@ -528,6 +530,8 @@ wsmouse_input(device_t wsmousedev, u_int
device_xname(sc->sc_base.me_dv), evar));
#endif
}
+
+out: KERNEL_UNLOCK_ONE(NULL);
}
void