Module Name: src
Committed By: khorben
Date: Thu May 16 21:41:15 UTC 2013
Modified Files:
src/sys/arch/evbarm/n900 [khorben-n900]: n900_acad.c n900_audjck.c
n900_cambtn.c n900_camcvr.c n900_kbdsld.c n900_lckbtn.c
n900_prxmty.c
Log Message:
Using a sysmon taskqueue to report events; fixes crashes when booting
multi-user while calling sysmon_pswitch_event().
Tested on the Nokia N900 smartphone.
To generate a diff of this commit:
cvs rdiff -u -r1.5.2.1 -r1.5.2.2 src/sys/arch/evbarm/n900/n900_acad.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/evbarm/n900/n900_audjck.c \
src/sys/arch/evbarm/n900/n900_cambtn.c \
src/sys/arch/evbarm/n900/n900_camcvr.c \
src/sys/arch/evbarm/n900/n900_kbdsld.c \
src/sys/arch/evbarm/n900/n900_prxmty.c
cvs rdiff -u -r1.3.2.1 -r1.3.2.2 src/sys/arch/evbarm/n900/n900_lckbtn.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/arch/evbarm/n900/n900_acad.c
diff -u src/sys/arch/evbarm/n900/n900_acad.c:1.5.2.1 src/sys/arch/evbarm/n900/n900_acad.c:1.5.2.2
--- src/sys/arch/evbarm/n900/n900_acad.c:1.5.2.1 Sat May 11 18:01:04 2013
+++ src/sys/arch/evbarm/n900/n900_acad.c Thu May 16 21:41:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: n900_acad.c,v 1.5.2.1 2013/05/11 18:01:04 khorben Exp $ */
+/* $NetBSD: n900_acad.c,v 1.5.2.2 2013/05/16 21:41:15 khorben Exp $ */
/*
* AC adapter driver for the Nokia N900.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: n900_acad.c,v 1.5.2.1 2013/05/11 18:01:04 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: n900_acad.c,v 1.5.2.2 2013/05/16 21:41:15 khorben Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: n900_acad.c,
#include <dev/gpio/gpiovar.h>
#include <dev/sysmon/sysmonvar.h>
+#include <dev/sysmon/sysmon_taskq.h>
#include <arm/omap/omap2_gpio.h>
@@ -68,9 +69,9 @@ static int n900acad_detach(device_t, int
CFATTACH_DECL_NEW(n900acad, sizeof(struct n900acad_softc),
n900acad_match, n900acad_attach, n900acad_detach, NULL);
-static void n900acad_refresh(struct n900acad_softc *);
+static void n900acad_refresh(void *);
-static int n900acad_intr(void *v);
+static int n900acad_intr(void *);
static int
@@ -138,6 +139,7 @@ n900acad_attach(device_t parent, device_
"couldn't establish power handler\n");
}
+ sysmon_task_queue_init();
sc->sc_smpsw.smpsw_name = device_xname(self);
sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_ACADAPTER;
sysmon_pswitch_register(&sc->sc_smpsw);
@@ -156,6 +158,7 @@ n900acad_detach(device_t self, int flags
gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
pmf_device_deregister(self);
+ sysmon_task_queue_fini();
return 0;
}
@@ -165,18 +168,21 @@ n900acad_intr(void *v)
{
struct n900acad_softc *sc = v;
- n900acad_refresh(sc);
+ sysmon_task_queue_sched(0, n900acad_refresh, sc);
return 1;
}
static void
-n900acad_refresh(struct n900acad_softc *sc)
+n900acad_refresh(void *v)
{
+ struct n900acad_softc *sc = v;
int i;
int event;
i = gpio_pin_read(sc->sc_gpio, &sc->sc_map, N900ACAD_PIN_INPUT);
event = (i == GPIO_PIN_HIGH)
? PSWITCH_EVENT_RELEASED : PSWITCH_EVENT_PRESSED;
+
+ /* report the event */
sysmon_pswitch_event(&sc->sc_smpsw, event);
}
Index: src/sys/arch/evbarm/n900/n900_audjck.c
diff -u src/sys/arch/evbarm/n900/n900_audjck.c:1.1.2.1 src/sys/arch/evbarm/n900/n900_audjck.c:1.1.2.2
--- src/sys/arch/evbarm/n900/n900_audjck.c:1.1.2.1 Sat May 11 18:01:04 2013
+++ src/sys/arch/evbarm/n900/n900_audjck.c Thu May 16 21:41:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: n900_audjck.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $ */
+/* $NetBSD: n900_audjck.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $ */
/*
* Audio jack driver for the Nokia N900.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: n900_audjck.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: n900_audjck.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: n900_audjck.
#include <dev/gpio/gpiovar.h>
#include <dev/sysmon/sysmonvar.h>
+#include <dev/sysmon/sysmon_taskq.h>
#include <arm/omap/omap2_gpio.h>
@@ -69,9 +70,9 @@ static int n900audjck_detach(device_t, i
CFATTACH_DECL_NEW(n900audjck, sizeof(struct n900audjck_softc),
n900audjck_match, n900audjck_attach, n900audjck_detach, NULL);
-static void n900audjck_refresh(struct n900audjck_softc *);
+static void n900audjck_refresh(void *);
-static int n900audjck_intr(void *v);
+static int n900audjck_intr(void *);
static int
@@ -139,6 +140,7 @@ n900audjck_attach(device_t parent, devic
"couldn't establish power handler\n");
}
+ sysmon_task_queue_init();
sc->sc_smpsw.smpsw_name = device_xname(self);
sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_HOTKEY;
sc->sc_state = PSWITCH_EVENT_RELEASED;
@@ -159,6 +161,7 @@ n900audjck_detach(device_t self, int fla
gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
pmf_device_deregister(self);
+ sysmon_task_queue_fini();
return 0;
}
@@ -168,13 +171,14 @@ n900audjck_intr(void *v)
{
struct n900audjck_softc *sc = v;
- n900audjck_refresh(sc);
+ sysmon_task_queue_sched(0, n900audjck_refresh, sc);
return 1;
}
static void
-n900audjck_refresh(struct n900audjck_softc *sc)
+n900audjck_refresh(void *v)
{
+ struct n900audjck_softc *sc = v;
int i;
int event;
Index: src/sys/arch/evbarm/n900/n900_cambtn.c
diff -u src/sys/arch/evbarm/n900/n900_cambtn.c:1.1.2.1 src/sys/arch/evbarm/n900/n900_cambtn.c:1.1.2.2
--- src/sys/arch/evbarm/n900/n900_cambtn.c:1.1.2.1 Sat May 11 18:01:04 2013
+++ src/sys/arch/evbarm/n900/n900_cambtn.c Thu May 16 21:41:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: n900_cambtn.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $ */
+/* $NetBSD: n900_cambtn.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $ */
/*
* Camera button driver for the Nokia N900.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: n900_cambtn.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: n900_cambtn.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: n900_cambtn.
#include <dev/gpio/gpiovar.h>
#include <dev/sysmon/sysmonvar.h>
+#include <dev/sysmon/sysmon_taskq.h>
#include <arm/omap/omap2_gpio.h>
@@ -71,9 +72,10 @@ static int n900cambtn_detach(device_t, i
CFATTACH_DECL_NEW(n900cambtn, sizeof(struct n900cambtn_softc),
n900cambtn_match, n900cambtn_attach, n900cambtn_detach, NULL);
+static void n900cambtn_refresh(void *);
static void n900cambtn_refresh_pin(struct n900cambtn_softc *, int);
-static int n900cambtn_intr(void *v);
+static int n900cambtn_intr(void *);
static int
@@ -158,6 +160,8 @@ n900cambtn_attach(device_t parent, devic
"couldn't establish power handler\n");
}
+ sysmon_task_queue_init();
+
/* focus button */
sc->sc_smpsw[0].smpsw_name = kmem_asprintf("%s%s", device_xname(self),
"focus");
@@ -188,6 +192,7 @@ n900cambtn_detach(device_t self, int fla
gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
pmf_device_deregister(self);
+ sysmon_task_queue_fini();
return 0;
}
@@ -197,9 +202,17 @@ n900cambtn_intr(void *v)
{
struct n900cambtn_softc *sc = v;
+ sysmon_task_queue_sched(0, n900cambtn_refresh, sc);
+ return 1;
+}
+
+static void
+n900cambtn_refresh(void *v)
+{
+ struct n900cambtn_softc *sc = v;
+
n900cambtn_refresh_pin(sc, N900CAMBTN_PIN_CAPTURE);
n900cambtn_refresh_pin(sc, N900CAMBTN_PIN_FOCUS);
- return 1;
}
static void
Index: src/sys/arch/evbarm/n900/n900_camcvr.c
diff -u src/sys/arch/evbarm/n900/n900_camcvr.c:1.1.2.1 src/sys/arch/evbarm/n900/n900_camcvr.c:1.1.2.2
--- src/sys/arch/evbarm/n900/n900_camcvr.c:1.1.2.1 Sat May 11 18:01:04 2013
+++ src/sys/arch/evbarm/n900/n900_camcvr.c Thu May 16 21:41:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: n900_camcvr.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $ */
+/* $NetBSD: n900_camcvr.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $ */
/*
* Camera cover driver for the Nokia N900.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: n900_camcvr.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: n900_camcvr.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: n900_camcvr.
#include <dev/gpio/gpiovar.h>
#include <dev/sysmon/sysmonvar.h>
+#include <dev/sysmon/sysmon_taskq.h>
#include <arm/omap/omap2_gpio.h>
@@ -68,9 +69,9 @@ static int n900camcvr_detach(device_t, i
CFATTACH_DECL_NEW(n900camcvr, sizeof(struct n900camcvr_softc),
n900camcvr_match, n900camcvr_attach, n900camcvr_detach, NULL);
-static void n900camcvr_refresh(struct n900camcvr_softc *);
+static void n900camcvr_refresh(void *);
-static int n900camcvr_intr(void *v);
+static int n900camcvr_intr(void *);
static int
@@ -138,6 +139,7 @@ n900camcvr_attach(device_t parent, devic
"couldn't establish power handler\n");
}
+ sysmon_task_queue_init();
sc->sc_smpsw.smpsw_name = device_xname(self);
sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_HOTKEY;
sysmon_pswitch_register(&sc->sc_smpsw);
@@ -157,6 +159,7 @@ n900camcvr_detach(device_t self, int fla
gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
pmf_device_deregister(self);
+ sysmon_task_queue_fini();
return 0;
}
@@ -166,13 +169,14 @@ n900camcvr_intr(void *v)
{
struct n900camcvr_softc *sc = v;
- n900camcvr_refresh(sc);
+ sysmon_task_queue_sched(0, n900camcvr_refresh, sc);
return 1;
}
static void
-n900camcvr_refresh(struct n900camcvr_softc *sc)
+n900camcvr_refresh(void *v)
{
+ struct n900camcvr_softc *sc = v;
int i;
int event;
Index: src/sys/arch/evbarm/n900/n900_kbdsld.c
diff -u src/sys/arch/evbarm/n900/n900_kbdsld.c:1.1.2.1 src/sys/arch/evbarm/n900/n900_kbdsld.c:1.1.2.2
--- src/sys/arch/evbarm/n900/n900_kbdsld.c:1.1.2.1 Sat May 11 18:01:04 2013
+++ src/sys/arch/evbarm/n900/n900_kbdsld.c Thu May 16 21:41:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: n900_kbdsld.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $ */
+/* $NetBSD: n900_kbdsld.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $ */
/*
* Keypad slide driver for the Nokia N900.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: n900_kbdsld.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: n900_kbdsld.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: n900_kbdsld.
#include <dev/gpio/gpiovar.h>
#include <dev/sysmon/sysmonvar.h>
+#include <dev/sysmon/sysmon_taskq.h>
#include <arm/omap/omap2_gpio.h>
@@ -68,9 +69,9 @@ static int n900kbdsld_detach(device_t, i
CFATTACH_DECL_NEW(n900kbdsld, sizeof(struct n900kbdsld_softc),
n900kbdsld_match, n900kbdsld_attach, n900kbdsld_detach, NULL);
-static void n900kbdsld_refresh(struct n900kbdsld_softc *);
+static void n900kbdsld_refresh(void *);
-static int n900kbdsld_intr(void *v);
+static int n900kbdsld_intr(void *);
static int
@@ -138,6 +139,7 @@ n900kbdsld_attach(device_t parent, devic
"couldn't establish power handler\n");
}
+ sysmon_task_queue_init();
sc->sc_smpsw.smpsw_name = device_xname(self);
sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_HOTKEY;
sysmon_pswitch_register(&sc->sc_smpsw);
@@ -156,6 +158,7 @@ n900kbdsld_detach(device_t self, int fla
gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
pmf_device_deregister(self);
+ sysmon_task_queue_fini();
return 0;
}
@@ -165,13 +168,14 @@ n900kbdsld_intr(void *v)
{
struct n900kbdsld_softc *sc = v;
- n900kbdsld_refresh(sc);
+ sysmon_task_queue_sched(0, n900kbdsld_refresh, sc);
return 1;
}
static void
-n900kbdsld_refresh(struct n900kbdsld_softc *sc)
+n900kbdsld_refresh(void *v)
{
+ struct n900kbdsld_softc *sc = v;
int i;
int event;
Index: src/sys/arch/evbarm/n900/n900_prxmty.c
diff -u src/sys/arch/evbarm/n900/n900_prxmty.c:1.1.2.1 src/sys/arch/evbarm/n900/n900_prxmty.c:1.1.2.2
--- src/sys/arch/evbarm/n900/n900_prxmty.c:1.1.2.1 Sat May 11 18:01:04 2013
+++ src/sys/arch/evbarm/n900/n900_prxmty.c Thu May 16 21:41:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: n900_prxmty.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $ */
+/* $NetBSD: n900_prxmty.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $ */
/*
* Proximity sensor driver for the Nokia N900.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: n900_prxmty.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: n900_prxmty.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: n900_prxmty.
#include <dev/gpio/gpiovar.h>
#include <dev/sysmon/sysmonvar.h>
+#include <dev/sysmon/sysmon_taskq.h>
#include <arm/omap/omap2_gpio.h>
@@ -68,9 +69,9 @@ static int n900prxmty_detach(device_t, i
CFATTACH_DECL_NEW(n900prxmty, sizeof(struct n900prxmty_softc),
n900prxmty_match, n900prxmty_attach, n900prxmty_detach, NULL);
-static void n900prxmty_refresh(struct n900prxmty_softc *);
+static void n900prxmty_refresh(void *);
-static int n900prxmty_intr(void *v);
+static int n900prxmty_intr(void *);
static int
@@ -138,6 +139,7 @@ n900prxmty_attach(device_t parent, devic
"couldn't establish power handler\n");
}
+ sysmon_task_queue_init();
sc->sc_smpsw.smpsw_name = device_xname(self);
sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_HOTKEY;
sysmon_pswitch_register(&sc->sc_smpsw);
@@ -156,6 +158,7 @@ n900prxmty_detach(device_t self, int fla
gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
pmf_device_deregister(self);
+ sysmon_task_queue_fini();
return 0;
}
@@ -165,13 +168,14 @@ n900prxmty_intr(void *v)
{
struct n900prxmty_softc *sc = v;
- n900prxmty_refresh(sc);
+ sysmon_task_queue_sched(0, n900prxmty_refresh, sc);
return 1;
}
static void
-n900prxmty_refresh(struct n900prxmty_softc *sc)
+n900prxmty_refresh(void *v)
{
+ struct n900prxmty_softc *sc = v;
int i;
int event;
Index: src/sys/arch/evbarm/n900/n900_lckbtn.c
diff -u src/sys/arch/evbarm/n900/n900_lckbtn.c:1.3.2.1 src/sys/arch/evbarm/n900/n900_lckbtn.c:1.3.2.2
--- src/sys/arch/evbarm/n900/n900_lckbtn.c:1.3.2.1 Sat May 11 18:01:04 2013
+++ src/sys/arch/evbarm/n900/n900_lckbtn.c Thu May 16 21:41:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: n900_lckbtn.c,v 1.3.2.1 2013/05/11 18:01:04 khorben Exp $ */
+/* $NetBSD: n900_lckbtn.c,v 1.3.2.2 2013/05/16 21:41:15 khorben Exp $ */
/*
* Lock button driver for the Nokia N900.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: n900_lckbtn.c,v 1.3.2.1 2013/05/11 18:01:04 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: n900_lckbtn.c,v 1.3.2.2 2013/05/16 21:41:15 khorben Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: n900_lckbtn.
#include <dev/gpio/gpiovar.h>
#include <dev/sysmon/sysmonvar.h>
+#include <dev/sysmon/sysmon_taskq.h>
#include <arm/omap/omap2_gpio.h>
@@ -69,9 +70,9 @@ static int n900lckbtn_detach(device_t, i
CFATTACH_DECL_NEW(n900lckbtn, sizeof(struct n900lckbtn_softc),
n900lckbtn_match, n900lckbtn_attach, n900lckbtn_detach, NULL);
-static void n900lckbtn_refresh(struct n900lckbtn_softc *);
+static void n900lckbtn_refresh(void *);
-static int n900lckbtn_intr(void *v);
+static int n900lckbtn_intr(void *);
static int
@@ -139,6 +140,7 @@ n900lckbtn_attach(device_t parent, devic
"couldn't establish power handler\n");
}
+ sysmon_task_queue_init();
sc->sc_smpsw.smpsw_name = device_xname(self);
sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_HOTKEY;
sc->sc_state = PSWITCH_EVENT_RELEASED;
@@ -156,6 +158,7 @@ n900lckbtn_detach(device_t self, int fla
gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
pmf_device_deregister(self);
+ sysmon_task_queue_fini();
return 0;
}
@@ -165,13 +168,14 @@ n900lckbtn_intr(void *v)
{
struct n900lckbtn_softc *sc = v;
- n900lckbtn_refresh(sc);
+ sysmon_task_queue_sched(0, n900lckbtn_refresh, sc);
return 1;
}
static void
-n900lckbtn_refresh(struct n900lckbtn_softc *sc)
+n900lckbtn_refresh(void *v)
{
+ struct n900lckbtn_softc *sc = v;
int i;
int event;