Module Name:    src
Committed By:   drochner
Date:           Thu Feb  2 13:11:25 UTC 2012

Modified Files:
        src/sys/dev/wscons: wsdisplay.c

Log Message:
delete virtual screens on detach - this allows to hot-unplug
a udl@usb monitor without crash


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/wscons/wsdisplay.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wscons/wsdisplay.c
diff -u src/sys/dev/wscons/wsdisplay.c:1.134 src/sys/dev/wscons/wsdisplay.c:1.135
--- src/sys/dev/wscons/wsdisplay.c:1.134	Sun Apr 24 16:27:01 2011
+++ src/sys/dev/wscons/wsdisplay.c	Thu Feb  2 13:11:25 2012
@@ -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);

Reply via email to