summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-09-07 04:42:16 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-09-07 04:42:16 +0000
commit50a9099ddaa433c1fdfb3fc8fd6c0cbdc7564659 (patch)
treebc5a2732d2de647fc5e65de280f1e09895e27353
parent50e414e8ea506394fa3f997b69f8ac5476dfa0a2 (diff)
rely on SCSI_AUTOCONF for cd_resume instead of wrapping it in a workq
(which creates a potential race against cd detach) discussed with krw and dlg seperately
-rw-r--r--sys/scsi/cd.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index e5fa0b3b650..66727207b74 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.185 2010/09/01 01:38:12 dlg Exp $ */
+/* $OpenBSD: cd.c,v 1.186 2010/09/07 04:42:15 deraadt Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -115,8 +115,6 @@ struct cd_softc {
struct scsi_xshandler sc_xsh;
struct timeout sc_timeout;
void *sc_cdpwrhook; /* our power hook */
-
- struct workq_task sc_resume_wqt;
};
void cdstart(struct scsi_xfer *);
@@ -149,7 +147,7 @@ int dvd_read_manufact(struct cd_softc *, union dvd_struct *);
int dvd_read_struct(struct cd_softc *, union dvd_struct *);
void cd_powerhook(int why, void *arg);
-void cd_resume(void *, void *);
+void cd_resume(struct cd_softc *);
#if defined(__macppc__)
int cd_eject(void);
@@ -258,8 +256,7 @@ cdactivate(struct device *self, int act)
* there are any open partitions, lock the CD.
*/
if (sc->sc_dk.dk_openmask != 0)
- workq_queue_task(NULL, &sc->sc_resume_wqt, 0,
- cd_resume, sc, NULL);
+ cd_resume(sc);
break;
case DVACT_DEACTIVATE:
sc->sc_flags |= CDF_DYING;
@@ -270,13 +267,11 @@ cdactivate(struct device *self, int act)
}
void
-cd_resume(void *arg1, void *arg2)
+cd_resume(struct cd_softc *sc)
{
- struct cd_softc *sc = arg1;
-
scsi_prevent(sc->sc_link, PR_PREVENT,
SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_MEDIA_CHANGE |
- SCSI_SILENT);
+ SCSI_SILENT | SCSI_AUTOCONF);
}
void
@@ -285,7 +280,7 @@ cd_powerhook(int why, void *arg)
struct cd_softc *sc = arg;
if (why == DVACT_RESUME && sc->sc_dk.dk_openmask != 0)
- cd_resume(sc, NULL);
+ cd_resume(sc);
}
int