diff options
| author | drochner <drochner@NetBSD.org> | 2012-02-02 13:11:25 +0000 |
|---|---|---|
| committer | drochner <drochner@NetBSD.org> | 2012-02-02 13:11:25 +0000 |
| commit | 11355dafc02531fb9813d459ecd3f0b0ea5e54cb (patch) | |
| tree | 8ca4b3d469e1cf67fb4bd74b624649750f19077f /sys/dev | |
| parent | f530e16eb25a1d3847c9c363be2f94c75838b519 (diff) | |
delete virtual screens on detach - this allows to hot-unplug
a udl@usb monitor without crash
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/wscons/wsdisplay.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 3a69954e700..cf39a53620a 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.134 2011/04/24 16:27:01 rmind Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.135 2012/02/02 13:11:25 drochner Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.134 2011/04/24 16:27:01 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.135 2012/02/02 13:11:25 drochner Exp $"); #include "opt_wsdisplay_compat.h" #include "opt_wsmsgattrs.h" @@ -592,6 +592,15 @@ int wsdisplay_emul_detach(device_t dev, int how) { struct wsdisplay_softc *sc = device_private(dev); + int flag, i, res; + + flag = (how & DETACH_FORCE ? WSDISPLAY_DELSCR_FORCE : 0); + for (i = 0; i < WSDISPLAY_MAXSCREEN; i++) + if (sc->sc_scr[i]) { + res = wsdisplay_delscreen(sc, i, flag); + if (res) + return res; + } cv_destroy(&sc->sc_flagscv); mutex_destroy(&sc->sc_flagsmtx); |
