Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k/dev Avoid panic when the device is closed when...
details: https://anonhg.NetBSD.org/src/rev/ff346f7e0791
branches: trunk
changeset: 354677:ff346f7e0791
user: isaki <isaki%NetBSD.org@localhost>
date: Sun Jun 25 06:26:40 2017 +0000
description:
Avoid panic when the device is closed when not playing.
diffstat:
sys/arch/x68k/dev/vs.c | 25 +++++++++++++++++--------
sys/arch/x68k/dev/vsvar.h | 3 ++-
2 files changed, 19 insertions(+), 9 deletions(-)
diffs (91 lines):
diff -r 9fd8273d6c01 -r ff346f7e0791 sys/arch/x68k/dev/vs.c
--- a/sys/arch/x68k/dev/vs.c Sun Jun 25 04:10:47 2017 +0000
+++ b/sys/arch/x68k/dev/vs.c Sun Jun 25 06:26:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vs.c,v 1.37 2017/06/01 02:45:08 chs Exp $ */
+/* $NetBSD: vs.c,v 1.38 2017/06/25 06:26:40 isaki Exp $ */
/*
* Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.37 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.38 2017/06/25 06:26:40 isaki Exp $");
#include "audio.h"
#include "vs.h"
@@ -232,6 +232,7 @@
sc->sc_hw_if = &vs_hw_if;
sc->sc_addr = (void *) ia->ia_addr;
sc->sc_dmas = NULL;
+ sc->sc_active = 0;
mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
@@ -542,6 +543,7 @@
dmac_load_xfer(chan->ch_softc, xf);
dmac_start_xfer_offset(chan->ch_softc, xf, 0, sc->sc_current.blksize);
bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 2);
+ sc->sc_active = 1;
return 0;
}
@@ -589,6 +591,7 @@
dmac_load_xfer(chan->ch_softc, xf);
dmac_start_xfer_offset(chan->ch_softc, xf, 0, sc->sc_current.blksize);
bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 4);
+ sc->sc_active = 1;
return 0;
}
@@ -600,9 +603,12 @@
DPRINTF(1, ("vs_halt_output\n"));
sc = hdl;
- /* stop ADPCM play */
- dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+ if (sc->sc_active) {
+ /* stop ADPCM play */
+ dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+ sc->sc_active = 0;
+ }
return 0;
}
@@ -614,9 +620,12 @@
DPRINTF(1, ("vs_halt_input\n"));
sc = hdl;
- /* stop ADPCM recoding */
- dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+ if (sc->sc_active) {
+ /* stop ADPCM recoding */
+ dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+ sc->sc_active = 0;
+ }
return 0;
}
diff -r 9fd8273d6c01 -r ff346f7e0791 sys/arch/x68k/dev/vsvar.h
--- a/sys/arch/x68k/dev/vsvar.h Sun Jun 25 04:10:47 2017 +0000
+++ b/sys/arch/x68k/dev/vsvar.h Sun Jun 25 06:26:40 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vsvar.h,v 1.11 2011/11/23 23:07:30 jmcneill Exp $ */
+/* $NetBSD: vsvar.h,v 1.12 2017/06/25 06:26:40 isaki Exp $ */
/*
* Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -94,6 +94,7 @@
int bufsize, blksize;
int dmap;
} sc_current;
+ int sc_active;
const struct audio_hw_if *sc_hw_if;
Home |
Main Index |
Thread Index |
Old Index