diff --git a/sys/dev/i2o/dpti.c b/sys/dev/i2o/dpti.c index bb609e69b312..8966f8725727 100644 --- a/sys/dev/i2o/dpti.c +++ b/sys/dev/i2o/dpti.c @@ -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 -__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 #include @@ -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: diff --git a/sys/dev/i2o/dptivar.h b/sys/dev/i2o/dptivar.h index 250a7866383a..ea4ced3fe0d8 100644 --- a/sys/dev/i2o/dptivar.h +++ b/sys/dev/i2o/dptivar.h @@ -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 --git a/sys/dev/ic/dpt.c b/sys/dev/ic/dpt.c index e6952ad2a7b1..baa2cab71ef0 100644 --- a/sys/dev/ic/dpt.c +++ b/sys/dev/ic/dpt.c @@ -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 -__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 #include @@ -82,6 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.65 2011/07/01 08:38:10 mrg Exp $"); #include #include #include +#include #include #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: diff --git a/sys/dev/ic/dptvar.h b/sys/dev/ic/dptvar.h index c55de5b7d548..27c31657c8f4 100644 --- a/sys/dev/ic/dptvar.h +++ b/sys/dev/ic/dptvar.h @@ -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 @@ -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 */ diff --git a/sys/dev/mca/ed_mca.c b/sys/dev/mca/ed_mca.c index 7ebd5007d469..cda2cf7c6ccd 100644 --- a/sys/dev/mca/ed_mca.c +++ b/sys/dev/mca/ed_mca.c @@ -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 -__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: diff --git a/sys/dev/mca/edc_mca.c b/sys/dev/mca/edc_mca.c index b0ec93750f06..a69b8c3f861b 100644 --- a/sys/dev/mca/edc_mca.c +++ b/sys/dev/mca/edc_mca.c @@ -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 -__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);