diff options
author | Ville Syrjälä <ville.syrjala@nokia.com> | 2010-03-17 19:58:03 +0100 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-08-03 14:18:46 +0200 |
commit | 2f642a17503838e256b8b7e9f1153512e2efc38b (patch) | |
tree | cdf6fb1fb815543d7adb0ce78db87ddc68a822c7 /drivers/video/omap2/omapfb/omapfb.h | |
parent | OMAP: DSS2: OMAPFB: Add locking for memory regions (diff) | |
download | linux-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.h')
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h index db3aef5172c5..195a760eef54 100644 --- a/drivers/video/omap2/omapfb/omapfb.h +++ b/drivers/video/omap2/omapfb/omapfb.h @@ -27,6 +27,8 @@ #define DEBUG #endif +#include <linux/rwsem.h> + #include <plat/display.h> #ifdef DEBUG @@ -52,9 +54,8 @@ struct omapfb2_mem_region { 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 */ @@ -164,17 +165,13 @@ static inline int omapfb_overlay_enable(struct omap_overlay *ovl, 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 |