patch-2.3.99-pre7 linux/drivers/video/sbusfb.c

Next file: linux/drivers/video/tdfxfb.c
Previous file: linux/drivers/video/matrox/matroxfb_base.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre6/linux/drivers/video/sbusfb.c linux/drivers/video/sbusfb.c
@@ -131,10 +131,12 @@
 	struct fb_info_sbusfb *fb = sbusfbinfo(info);
 	
 	if (user) {
-		if (fb->open) return -EBUSY;
-		fb->mmaped = 0;
-		fb->open = 1;
-		fb->vtconsole = -1;
+		if (fb->open == 0) {
+			fb->mmaped = 0;
+			fb->open = 1;
+			fb->vtconsole = -1;
+		}
+		fb->open++;
 	} else
 		fb->consolecnt++;
 	MOD_INC_USE_COUNT;
@@ -146,15 +148,18 @@
 	struct fb_info_sbusfb *fb = sbusfbinfo(info);
 
 	if (user) {	
-		if (fb->vtconsole != -1) {
-			vt_cons[fb->vtconsole]->vc_mode = KD_TEXT;
-			if (fb->mmaped) {
-				fb->graphmode--;
-				sbusfb_clear_margin(&fb_display[fb->vtconsole], 0);
+		fb->open--;
+		if (fb->open == 0) {
+			if (fb->vtconsole != -1) {
+				vt_cons[fb->vtconsole]->vc_mode = KD_TEXT;
+				if (fb->mmaped) {
+					fb->graphmode--;
+					sbusfb_clear_margin(&fb_display[fb->vtconsole], 0);
+				}
 			}
+			if (fb->reset)
+				fb->reset(fb);
 		}
-		if (fb->reset)
-			fb->reset(fb);
 		fb->open = 0;
 	} else
 		fb->consolecnt--;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)