diff options
author | Ville Syrjälä <ville.syrjala@nokia.com> | 2010-03-17 19:43:23 +0100 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-08-03 14:18:46 +0200 |
commit | 430571d59a0b51c6541c153ad8b08e72fef26098 (patch) | |
tree | 8ad99c778576b985f5fbe6de57d1ea4dea0981c3 /drivers/video/omap2/omapfb/omapfb.h | |
parent | OMAP: DSS2: OMAPFB: Add support for switching memory regions (diff) | |
download | linux-430571d59a0b51c6541c153ad8b08e72fef26098.tar.xz linux-430571d59a0b51c6541c153ad8b08e72fef26098.zip |
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.h | 18 |
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 { 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; }; @@ -159,4 +161,20 @@ static inline int omapfb_overlay_enable(struct omap_overlay *ovl, return ovl->set_overlay_info(ovl, &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); + return rg; +} + +static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg) +{ + mutex_lock(&rg->mtx); + rg->ref--; + mutex_unlock(&rg->mtx); +} + #endif |