Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Replace few simple_lock(9) cases.



details:   https://anonhg.NetBSD.org/src/rev/6c4f326db2e4
branches:  trunk
changeset: 777442:6c4f326db2e4
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sat Feb 18 23:51:27 2012 +0000

description:
Replace few simple_lock(9) cases.

diffstat:

 sys/arch/arm/iomd/iomd_clock.c      |  15 +++++++--------
 sys/arch/mac68k/obio/esp.c          |   6 +++---
 sys/arch/prep/pnpbus/nvram_pnpbus.c |  15 ++-------------
 3 files changed, 12 insertions(+), 24 deletions(-)

diffs (161 lines):

diff -r db5c3863715a -r 6c4f326db2e4 sys/arch/arm/iomd/iomd_clock.c
--- a/sys/arch/arm/iomd/iomd_clock.c    Sat Feb 18 23:47:48 2012 +0000
+++ b/sys/arch/arm/iomd/iomd_clock.c    Sat Feb 18 23:51:27 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iomd_clock.c,v 1.25 2009/01/17 17:06:18 mjf Exp $      */
+/*     $NetBSD: iomd_clock.c,v 1.26 2012/02/18 23:51:27 rmind Exp $    */
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -47,14 +47,14 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: iomd_clock.c,v 1.25 2009/01/17 17:06:18 mjf Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iomd_clock.c,v 1.26 2012/02/18 23:51:27 rmind Exp $");
 
 #include <sys/systm.h>
+#include <sys/types.h>
 #include <sys/kernel.h>
 #include <sys/time.h>
 #include <sys/timetc.h>
 #include <sys/device.h>
-#include <sys/simplelock.h>
 #include <sys/intr.h>
 
 #include <dev/clock_subr.h>
@@ -92,8 +92,7 @@
 static volatile int timer0_ticked;
 /* TODO: Get IRQ status */
 
-static struct simplelock tmr_lock = SIMPLELOCK_INITIALIZER;  /* protect TC timer variables */
-
+static __cpu_simple_lock_t tmr_lock = __SIMPLELOCK_UNLOCKED;
 
 static struct timecounter iomd_timecounter = {
        iomd_timecounter0_get,
@@ -152,18 +151,18 @@
 
 
 static void
-tickle_tc(void) 
+tickle_tc(void)
 {
        if (timer0_count && 
            timecounter->tc_get_timecount == iomd_timecounter0_get) {
-               simple_lock(&tmr_lock);
+               __cpu_simple_lock(&tmr_lock);
                if (timer0_ticked)
                        timer0_ticked    = 0;
                else {
                        timer0_offset   += timer0_count;
                        timer0_lastcount = 0;
                }
-               simple_unlock(&tmr_lock);
+               __cpu_simple_unlock(&tmr_lock);
        }
 
 }
diff -r db5c3863715a -r 6c4f326db2e4 sys/arch/mac68k/obio/esp.c
--- a/sys/arch/mac68k/obio/esp.c        Sat Feb 18 23:47:48 2012 +0000
+++ b/sys/arch/mac68k/obio/esp.c        Sat Feb 18 23:51:27 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: esp.c,v 1.54 2011/08/02 05:17:18 uebayasi Exp $        */
+/*     $NetBSD: esp.c,v 1.55 2012/02/18 23:51:27 rmind Exp $   */
 
 /*
  * Copyright (c) 1997 Jason R. Thorpe.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.54 2011/08/02 05:17:18 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.55 2012/02/18 23:51:27 rmind Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -869,7 +869,7 @@
        /*
         * We have been called from the MI ncr53c9x_intr() handler,
         * which protects itself against multiple invocation with a
-        * simple_lock. Follow the example of ncr53c9x_poll().
+        * lock.  Follow the example of ncr53c9x_poll().
         */
        mutex_exit(&sc->sc_lock);
        ncr53c9x_intr(sc);
diff -r db5c3863715a -r 6c4f326db2e4 sys/arch/prep/pnpbus/nvram_pnpbus.c
--- a/sys/arch/prep/pnpbus/nvram_pnpbus.c       Sat Feb 18 23:47:48 2012 +0000
+++ b/sys/arch/prep/pnpbus/nvram_pnpbus.c       Sat Feb 18 23:51:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nvram_pnpbus.c,v 1.15 2011/06/18 08:08:29 matt Exp $ */
+/* $NetBSD: nvram_pnpbus.c,v 1.16 2012/02/18 23:51:27 rmind Exp $ */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvram_pnpbus.c,v 1.15 2011/06/18 08:08:29 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvram_pnpbus.c,v 1.16 2012/02/18 23:51:27 rmind Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -63,7 +63,6 @@
 static char *nvramGEAp;                /* pointer to the GE area */
 static char *nvramCAp;         /* pointer to the Config area */
 static char *nvramOSAp;                /* pointer to the OSArea */
-struct simplelock nvram_slock; /* lock */
 
 int prep_clock_mk48txx;
 
@@ -134,8 +133,6 @@
                return;
        }
 
-       simple_lock_init(&nvram_slock);
-
        /* Initialize the nvram header */
        p = (uint8_t *) &prep_nvram_header;
        for (i = 0; i < sizeof(HEADER); i++) 
@@ -373,14 +370,10 @@
                        return EINVAL;
 
                error = nvramgetstr(pnv->pnv_namelen, pnv->pnv_name, &name);
-               simple_lock(&nvram_slock);
                np = prep_nvram_get_var(name);
-               simple_unlock(&nvram_slock);
                if (np == NULL)
                        return EINVAL;
-               simple_lock(&nvram_slock);
                len = prep_nvram_get_var_len(name);
-               simple_unlock(&nvram_slock);
 
                if (len > pnv->pnv_buflen) {
                        error = ENOMEM;
@@ -394,7 +387,6 @@
 
        case PNVIOCGETNEXTNAME:
                /* if the first one is null, we give them the first name */
-               simple_lock(&nvram_slock);
                if (pnv->pnv_name == NULL) {
                        cp = nvramGEAp;
                } else {
@@ -405,7 +397,6 @@
                                cp = prep_nvram_next_var(np);
                        }
                }
-               simple_unlock(&nvram_slock);
                if (cp == NULL)
                        error = EINVAL;
                if (error)
@@ -427,9 +418,7 @@
 
        case PNVIOCGETNUMGE:
                /* count the GE variables */
-               simple_lock(&nvram_slock);
                pnv->pnv_num = prep_nvram_count_vars();
-               simple_unlock(&nvram_slock);
                break;
        case PNVIOCSET:
                /* this will require some real work.  Not ready yet */



Home | Main Index | Thread Index | Old Index