patch-2.2.7 linux/drivers/video/fbmem.c

Next file: linux/drivers/video/leofb.c
Previous file: linux/drivers/video/fbcon.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.6/linux/drivers/video/fbmem.c linux/drivers/video/fbmem.c
@@ -203,17 +203,24 @@
 static int last_fb_vc = MAX_NR_CONSOLES-1;
 static int fbcon_is_default = 1;
 
-static inline int PROC_CONSOLE(void)
+static int PROC_CONSOLE(struct fb_info *info)
 {
+	int fgc;
+	
+	if (info->display_fg != NULL)
+		fgc = info->display_fg->vc_num;
+	else
+		return -1;
+		
 	if (!current->tty)
-		return fg_console;
+		return fgc;
 
 	if (current->tty->driver.type != TTY_DRIVER_TYPE_CONSOLE)
 		/* XXX Should report error here? */
-		return fg_console;
+		return fgc;
 
 	if (MINOR(current->tty->device) < 1)
-		return fg_console;
+		return fgc;
 
 	return MINOR(current->tty->device) - 1;
 }
@@ -248,7 +255,7 @@
 	if (! fb || ! info->disp)
 		return -ENODEV;
 
-	fb->fb_get_fix(&fix,PROC_CONSOLE(), info);
+	fb->fb_get_fix(&fix,PROC_CONSOLE(info), info);
 	base_addr=info->disp->screen_base;
 	copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
 	if (copy_to_user(buf, base_addr+p, copy_size))
@@ -272,7 +279,7 @@
 	if (! fb || ! info->disp)
 		return -ENODEV;
 
-	fb->fb_get_fix(&fix, PROC_CONSOLE(), info);
+	fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
 	base_addr=info->disp->screen_base;
 	copy_size=(count + p <= fix.smem_len ? count : fix.smem_len - p);
 	if (copy_from_user(base_addr+p, buf, copy_size))
@@ -288,7 +295,7 @@
     int unit, err;
 
     var->activate |= FB_ACTIVATE_TEST;
-    err = fb->fb_set_var(var, PROC_CONSOLE(), info);
+    err = fb->fb_set_var(var, PROC_CONSOLE(info), info);
     var->activate &= ~FB_ACTIVATE_TEST;
     if (err)
 	    return err;
@@ -365,7 +372,7 @@
 		return -ENODEV;
 	switch (cmd) {
 	case FBIOGET_VSCREENINFO:
-		if ((i = fb->fb_get_var(&var, PROC_CONSOLE(), info)))
+		if ((i = fb->fb_get_var(&var, PROC_CONSOLE(info), info)))
 			return i;
 		return copy_to_user((void *) arg, &var,
 				    sizeof(var)) ? -EFAULT : 0;
@@ -374,29 +381,29 @@
 			return -EFAULT;
 		i = var.activate & FB_ACTIVATE_ALL
 			    ? set_all_vcs(fbidx, fb, &var, info)
-			    : fb->fb_set_var(&var, PROC_CONSOLE(), info);
+			    : fb->fb_set_var(&var, PROC_CONSOLE(info), info);
 		if (i)
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
 		return 0;
 	case FBIOGET_FSCREENINFO:
-		if ((i = fb->fb_get_fix(&fix, PROC_CONSOLE(), info)))
+		if ((i = fb->fb_get_fix(&fix, PROC_CONSOLE(info), info)))
 			return i;
 		return copy_to_user((void *) arg, &fix, sizeof(fix)) ?
 			-EFAULT : 0;
 	case FBIOPUTCMAP:
 		if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
 			return -EFAULT;
-		return (fb->fb_set_cmap(&cmap, 0, PROC_CONSOLE(), info));
+		return (fb->fb_set_cmap(&cmap, 0, PROC_CONSOLE(info), info));
 	case FBIOGETCMAP:
 		if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
 			return -EFAULT;
-		return (fb->fb_get_cmap(&cmap, 0, PROC_CONSOLE(), info));
+		return (fb->fb_get_cmap(&cmap, 0, PROC_CONSOLE(info), info));
 	case FBIOPAN_DISPLAY:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		if ((i=fb->fb_pan_display(&var, PROC_CONSOLE(), info)))
+		if ((i=fb->fb_pan_display(&var, PROC_CONSOLE(info), info)))
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -430,7 +437,7 @@
 			set_con2fb_map(i, con2fb.framebuffer);
 		return 0;
 	default:
-		return fb->fb_ioctl(inode, file, cmd, arg, PROC_CONSOLE(),
+		return fb->fb_ioctl(inode, file, cmd, arg, PROC_CONSOLE(info),
 				    info);
 	}
 }
@@ -450,7 +457,7 @@
 		return -ENODEV;
 	if (fb->fb_mmap)
 		return fb->fb_mmap(info, file, vma);
-	fb->fb_get_fix(&fix, PROC_CONSOLE(), info);
+	fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
 
 	/* frame buffer memory */
 	start = (unsigned long)fix.smem_start;
@@ -460,7 +467,7 @@
 	if (vma->vm_offset >= len) {
 		/* memory mapped io */
 		vma->vm_offset -= len;
-		fb->fb_get_var(&var, PROC_CONSOLE(), info);
+		fb->fb_get_var(&var, PROC_CONSOLE(info), info);
 		if (var.accel_flags)
 			return -EINVAL;
 		start = (unsigned long)fix.mmio_start;

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