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>
This commit is contained in:

committed by
Tomi Valkeinen

parent
430571d59a
commit
2f642a1750
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user