Source-Changes-HG archive

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

[src/trunk]: src/sys Mechanically replace simplelock with kmutex_t.



details:   https://anonhg.NetBSD.org/src/rev/96bfe3f4aa9b
branches:  trunk
changeset: 794631:96bfe3f4aa9b
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Mar 20 06:48:54 2014 +0000

description:
Mechanically replace simplelock with kmutex_t.

diffstat:

 sys/arch/arm/ixp12x0/ixp12x0_intr.c |   5 +-
 sys/arch/arm/xscale/ixp425_if_npe.c |   5 +-
 sys/arch/arm/xscale/ixp425_npe.c    |  36 +++++++++---------
 sys/arch/arm/xscale/ixp425_npevar.h |   4 +-
 sys/arch/xen/include/xbdvar.h       |   5 +--
 sys/coda/coda_vnops.c               |   6 +-
 sys/dev/mca/ed_mca.c                |  10 ++--
 sys/dev/mca/edc_mca.c               |  10 ++--
 sys/dev/mca/edvar.h                 |   6 +-
 sys/dev/pci/cxgb/cxgb_osdep.h       |  12 ++---
 sys/dev/pci/cy82c693.c              |  68 +++++++++++++++++-------------------
 sys/net/if_tap.c                    |  24 +++++-------
 sys/net/if_tun.c                    |  38 +++++++-------------
 13 files changed, 104 insertions(+), 125 deletions(-)

diffs (truncated from 800 to 300 lines):

diff -r 37aaec99762a -r 96bfe3f4aa9b sys/arch/arm/ixp12x0/ixp12x0_intr.c
--- a/sys/arch/arm/ixp12x0/ixp12x0_intr.c       Thu Mar 20 06:48:22 2014 +0000
+++ b/sys/arch/arm/ixp12x0/ixp12x0_intr.c       Thu Mar 20 06:48:54 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixp12x0_intr.c,v 1.27 2014/03/02 13:23:32 joerg Exp $ */
+/* $NetBSD: ixp12x0_intr.c,v 1.28 2014/03/20 06:48:54 skrll Exp $ */
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixp12x0_intr.c,v 1.27 2014/03/02 13:23:32 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp12x0_intr.c,v 1.28 2014/03/20 06:48:54 skrll Exp $");
 
 /*
  * Interrupt support for the Intel ixp12x0
@@ -39,7 +39,6 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/malloc.h>
-#include <sys/simplelock.h>
 #include <sys/termios.h>
 #include <sys/bus.h>
 #include <sys/intr.h>
diff -r 37aaec99762a -r 96bfe3f4aa9b sys/arch/arm/xscale/ixp425_if_npe.c
--- a/sys/arch/arm/xscale/ixp425_if_npe.c       Thu Mar 20 06:48:22 2014 +0000
+++ b/sys/arch/arm/xscale/ixp425_if_npe.c       Thu Mar 20 06:48:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp425_if_npe.c,v 1.24 2014/02/24 10:47:46 martin Exp $ */
+/*     $NetBSD: ixp425_if_npe.c,v 1.25 2014/03/20 06:48:54 skrll Exp $ */
 
 /*-
  * Copyright (c) 2006 Sam Leffler.  All rights reserved.
@@ -28,7 +28,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.24 2014/02/24 10:47:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.25 2014/03/20 06:48:54 skrll Exp $");
 
 /*
  * Intel XScale NPE Ethernet driver.
@@ -57,7 +57,6 @@
 #include <sys/socket.h>
 #include <sys/endian.h>
 #include <sys/ioctl.h>
-#include <sys/simplelock.h>
 #include <sys/syslog.h>
 
 #include <sys/bus.h>
diff -r 37aaec99762a -r 96bfe3f4aa9b sys/arch/arm/xscale/ixp425_npe.c
--- a/sys/arch/arm/xscale/ixp425_npe.c  Thu Mar 20 06:48:22 2014 +0000
+++ b/sys/arch/arm/xscale/ixp425_npe.c  Thu Mar 20 06:48:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp425_npe.c,v 1.9 2012/10/14 14:20:58 msaitoh Exp $   */
+/*     $NetBSD: ixp425_npe.c,v 1.10 2014/03/20 06:48:54 skrll Exp $    */
 
 /*-
  * Copyright (c) 2006 Sam Leffler, Errno Consulting
@@ -62,7 +62,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.9 2012/10/14 14:20:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.10 2014/03/20 06:48:54 skrll Exp $");
 
 /*
  * Intel XScale Network Processing Engine (NPE) support.
@@ -86,7 +86,7 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
-#include <sys/simplelock.h>
+#include <sys/mutex.h>
 #include <sys/time.h>
 #include <sys/proc.h>
 
@@ -274,7 +274,7 @@
     sc->sc_dt = ixa->ixa_dt;
     sc->sc_unit = ixa->ixa_npe;
 
-    simple_lock_init(&sc->sc_lock);
+    mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM);
 
     /* XXX: Check features to ensure this NPE is enabled */
 
@@ -353,13 +353,13 @@
 {
     int error;
 
-    simple_lock(&sc->sc_lock);
+    mutex_enter(&sc->sc_lock);
     error = npe_cpu_stop(sc);          /* stop NPE */
     if (error == 0)
        error = npe_cpu_reset(sc);      /* reset it */
     if (error == 0)
        sc->started = 0;                /* mark stopped */
-    simple_unlock(&sc->sc_lock);
+    mutex_exit(&sc->sc_lock);
 
     DPRINTF(sc->sc_dev, "%s: error %d\n", __func__, error);
     return error;
@@ -386,9 +386,9 @@
 {
        int ret;
 
-       simple_lock(&sc->sc_lock);
+       mutex_enter(&sc->sc_lock);
        ret = ixpnpe_start_locked(sc);
-       simple_unlock(&sc->sc_lock);
+       mutex_exit(&sc->sc_lock);
        return (ret);
 }
 
@@ -397,11 +397,11 @@
 {
     int error;
 
-    simple_lock(&sc->sc_lock);
+    mutex_enter(&sc->sc_lock);
     error = npe_cpu_stop(sc);
     if (error == 0)
        sc->started = 0;
-    simple_unlock(&sc->sc_lock);
+    mutex_exit(&sc->sc_lock);
 
     DPRINTF(sc->sc_dev, "%s: error %d\n", __func__, error);
     return error;
@@ -489,7 +489,7 @@
      * currently loaded images. If a critical error occured
      * during download, record that the NPE has an invalid image
      */
-    simple_lock(&sc->sc_lock);
+    mutex_enter(&sc->sc_lock);
     error = npe_load_image(sc, imageCodePtr, 1 /*VERIFY*/);
     if (error == 0) {
        sc->validImage = 1;
@@ -498,7 +498,7 @@
        sc->validImage = 0;
     }
     sc->functionalityId = IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET(imageId);
-    simple_unlock(&sc->sc_lock);
+    mutex_exit(&sc->sc_lock);
 done:
     DPRINTF(sc->sc_dev, "%s: error %d\n", __func__, error);
     return error;
@@ -1405,11 +1405,11 @@
 {
     int error;
 
-    simple_lock(&sc->sc_lock);
+    mutex_enter(&sc->sc_lock);
     error = ixpnpe_sendmsg_locked(sc, send);
     if (error == 0)
        error = ixpnpe_recvmsg_locked(sc, recv);
-    simple_unlock(&sc->sc_lock);
+    mutex_exit(&sc->sc_lock);
 
     return error;
 }
@@ -1421,9 +1421,9 @@
 {
     int error;
 
-    simple_lock(&sc->sc_lock);
+    mutex_enter(&sc->sc_lock);
     error = ixpnpe_sendmsg_locked(sc, msg);
-    simple_unlock(&sc->sc_lock);
+    mutex_exit(&sc->sc_lock);
 
     return error;
 }
@@ -1433,12 +1433,12 @@
 {
     int error;
 
-    simple_lock(&sc->sc_lock);
+    mutex_enter(&sc->sc_lock);
     if (sc->sc_msgwaiting)
        memcpy(msg, sc->sc_msg, sizeof(sc->sc_msg));
     /* NB: sc_msgwaiting != 1 means the ack fetch failed */
     error = sc->sc_msgwaiting != 1 ? EIO : 0;
-    simple_unlock(&sc->sc_lock);
+    mutex_exit(&sc->sc_lock);
 
     return error;
 }
diff -r 37aaec99762a -r 96bfe3f4aa9b sys/arch/arm/xscale/ixp425_npevar.h
--- a/sys/arch/arm/xscale/ixp425_npevar.h       Thu Mar 20 06:48:22 2014 +0000
+++ b/sys/arch/arm/xscale/ixp425_npevar.h       Thu Mar 20 06:48:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp425_npevar.h,v 1.4 2012/10/14 14:20:58 msaitoh Exp $        */
+/*     $NetBSD: ixp425_npevar.h,v 1.5 2014/03/20 06:48:54 skrll Exp $  */
 
 /*-
  * Copyright (c) 2006 Sam Leffler.  All rights reserved.
@@ -89,7 +89,7 @@
        bus_size_t      sc_size;        /* size of mapped register window */
        int             sc_unit;
        void            *sc_ih;         /* interrupt handler */
-       struct simplelock sc_lock;      /* mailbox lock */
+       kmutex_t        sc_lock;        /* mailbox lock */
        uint32_t        sc_msg[2];      /* reply msg collected in ixpnpe_intr */
        int             sc_msgwaiting;  /* sc_msg holds valid data */
 
diff -r 37aaec99762a -r 96bfe3f4aa9b sys/arch/xen/include/xbdvar.h
--- a/sys/arch/xen/include/xbdvar.h     Thu Mar 20 06:48:22 2014 +0000
+++ b/sys/arch/xen/include/xbdvar.h     Thu Mar 20 06:48:54 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xbdvar.h,v 1.14 2012/02/02 19:43:01 tls Exp $ */
+/* $NetBSD: xbdvar.h,v 1.15 2014/03/20 06:48:54 skrll Exp $ */
 
 /*
  *
@@ -30,14 +30,11 @@
 #ifndef _XEN_XBDVAR_H_
 #define _XEN_XBDVAR_H_
 
-#include <sys/simplelock.h>
-
 struct xbd_softc {
        device_t                sc_dev;         /* base device glue */
        struct dk_softc         sc_dksc;        /* generic disk interface */
        unsigned long           sc_xd_device;   /* cookie identifying device */
        struct dk_intf          *sc_di;         /* pseudo-disk interface */
-       struct simplelock       sc_slock;       /* our lock */
        int                     sc_shutdown;    /* about to be removed */
        krndsource_t    sc_rnd_source;
 };
diff -r 37aaec99762a -r 96bfe3f4aa9b sys/coda/coda_vnops.c
--- a/sys/coda/coda_vnops.c     Thu Mar 20 06:48:22 2014 +0000
+++ b/sys/coda/coda_vnops.c     Thu Mar 20 06:48:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: coda_vnops.c,v 1.95 2014/02/27 16:51:37 hannken Exp $  */
+/*     $NetBSD: coda_vnops.c,v 1.96 2014/03/20 06:48:54 skrll Exp $    */
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.95 2014/02/27 16:51:37 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.96 2014/03/20 06:48:54 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1936,7 +1936,7 @@
                 * XXX Perhaps we should not fully open the file, but
                 * simply obtain a container file.
                 */
-               /* XXX Is it ok to do this while holding the simplelock? */
+               /* XXX Is it ok to do this while holding the mutex? */
                cerror = VOP_OPEN(vp, FREAD, cred);
 
                if (cerror) {
diff -r 37aaec99762a -r 96bfe3f4aa9b sys/dev/mca/ed_mca.c
--- a/sys/dev/mca/ed_mca.c      Thu Mar 20 06:48:22 2014 +0000
+++ b/sys/dev/mca/ed_mca.c      Thu Mar 20 06:48:54 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ed_mca.c,v 1.54 2014/03/16 05:20:28 dholland Exp $     */
+/*     $NetBSD: ed_mca.c,v 1.55 2014/03/20 06:48:54 skrll Exp $        */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.54 2014/03/16 05:20:28 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.55 2014/03/20 06:48:54 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -158,7 +158,7 @@
        edc_add_disk(sc, ed);
 
        bufq_alloc(&ed->sc_q, "disksort", BUFQ_SORT_RAWBLOCK);
-       simple_lock_init(&ed->sc_q_lock);
+       mutex_init(&ed->sc_q_lock, MUTEX_DEFAULT, IPL_VM);
 
        if (ed_get_params(ed, &drv_flags)) {
                printf(": IDENTIFY failed, no disk found\n");
@@ -257,9 +257,9 @@
        bp->b_rawblkno = blkno;
 
        /* Queue transfer on drive, activate drive and controller if idle. */
-       simple_lock(&ed->sc_q_lock);
+       mutex_enter(&ed->sc_q_lock);
        bufq_put(ed->sc_q, bp);
-       simple_unlock(&ed->sc_q_lock);
+       mutex_exit(&ed->sc_q_lock);
 
        /* Ring the worker thread */
        wakeup(ed->edc_softc);
diff -r 37aaec99762a -r 96bfe3f4aa9b sys/dev/mca/edc_mca.c
--- a/sys/dev/mca/edc_mca.c     Thu Mar 20 06:48:22 2014 +0000
+++ b/sys/dev/mca/edc_mca.c     Thu Mar 20 06:48:54 2014 +0000



Home | Main Index | Thread Index | Old Index