Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/macppc/dev make sure we call sysmon_pswitch_event()...
details: https://anonhg.NetBSD.org/src/rev/cd1f6556bd5c
branches: trunk
changeset: 815645:cd1f6556bd5c
user: macallan <macallan%NetBSD.org@localhost>
date: Tue May 31 02:17:18 2016 +0000
description:
make sure we call sysmon_pswitch_event() from thread context
diffstat:
sys/arch/macppc/dev/pmu.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diffs (60 lines):
diff -r d0cc913b60ba -r cd1f6556bd5c sys/arch/macppc/dev/pmu.c
--- a/sys/arch/macppc/dev/pmu.c Mon May 30 22:58:52 2016 +0000
+++ b/sys/arch/macppc/dev/pmu.c Tue May 31 02:17:18 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmu.c,v 1.24 2016/02/14 19:54:20 chs Exp $ */
+/* $NetBSD: pmu.c,v 1.25 2016/05/31 02:17:18 macallan Exp $ */
/*-
* Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.24 2016/02/14 19:54:20 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.25 2016/05/31 02:17:18 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -90,6 +90,7 @@
int sc_brightness, sc_brightness_wanted;
int sc_volume, sc_volume_wanted;
int sc_lid_closed;
+ int sc_pswitch_pending;
/* deferred processing */
lwp_t *sc_thread;
/* signalling the event thread */
@@ -285,6 +286,7 @@
sc->sc_flags = 0;
sc->sc_callback = NULL;
sc->sc_lid_closed = 0;
+ sc->sc_pswitch_pending = 0;
if (bus_space_map(sc->sc_memt, ca->ca_reg[0] + ca->ca_baseaddr,
ca->ca_reg[1], 0, &sc->sc_memh) != 0) {
@@ -658,9 +660,8 @@
closed = (resp[2] & PMU_ENV_LID_CLOSED) != 0;
if (closed != sc->sc_lid_closed) {
sc->sc_lid_closed = closed;
- sysmon_pswitch_event(&sc->sc_lidswitch,
- closed ? PSWITCH_EVENT_PRESSED :
- PSWITCH_EVENT_RELEASED);
+ sc->sc_pswitch_pending = 1;
+ wakeup(&sc->sc_event);
}
goto done;
}
@@ -1023,6 +1024,13 @@
sc->sc_volume = sc->sc_volume_wanted;
}
+ if (sc->sc_pswitch_pending) {
+ sc->sc_pswitch_pending = 1;
+ sysmon_pswitch_event(&sc->sc_lidswitch,
+ sc->sc_lid_closed ? PSWITCH_EVENT_PRESSED :
+ PSWITCH_EVENT_RELEASED);
+ }
+
if (sc->sc_callback != NULL)
sc->sc_callback(sc->sc_cb_cookie);
}
Home |
Main Index |
Thread Index |
Old Index