diff options
author | Ville Syrjälä <ville.syrjala@nokia.com> | 2010-03-17 14:58:03 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-08-03 08:18:46 -0400 |
commit | 2f642a17503838e256b8b7e9f1153512e2efc38b (patch) | |
tree | cdf6fb1fb815543d7adb0ce78db87ddc68a822c7 /drivers/video/omap2/omapfb/omapfb.h | |
parent | 430571d59a0b51c6541c153ad8b08e72fef26098 (diff) |
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 @@ | |||
27 | #define DEBUG | 27 | #define DEBUG |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #include <linux/rwsem.h> | ||
31 | |||
30 | #include <plat/display.h> | 32 | #include <plat/display.h> |
31 | 33 | ||
32 | #ifdef DEBUG | 34 | #ifdef DEBUG |
@@ -52,9 +54,8 @@ struct omapfb2_mem_region { | |||
52 | u8 type; /* OMAPFB_PLANE_MEM_* */ | 54 | u8 type; /* OMAPFB_PLANE_MEM_* */ |
53 | bool alloc; /* allocated by the driver */ | 55 | bool alloc; /* allocated by the driver */ |
54 | bool map; /* kernel mapped by the driver */ | 56 | bool map; /* kernel mapped by the driver */ |
55 | struct mutex mtx; | ||
56 | unsigned int ref; | ||
57 | atomic_t map_count; | 57 | atomic_t map_count; |
58 | struct rw_semaphore lock; | ||
58 | }; | 59 | }; |
59 | 60 | ||
60 | /* appended to fb_info */ | 61 | /* appended to fb_info */ |
@@ -164,17 +165,13 @@ static inline int omapfb_overlay_enable(struct omap_overlay *ovl, | |||
164 | static inline struct omapfb2_mem_region * | 165 | static inline struct omapfb2_mem_region * |
165 | omapfb_get_mem_region(struct omapfb2_mem_region *rg) | 166 | omapfb_get_mem_region(struct omapfb2_mem_region *rg) |
166 | { | 167 | { |
167 | mutex_lock(&rg->mtx); | 168 | down_read(&rg->lock); |
168 | rg->ref++; | ||
169 | mutex_unlock(&rg->mtx); | ||
170 | return rg; | 169 | return rg; |
171 | } | 170 | } |
172 | 171 | ||
173 | static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg) | 172 | static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg) |
174 | { | 173 | { |
175 | mutex_lock(&rg->mtx); | 174 | up_read(&rg->lock); |
176 | rg->ref--; | ||
177 | mutex_unlock(&rg->mtx); | ||
178 | } | 175 | } |
179 | 176 | ||
180 | #endif | 177 | #endif |