All pastes #921128 Raw Edit

Someone

public c v1 · immutable
#921128 ·published 2008-02-27 20:50 UTC
rendered paste body
Index: linux-2.6.24.2/drivers/video/fbmem.c===================================================================--- linux-2.6.24.2.orig/drivers/video/fbmem.c+++ linux-2.6.24.2/drivers/video/fbmem.c@@ -1208,7 +1208,7 @@ fb_compat_ioctl(struct file *file, unsig 	struct fb_ops *fb = info->fbops; 	long ret = -ENOIOCTLCMD; -	lock_kernel();+	mutex_lock(&info->fblock); 	switch(cmd) { 	case FBIOGET_VSCREENINFO: 	case FBIOPUT_VSCREENINFO:@@ -1234,7 +1234,7 @@ fb_compat_ioctl(struct file *file, unsig 			ret = fb->fb_compat_ioctl(info, cmd, arg); 		break; 	}-	unlock_kernel();+	mutex_unlock(&info->fblock); 	return ret; } #endif@@ -1256,13 +1256,13 @@ fb_mmap(struct file *file, struct vm_are 		return -ENODEV; 	if (fb->fb_mmap) { 		int res;-		lock_kernel();+		mutex_lock(&info->fblock); 		res = fb->fb_mmap(info, vma);-		unlock_kernel();+		mutex_unlock(&info->fblock); 		return res; 	} -	lock_kernel();+	mutex_lock(&info->fblock);  	/* frame buffer memory */ 	start = info->fix.smem_start;@@ -1271,13 +1271,13 @@ fb_mmap(struct file *file, struct vm_are 		/* memory mapped io */ 		off -= len; 		if (info->var.accel_flags) {-			unlock_kernel();+			mutex_unlock(&info->fblock); 			return -EINVAL; 		} 		start = info->fix.mmio_start; 		len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); 	}-	unlock_kernel();+	mutex_unlock(&info->fblock); 	start &= PAGE_MASK; 	if ((vma->vm_end - vma->vm_start + off) > len) 		return -EINVAL;@@ -1323,11 +1323,11 @@ fb_release(struct inode *inode, struct f { 	struct fb_info * const info = file->private_data; -	lock_kernel();+	mutex_lock(&info->fblock); 	if (info->fbops->fb_release) 		info->fbops->fb_release(info,1); 	module_put(info->fbops->owner);-	unlock_kernel();+	mutex_unlock(&info->fblock); 	return 0; } @@ -1413,6 +1413,8 @@ register_framebuffer(struct fb_info *fb_  	event.info = fb_info; 	fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);++	mutex_init(&fb_info.fblock); 	return 0; } @@ -1464,6 +1466,7 @@ unregister_framebuffer(struct fb_info *f 	device_destroy(fb_class, MKDEV(FB_MAJOR, i)); 	event.info = fb_info; 	fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);+	mutex_destroy(&fb_info.fblock); done: 	return ret; }Index: linux-2.6.24.2/include/linux/fb.h===================================================================--- linux-2.6.24.2.orig/include/linux/fb.h+++ linux-2.6.24.2/include/linux/fb.h@@ -804,6 +804,7 @@ struct fb_info { 	struct list_head modelist;      /* mode list */ 	struct fb_videomode *mode;	/* current mode */ +	struct mutex fblock;		/* mutex for protecting hw ops */ #ifdef CONFIG_FB_BACKLIGHT 	/* assigned backlight device */ 	/* set before framebuffer registration,