aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/omapfb/omapfb.h
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@nokia.com>2010-03-17 14:43:23 -0400
committerTomi Valkeinen <tomi.valkeinen@nokia.com>2010-08-03 08:18:46 -0400
commit430571d59a0b51c6541c153ad8b08e72fef26098 (patch)
tree8ad99c778576b985f5fbe6de57d1ea4dea0981c3 /drivers/video/omap2/omapfb/omapfb.h
parent078ff546a806b2c2ab74c25c8edd4c6d4680656a (diff)
OMAP: DSS2: OMAPFB: Add locking for memory regions
Add locking to the memory regions to make sure the memory region size won't be changed while some other piece of code is performing some checks or setup based on that information. 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.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h
index 02f1ba9b228c..db3aef5172c5 100644
--- a/drivers/video/omap2/omapfb/omapfb.h
+++ b/drivers/video/omap2/omapfb/omapfb.h
@@ -52,6 +52,8 @@ struct omapfb2_mem_region {
52 u8 type; /* OMAPFB_PLANE_MEM_* */ 52 u8 type; /* OMAPFB_PLANE_MEM_* */
53 bool alloc; /* allocated by the driver */ 53 bool alloc; /* allocated by the driver */
54 bool map; /* kernel mapped by the driver */ 54 bool map; /* kernel mapped by the driver */
55 struct mutex mtx;
56 unsigned int ref;
55 atomic_t map_count; 57 atomic_t map_count;
56}; 58};
57 59
@@ -159,4 +161,20 @@ static inline int omapfb_overlay_enable(struct omap_overlay *ovl,
159 return ovl->set_overlay_info(ovl, &info); 161 return ovl->set_overlay_info(ovl, &info);
160} 162}
161 163
164static inline struct omapfb2_mem_region *
165omapfb_get_mem_region(struct omapfb2_mem_region *rg)
166{
167 mutex_lock(&rg->mtx);
168 rg->ref++;
169 mutex_unlock(&rg->mtx);
170 return rg;
171}
172
173static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg)
174{
175 mutex_lock(&rg->mtx);
176 rg->ref--;
177 mutex_unlock(&rg->mtx);
178}
179
162#endif 180#endif