OMAPDSS: OMAPFB: check for matching memory size early
authorGrazvydas Ignotas <notasas@gmail.com>
Fri, 9 Mar 2012 00:42:49 +0000 (02:42 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 23 Apr 2012 07:48:06 +0000 (10:48 +0300)
If the size of memory region that is being set up is the same as before,
we don't have to do memory and layer busy checks.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/omapfb/omapfb-ioctl.c

index 6a09ef87e14fae9886461bb7855c9d97350707e0..27a85813c6001e147ad065b5580df4d5370d1010 100644 (file)
@@ -225,6 +225,9 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
        down_write_nested(&rg->lock, rg->id);
        atomic_inc(&rg->lock_count);
 
+       if (rg->size == size && rg->type == mi->type)
+               goto out;
+
        if (atomic_read(&rg->map_count)) {
                r = -EBUSY;
                goto out;
@@ -247,12 +250,10 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
                }
        }
 
-       if (rg->size != size || rg->type != mi->type) {
-               r = omapfb_realloc_fbmem(fbi, size, mi->type);
-               if (r) {
-                       dev_err(fbdev->dev, "realloc fbmem failed\n");
-                       goto out;
-               }
+       r = omapfb_realloc_fbmem(fbi, size, mi->type);
+       if (r) {
+               dev_err(fbdev->dev, "realloc fbmem failed\n");
+               goto out;
        }
 
  out: