summaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/omapfb/omapfb-ioctl.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@nokia.com>2010-03-17 19:58:03 +0100
committerTomi Valkeinen <tomi.valkeinen@nokia.com>2010-08-03 14:18:46 +0200
commit2f642a17503838e256b8b7e9f1153512e2efc38b (patch)
treecdf6fb1fb815543d7adb0ce78db87ddc68a822c7 /drivers/video/omap2/omapfb/omapfb-ioctl.c
parentOMAP: DSS2: OMAPFB: Add locking for memory regions (diff)
downloadlinux-2f642a17503838e256b8b7e9f1153512e2efc38b.tar.xz
linux-2f642a17503838e256b8b7e9f1153512e2efc38b.zip
OMAP: DSS2: OMAPFB: Convert the memory region locking to rwsem
R/W semaphore is a good fit for the memory region locking pattern. So use it. Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video/omap2/omapfb/omapfb-ioctl.c')
-rw-r--r--drivers/video/omap2/omapfb/omapfb-ioctl.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c
index 69bcbfca47f6..3a10146dc120 100644
--- a/drivers/video/omap2/omapfb/omapfb-ioctl.c
+++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c
@@ -198,13 +198,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
rg = ofbi->region;
- /* FIXME probably should be a rwsem ... */
- mutex_lock(&rg->mtx);
- while (rg->ref) {
- mutex_unlock(&rg->mtx);
- schedule();
- mutex_lock(&rg->mtx);
- }
+ down_write(&rg->lock);
if (atomic_read(&rg->map_count)) {
r = -EBUSY;
@@ -235,7 +229,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
}
out:
- mutex_unlock(&rg->mtx);
+ up_write(&rg->lock);
return r;
}