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;
}
out:
- mutex_unlock(&rg->mtx);
+ up_write(&rg->lock);
return r;
}
ofbi->region = &fbdev->regions[i];
ofbi->region->id = i;
- mutex_init(&ofbi->region->mtx);
+ init_rwsem(&ofbi->region->lock);
/* assign these early, so that fb alloc can use them */
ofbi->rotation_type = def_vrfb ? OMAP_DSS_ROT_VRFB :
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;
r = count;
out:
- mutex_unlock(&rg->mtx);
+ up_write(&rg->lock);
unlock_fb_info(fbi);
#define DEBUG
#endif
+#include <linux/rwsem.h>
+
#include <plat/display.h>
#ifdef DEBUG
u8 type; /* OMAPFB_PLANE_MEM_* */
bool alloc; /* allocated by the driver */
bool map; /* kernel mapped by the driver */
- struct mutex mtx;
- unsigned int ref;
atomic_t map_count;
+ struct rw_semaphore lock;
};
/* appended to fb_info */
static inline struct omapfb2_mem_region *
omapfb_get_mem_region(struct omapfb2_mem_region *rg)
{
- mutex_lock(&rg->mtx);
- rg->ref++;
- mutex_unlock(&rg->mtx);
+ down_read(&rg->lock);
return rg;
}
static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg)
{
- mutex_lock(&rg->mtx);
- rg->ref--;
- mutex_unlock(&rg->mtx);
+ up_read(&rg->lock);
}
#endif