]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/video/omap2/omapfb/omapfb-ioctl.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux...
[mv-sheeva.git] / drivers / video / omap2 / omapfb / omapfb-ioctl.c
index 7975a99c33f9c35a190c9fe6b002f25ffe09050f..6f435450987e7596d1e81963ea53bcc82bcd3f42 100644 (file)
@@ -222,6 +222,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
        rg = ofbi->region;
 
        down_write_nested(&rg->lock, rg->id);
+       atomic_inc(&rg->lock_count);
 
        if (atomic_read(&rg->map_count)) {
                r = -EBUSY;
@@ -252,6 +253,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
        }
 
  out:
+       atomic_dec(&rg->lock_count);
        up_write(&rg->lock);
 
        return r;
@@ -608,6 +610,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
                struct omapfb_vram_info         vram_info;
                struct omapfb_tearsync_info     tearsync_info;
                struct omapfb_display_info      display_info;
+               u32                             crt;
        } p;
 
        int r = 0;
@@ -766,6 +769,17 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
                        r = -EFAULT;
                break;
 
+       case FBIO_WAITFORVSYNC:
+               if (get_user(p.crt, (__u32 __user *)arg)) {
+                       r = -EFAULT;
+                       break;
+               }
+               if (p.crt != 0) {
+                       r = -ENODEV;
+                       break;
+               }
+               /* FALLTHROUGH */
+
        case OMAPFB_WAITFORVSYNC:
                DBG("ioctl WAITFORVSYNC\n");
                if (!display) {
@@ -856,7 +870,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
                        break;
                }
 
-               if (!display->driver->enable_te) {
+               if (!display || !display->driver->enable_te) {
                        r = -ENODEV;
                        break;
                }