Replace some wakeup_one(9) uses with mutex(9) or plain wakeup(9).

This commit is contained in:
rmind 2011-08-07 13:39:23 +00:00
parent 52b220e91d
commit 1293cee4bd
6 changed files with 22 additions and 27 deletions

View File

@ -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 @@ dptiioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
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:

View File

@ -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 {

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.65 2011/07/01 08:38:10 mrg Exp $");
#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 @@ dpt_init(struct dpt_softc *sc, const char *intrstr)
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 @@ dptioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
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:

View File

@ -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>
@ -65,6 +65,7 @@ struct dpt_ccb {
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 @@ struct dpt_softc {
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 */

View File

@ -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 @@ edmcastrategy(struct buf *bp)
simple_unlock(&ed->sc_q_lock);
/* Ring the worker thread */
wakeup_one(ed->edc_softc);
wakeup(ed->edc_softc);
return;
done:

View File

@ -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 @@ edc_intr(void *arg)
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);