OMAP: DSS2: OMAPFB: Add some locking debug checks
Trigger WARN_ON() messages from various places in the code in case the memory region is not currently locked. Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
This commit is contained in:

committed by
Tomi Valkeinen

parent
3d84b65aa6
commit
1ceafc0091
@@ -222,6 +222,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
|
|||||||
rg = ofbi->region;
|
rg = ofbi->region;
|
||||||
|
|
||||||
down_write_nested(&rg->lock, rg->id);
|
down_write_nested(&rg->lock, rg->id);
|
||||||
|
atomic_inc(&rg->lock_count);
|
||||||
|
|
||||||
if (atomic_read(&rg->map_count)) {
|
if (atomic_read(&rg->map_count)) {
|
||||||
r = -EBUSY;
|
r = -EBUSY;
|
||||||
@@ -252,6 +253,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
atomic_dec(&rg->lock_count);
|
||||||
up_write(&rg->lock);
|
up_write(&rg->lock);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@@ -668,6 +668,8 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
|
|||||||
|
|
||||||
DBG("check_fb_var %d\n", ofbi->id);
|
DBG("check_fb_var %d\n", ofbi->id);
|
||||||
|
|
||||||
|
WARN_ON(!atomic_read(&ofbi->region->lock_count));
|
||||||
|
|
||||||
r = fb_mode_to_dss_mode(var, &mode);
|
r = fb_mode_to_dss_mode(var, &mode);
|
||||||
if (r) {
|
if (r) {
|
||||||
DBG("cannot convert var to omap dss mode\n");
|
DBG("cannot convert var to omap dss mode\n");
|
||||||
@@ -873,6 +875,8 @@ int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
|
|||||||
int rotation = var->rotate;
|
int rotation = var->rotate;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
WARN_ON(!atomic_read(&ofbi->region->lock_count));
|
||||||
|
|
||||||
for (i = 0; i < ofbi->num_overlays; i++) {
|
for (i = 0; i < ofbi->num_overlays; i++) {
|
||||||
if (ovl != ofbi->overlays[i])
|
if (ovl != ofbi->overlays[i])
|
||||||
continue;
|
continue;
|
||||||
@@ -966,6 +970,8 @@ int omapfb_apply_changes(struct fb_info *fbi, int init)
|
|||||||
fill_fb(fbi);
|
fill_fb(fbi);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
WARN_ON(!atomic_read(&ofbi->region->lock_count));
|
||||||
|
|
||||||
for (i = 0; i < ofbi->num_overlays; i++) {
|
for (i = 0; i < ofbi->num_overlays; i++) {
|
||||||
ovl = ofbi->overlays[i];
|
ovl = ofbi->overlays[i];
|
||||||
|
|
||||||
|
@@ -453,6 +453,7 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr,
|
|||||||
rg = ofbi->region;
|
rg = ofbi->region;
|
||||||
|
|
||||||
down_write_nested(&rg->lock, rg->id);
|
down_write_nested(&rg->lock, rg->id);
|
||||||
|
atomic_inc(&rg->lock_count);
|
||||||
|
|
||||||
if (atomic_read(&rg->map_count)) {
|
if (atomic_read(&rg->map_count)) {
|
||||||
r = -EBUSY;
|
r = -EBUSY;
|
||||||
@@ -484,6 +485,7 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr,
|
|||||||
|
|
||||||
r = count;
|
r = count;
|
||||||
out:
|
out:
|
||||||
|
atomic_dec(&rg->lock_count);
|
||||||
up_write(&rg->lock);
|
up_write(&rg->lock);
|
||||||
|
|
||||||
unlock_fb_info(fbi);
|
unlock_fb_info(fbi);
|
||||||
|
@@ -56,6 +56,7 @@ struct omapfb2_mem_region {
|
|||||||
bool map; /* kernel mapped by the driver */
|
bool map; /* kernel mapped by the driver */
|
||||||
atomic_t map_count;
|
atomic_t map_count;
|
||||||
struct rw_semaphore lock;
|
struct rw_semaphore lock;
|
||||||
|
atomic_t lock_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* appended to fb_info */
|
/* appended to fb_info */
|
||||||
@@ -166,11 +167,13 @@ static inline struct omapfb2_mem_region *
|
|||||||
omapfb_get_mem_region(struct omapfb2_mem_region *rg)
|
omapfb_get_mem_region(struct omapfb2_mem_region *rg)
|
||||||
{
|
{
|
||||||
down_read_nested(&rg->lock, rg->id);
|
down_read_nested(&rg->lock, rg->id);
|
||||||
|
atomic_inc(&rg->lock_count);
|
||||||
return rg;
|
return rg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg)
|
static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg)
|
||||||
{
|
{
|
||||||
|
atomic_dec(&rg->lock_count);
|
||||||
up_read(&rg->lock);
|
up_read(&rg->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user