Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Replace some wakeup_one(9) uses with mutex(9) or pla...
details: https://anonhg.NetBSD.org/src/rev/f943cbe1c336
branches: trunk
changeset: 768063:f943cbe1c336
user: rmind <rmind%NetBSD.org@localhost>
date: Sun Aug 07 13:39:23 2011 +0000
description:
Replace some wakeup_one(9) uses with mutex(9) or plain wakeup(9).
diffstat:
sys/dev/i2o/dpti.c | 17 +++++++----------
sys/dev/i2o/dptivar.h | 3 +--
sys/dev/ic/dpt.c | 13 ++++++-------
sys/dev/ic/dptvar.h | 4 ++--
sys/dev/mca/ed_mca.c | 6 +++---
sys/dev/mca/edc_mca.c | 6 +++---
6 files changed, 22 insertions(+), 27 deletions(-)
diffs (186 lines):
diff -r 698ff1078a8d -r f943cbe1c336 sys/dev/i2o/dpti.c
--- a/sys/dev/i2o/dpti.c Sun Aug 07 13:33:01 2011 +0000
+++ b/sys/dev/i2o/dpti.c Sun Aug 07 13:39:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dpti.c,v 1.43 2010/11/13 13:51:59 uebayasi Exp $ */
+/* $NetBSD: dpti.c,v 1.44 2011/08/07 13:39:23 rmind Exp $ */
/*-
* Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.43 2010/11/13 13:51:59 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.44 2011/08/07 13:39:23 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -272,16 +272,13 @@
if (rv)
break;
- if (sc->sc_nactive++ >= 2)
- tsleep(&sc->sc_nactive, PRIBIO, "dptislp", 0);
-
- if (linux)
+ mutex_enter(&iop->sc_conflock);
+ if (linux) {
rv = dpti_passthrough(sc, data, l->l_proc);
- else
+ } else {
rv = dpti_passthrough(sc, *(void **)data, l->l_proc);
-
- sc->sc_nactive--;
- wakeup_one(&sc->sc_nactive);
+ }
+ mutex_exit(&iop->sc_conflock);
break;
case DPT_I2ORESETCMD:
diff -r 698ff1078a8d -r f943cbe1c336 sys/dev/i2o/dptivar.h
--- a/sys/dev/i2o/dptivar.h Sun Aug 07 13:33:01 2011 +0000
+++ b/sys/dev/i2o/dptivar.h Sun Aug 07 13:39:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dptivar.h,v 1.7 2008/04/28 20:23:48 martin Exp $ */
+/* $NetBSD: dptivar.h,v 1.8 2011/08/07 13:39:23 rmind Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -63,7 +63,6 @@
struct dpti_softc {
struct device sc_dv;
int sc_blinkled;
- int sc_nactive;
};
struct dpti_ptbuf {
diff -r 698ff1078a8d -r f943cbe1c336 sys/dev/ic/dpt.c
--- a/sys/dev/ic/dpt.c Sun Aug 07 13:33:01 2011 +0000
+++ b/sys/dev/ic/dpt.c Sun Aug 07 13:39:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dpt.c,v 1.65 2011/07/01 08:38:10 mrg Exp $ */
+/* $NetBSD: dpt.c,v 1.66 2011/08/07 13:39:24 rmind Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.65 2011/07/01 08:38:10 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.66 2011/08/07 13:39:24 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -82,6 +82,7 @@
#include <sys/conf.h>
#include <sys/kauth.h>
#include <sys/proc.h>
+#include <sys/mutex.h>
#include <sys/bus.h>
#ifdef i386
@@ -330,6 +331,7 @@
ec = &sc->sc_ec;
snprintf(dpt_sig.dsDescription, sizeof(dpt_sig.dsDescription),
"NetBSD %s DPT driver", osrelease);
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
/*
* Allocate the CCB/status packet/scratch DMA map and load.
@@ -1156,13 +1158,10 @@
return (EINVAL);
}
- if (sc->sc_uactive++)
- tsleep(&sc->sc_uactive, PRIBIO, "dptslp", 0);
-
+ mutex_enter(&sc->sc_lock);
rv = dpt_passthrough(sc, (struct eata_ucp *)data, l);
+ mutex_exit(&sc->sc_lock);
- sc->sc_uactive--;
- wakeup_one(&sc->sc_uactive);
return (rv);
default:
diff -r 698ff1078a8d -r f943cbe1c336 sys/dev/ic/dptvar.h
--- a/sys/dev/ic/dptvar.h Sun Aug 07 13:33:01 2011 +0000
+++ b/sys/dev/ic/dptvar.h Sun Aug 07 13:39:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dptvar.h,v 1.14 2007/03/04 06:01:54 christos Exp $ */
+/* $NetBSD: dptvar.h,v 1.15 2011/08/07 13:39:24 rmind Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Andrew Doran <ad%NetBSD.org@localhost>
@@ -65,6 +65,7 @@
struct dpt_softc {
struct device sc_dv; /* generic device data */
+ kmutex_t sc_lock;
struct scsipi_adapter sc_adapt; /* scsipi adapter */
struct scsipi_channel sc_chans[3]; /* each channel */
bus_space_handle_t sc_ioh; /* bus space handle */
@@ -83,7 +84,6 @@
int sc_nccbs; /* number of CCBs available */
SLIST_HEAD(, dpt_ccb) sc_ccb_free;/* free ccb list */
struct eata_cfg sc_ec; /* EATA configuration data */
- int sc_uactive; /* user command active */
int sc_bustype; /* SysInfo bus type */
int sc_isadrq; /* ISA DRQ */
int sc_isairq; /* ISA IRQ */
diff -r 698ff1078a8d -r f943cbe1c336 sys/dev/mca/ed_mca.c
--- a/sys/dev/mca/ed_mca.c Sun Aug 07 13:33:01 2011 +0000
+++ b/sys/dev/mca/ed_mca.c Sun Aug 07 13:39:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ed_mca.c,v 1.47 2009/05/12 14:31:00 cegger Exp $ */
+/* $NetBSD: ed_mca.c,v 1.48 2011/08/07 13:39:24 rmind 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.47 2009/05/12 14:31:00 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.48 2011/08/07 13:39:24 rmind Exp $");
#include "rnd.h"
@@ -254,7 +254,7 @@
simple_unlock(&ed->sc_q_lock);
/* Ring the worker thread */
- wakeup_one(ed->edc_softc);
+ wakeup(ed->edc_softc);
return;
done:
diff -r 698ff1078a8d -r f943cbe1c336 sys/dev/mca/edc_mca.c
--- a/sys/dev/mca/edc_mca.c Sun Aug 07 13:33:01 2011 +0000
+++ b/sys/dev/mca/edc_mca.c Sun Aug 07 13:39:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edc_mca.c,v 1.44 2009/05/12 14:31:00 cegger Exp $ */
+/* $NetBSD: edc_mca.c,v 1.45 2011/08/07 13:39:24 rmind Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.44 2009/05/12 14:31:00 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.45 2011/08/07 13:39:24 rmind Exp $");
#include "rnd.h"
@@ -481,7 +481,7 @@
if (intr_id != ISR_DATA_TRANSFER_RDY) {
if (cmd == CMD_READ_DATA || cmd == CMD_WRITE_DATA)
sc->sc_resblk = sc->status_block[SB_RESBLKCNT_IDX];
- wakeup_one(sc);
+ wakeup(sc);
}
return (1);
Home |
Main Index |
Thread Index |
Old Index