video: fix deferred io fsync()
authorMagnus Damm <damm@igel.co.jp>
Fri, 19 Dec 2008 06:34:09 +0000 (15:34 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 22 Dec 2008 09:44:48 +0000 (18:44 +0900)
If CONFIG_FB_DEFERRED_IO is set, but there are framebuffers
registered that does not make use of deferred io, then fsync()
on those framebuffers will result in a crash. Fix that.

This is needed for sh_mobile_lcdcfb since we always enable
deferred io at compile time but we may disable deferred io
for some types of hardware configurations.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Acked-by: Jaya Kumar <jayakumar.lkml@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
drivers/video/fb_defio.c

index 4835bdc4e9f1819615ab2454549f9a637d01a0e1..e6dafeddfa5be84b9d5bdc406b30a0464748c722 100644 (file)
@@ -60,6 +60,10 @@ int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, int datasync)
 {
        struct fb_info *info = file->private_data;
 
+       /* Skip if deferred io is complied-in but disabled on this fbdev */
+       if (!info->fbdefio)
+               return 0;
+
        /* Kill off the delayed work */
        cancel_rearming_delayed_work(&info->deferred_work);