diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/video.c | 15 | ||||
-rw-r--r-- | sys/dev/videovar.h | 4 |
2 files changed, 14 insertions, 5 deletions
diff --git a/sys/dev/video.c b/sys/dev/video.c index 57d69a2847c..cfa33d97126 100644 --- a/sys/dev/video.c +++ b/sys/dev/video.c @@ -1,4 +1,4 @@ -/* $OpenBSD: video.c,v 1.17 2008/07/19 06:39:00 mglocker Exp $ */ +/* $OpenBSD: video.c,v 1.18 2008/07/23 22:10:21 mglocker Exp $ */ /* * Copyright (c) 2008 Robert Nagy <robert@openbsd.org> * Copyright (c) 2008 Marcus Glocker <mglocker@openbsd.org> @@ -97,6 +97,10 @@ videoopen(dev_t dev, int flags, int fmt, struct proc *p) sc->hw_if == NULL) return (ENXIO); + if (sc->sc_open & VIDEO_OPEN) + return (EBUSY); + sc->sc_open |= VIDEO_OPEN; + sc->sc_start_read = 0; if (sc->hw_if->open != NULL) @@ -110,13 +114,16 @@ int videoclose(dev_t dev, int flags, int fmt, struct proc *p) { struct video_softc *sc; + int r = 0; sc = video_cd.cd_devs[VIDEOUNIT(dev)]; if (sc->hw_if->close != NULL) - return (sc->hw_if->close(sc->hw_hdl)); - else - return (0); + r = sc->hw_if->close(sc->hw_hdl); + + sc->sc_open &= ~VIDEO_OPEN; + + return (r); } int diff --git a/sys/dev/videovar.h b/sys/dev/videovar.h index 8625a5181e4..678a6da1e35 100644 --- a/sys/dev/videovar.h +++ b/sys/dev/videovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: videovar.h,v 1.5 2008/06/13 05:00:32 mglocker Exp $ */ +/* $OpenBSD: videovar.h,v 1.6 2008/07/23 22:10:21 mglocker Exp $ */ /* * Copyright (c) 2008 Robert Nagy <robert@openbsd.org> * Copyright (c) 2008 Marcus Glocker <mglocker@openbsd.org> @@ -25,6 +25,8 @@ struct video_softc { struct device *sc_dev; /* hardware device struct */ struct video_hw_if *hw_if; /* hardware interface */ char sc_dying; /* device detached */ +#define VIDEO_OPEN 0x01 + char sc_open; int sc_fsize; uint8_t *sc_fbuffer; |