Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/khorben-n900]: src/sys/arch/evbarm/n900 Using a sysmon taskqueue to repo...



details:   https://anonhg.NetBSD.org/src/rev/5958ef758383
branches:  khorben-n900
changeset: 786716:5958ef758383
user:      khorben <khorben%NetBSD.org@localhost>
date:      Thu May 16 21:41:15 2013 +0000

description:
Using a sysmon taskqueue to report events; fixes crashes when booting
multi-user while calling sysmon_pswitch_event().

Tested on the Nokia N900 smartphone.

diffstat:

 sys/arch/evbarm/n900/n900_acad.c   |  18 ++++++++++++------
 sys/arch/evbarm/n900/n900_audjck.c |  16 ++++++++++------
 sys/arch/evbarm/n900/n900_cambtn.c |  21 +++++++++++++++++----
 sys/arch/evbarm/n900/n900_camcvr.c |  16 ++++++++++------
 sys/arch/evbarm/n900/n900_kbdsld.c |  16 ++++++++++------
 sys/arch/evbarm/n900/n900_lckbtn.c |  16 ++++++++++------
 sys/arch/evbarm/n900/n900_prxmty.c |  16 ++++++++++------
 7 files changed, 79 insertions(+), 40 deletions(-)

diffs (truncated from 507 to 300 lines):

diff -r dc7959186495 -r 5958ef758383 sys/arch/evbarm/n900/n900_acad.c
--- a/sys/arch/evbarm/n900/n900_acad.c  Thu May 16 18:24:26 2013 +0000
+++ b/sys/arch/evbarm/n900/n900_acad.c  Thu May 16 21:41:15 2013 +0000
@@ -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 @@
 
 #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 @@
 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 @@
                    "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 @@
 
        gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
        pmf_device_deregister(self);
+       sysmon_task_queue_fini();
 
        return 0;
 }
@@ -165,18 +168,21 @@
 {
        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);
 }
diff -r dc7959186495 -r 5958ef758383 sys/arch/evbarm/n900/n900_audjck.c
--- a/sys/arch/evbarm/n900/n900_audjck.c        Thu May 16 18:24:26 2013 +0000
+++ b/sys/arch/evbarm/n900/n900_audjck.c        Thu May 16 21:41:15 2013 +0000
@@ -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 @@
 
 #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 @@
 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 @@
                    "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 @@
 
        gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
        pmf_device_deregister(self);
+       sysmon_task_queue_fini();
 
        return 0;
 }
@@ -168,13 +171,14 @@
 {
        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;
 
diff -r dc7959186495 -r 5958ef758383 sys/arch/evbarm/n900/n900_cambtn.c
--- a/sys/arch/evbarm/n900/n900_cambtn.c        Thu May 16 18:24:26 2013 +0000
+++ b/sys/arch/evbarm/n900/n900_cambtn.c        Thu May 16 21:41:15 2013 +0000
@@ -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 @@
 
 #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 @@
 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 @@
                    "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 @@
 
        gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
        pmf_device_deregister(self);
+       sysmon_task_queue_fini();
 
        return 0;
 }
@@ -197,9 +202,17 @@
 {
        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
diff -r dc7959186495 -r 5958ef758383 sys/arch/evbarm/n900/n900_camcvr.c
--- a/sys/arch/evbarm/n900/n900_camcvr.c        Thu May 16 18:24:26 2013 +0000
+++ b/sys/arch/evbarm/n900/n900_camcvr.c        Thu May 16 21:41:15 2013 +0000
@@ -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 @@
 
 #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 @@
 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 @@
                    "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 @@
 
        gpio_pin_unmap(sc->sc_gpio, &sc->sc_map);
        pmf_device_deregister(self);
+       sysmon_task_queue_fini();
 
        return 0;
 }
@@ -166,13 +169,14 @@
 {
        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;
 
diff -r dc7959186495 -r 5958ef758383 sys/arch/evbarm/n900/n900_kbdsld.c
--- a/sys/arch/evbarm/n900/n900_kbdsld.c        Thu May 16 18:24:26 2013 +0000
+++ b/sys/arch/evbarm/n900/n900_kbdsld.c        Thu May 16 21:41:15 2013 +0000
@@ -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 $ */



Home | Main Index | Thread Index | Old Index