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>
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c
index 69bcbfc..3a10146 100644
--- a/drivers/video/omap2/omapfb/omapfb-ioctl.c
+++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c
@@ -198,13 +198,7 @@
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 @@
}
out:
- mutex_unlock(&rg->mtx);
+ up_write(&rg->lock);
return r;
}