Skip to contentSkip to conversation

OMAPDSS: OMAPFB: check for matching memory size early

PATCH In review Grazvydas Ignotas 2 participants 2 messages Mar 9, 2012 – Mar 21, 2012 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAPDSS: OMAPFB: check for matching memory size early

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.

---
I'm not sure if this is semantically correct, but this helps to get some old programs working, that rely on old DSS version which didn't check for mmap lock, but incidentally they are using same size too..

 drivers/video/omap2/omapfb/omapfb-ioctl.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
drivers/video/omap2/omapfb/omapfb-ioctl.c +7 -6
index df7bcce..a0ac95c 100644
@@ -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;
@@ -245,12 +248,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:
Signature · 1 line
1.7.0.4
#1 lore raw

Hi,

Quoted 8 lines · Grazvydas Ignotas

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.

---
I'm not sure if this is semantically correct, but this helps to get some old programs working, that rely on old DSS version which didn't check for mmap lock, but incidentally they are using same size too..

Well, I wouldn't allow code like that if it was a new ioctl, but if, as you say, the old omapfb worked that way, then I think it's better to do things the same way.

I can see no harm in it, so I'll apply.

Tomi