
From: Andi Kleen <ak@muc.de>

Forward compat_ioctl through the frame buffer layer.

Signed-off-by: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/video/fbmem.c |   20 ++++++++++++++++++++
 25-akpm/include/linux/fb.h    |    4 ++++
 2 files changed, 24 insertions(+)

diff -puN drivers/video/fbmem.c~add-compat_ioctl-to-frame-buffer-layer drivers/video/fbmem.c
--- 25/drivers/video/fbmem.c~add-compat_ioctl-to-frame-buffer-layer	Tue Jan 18 15:43:58 2005
+++ 25-akpm/drivers/video/fbmem.c	Tue Jan 18 15:43:58 2005
@@ -868,6 +868,23 @@ fb_ioctl(struct inode *inode, struct fil
 	}
 }
 
+#ifdef CONFIG_COMPAT
+static long
+fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int fbidx = iminor(file->f_dentry->d_inode);
+	struct fb_info *info = registered_fb[fbidx];
+	struct fb_ops *fb = info->fbops;
+	int ret;
+	if (fb->fb_compat_ioctl == NULL)
+		return -ENOIOCTLCMD;
+	lock_kernel();
+	ret = fb->fb_compat_ioctl(file, cmd, arg, info);
+	unlock_kernel();
+	return ret;
+}
+#endif
+
 static int 
 fb_mmap(struct file *file, struct vm_area_struct * vma)
 {
@@ -1009,6 +1026,9 @@ static struct file_operations fb_fops = 
 	.read =		fb_read,
 	.write =	fb_write,
 	.ioctl =	fb_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = fb_compat_ioctl,
+#endif
 	.mmap =		fb_mmap,
 	.open =		fb_open,
 	.release =	fb_release,
diff -puN include/linux/fb.h~add-compat_ioctl-to-frame-buffer-layer include/linux/fb.h
--- 25/include/linux/fb.h~add-compat_ioctl-to-frame-buffer-layer	Tue Jan 18 15:43:58 2005
+++ 25-akpm/include/linux/fb.h	Tue Jan 18 15:43:58 2005
@@ -584,6 +584,10 @@ struct fb_ops {
 	int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd,
 			unsigned long arg, struct fb_info *info);
 
+	/* Handle 32bit compat ioctl (optional) */
+	int (*fb_compat_ioctl)(struct file *f, unsigned cmd, unsigned long arg,
+			       struct fb_info *info);
+
 	/* perform fb specific mmap */
 	int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma);
 };
_
