diff options
author | Ville Syrjälä <ville.syrjala@nokia.com> | 2010-03-17 15:28:50 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-08-03 08:18:46 -0400 |
commit | 1ceafc00910439c8e5450fae189b69427725992c (patch) | |
tree | 5b98fb03b1885dc64b335965bd73686b818e368c /drivers/video/omap2/omapfb | |
parent | 3d84b65aa63833a2ac07b1cc626984a1e1485fed (diff) |
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>
Diffstat (limited to 'drivers/video/omap2/omapfb')
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-ioctl.c | 2 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 6 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-sysfs.c | 2 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb.h | 3 |
4 files changed, 13 insertions, 0 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c index 7975a99c33f9..d1f56d37405f 100644 --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c | |||
@@ -222,6 +222,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi) | |||
222 | rg = ofbi->region; | 222 | rg = ofbi->region; |
223 | 223 | ||
224 | down_write_nested(&rg->lock, rg->id); | 224 | down_write_nested(&rg->lock, rg->id); |
225 | atomic_inc(&rg->lock_count); | ||
225 | 226 | ||
226 | if (atomic_read(&rg->map_count)) { | 227 | if (atomic_read(&rg->map_count)) { |
227 | r = -EBUSY; | 228 | r = -EBUSY; |
@@ -252,6 +253,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi) | |||
252 | } | 253 | } |
253 | 254 | ||
254 | out: | 255 | out: |
256 | atomic_dec(&rg->lock_count); | ||
255 | up_write(&rg->lock); | 257 | up_write(&rg->lock); |
256 | 258 | ||
257 | return r; | 259 | return r; |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index a3f72ba79958..a545e8d4817f 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -668,6 +668,8 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var) | |||
668 | 668 | ||
669 | DBG("check_fb_var %d\n", ofbi->id); | 669 | DBG("check_fb_var %d\n", ofbi->id); |
670 | 670 | ||
671 | WARN_ON(!atomic_read(&ofbi->region->lock_count)); | ||
672 | |||
671 | r = fb_mode_to_dss_mode(var, &mode); | 673 | r = fb_mode_to_dss_mode(var, &mode); |
672 | if (r) { | 674 | if (r) { |
673 | DBG("cannot convert var to omap dss mode\n"); | 675 | 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, | |||
873 | int rotation = var->rotate; | 875 | int rotation = var->rotate; |
874 | int i; | 876 | int i; |
875 | 877 | ||
878 | WARN_ON(!atomic_read(&ofbi->region->lock_count)); | ||
879 | |||
876 | for (i = 0; i < ofbi->num_overlays; i++) { | 880 | for (i = 0; i < ofbi->num_overlays; i++) { |
877 | if (ovl != ofbi->overlays[i]) | 881 | if (ovl != ofbi->overlays[i]) |
878 | continue; | 882 | continue; |
@@ -966,6 +970,8 @@ int omapfb_apply_changes(struct fb_info *fbi, int init) | |||
966 | fill_fb(fbi); | 970 | fill_fb(fbi); |
967 | #endif | 971 | #endif |
968 | 972 | ||
973 | WARN_ON(!atomic_read(&ofbi->region->lock_count)); | ||
974 | |||
969 | for (i = 0; i < ofbi->num_overlays; i++) { | 975 | for (i = 0; i < ofbi->num_overlays; i++) { |
970 | ovl = ofbi->overlays[i]; | 976 | ovl = ofbi->overlays[i]; |
971 | 977 | ||
diff --git a/drivers/video/omap2/omapfb/omapfb-sysfs.c b/drivers/video/omap2/omapfb/omapfb-sysfs.c index 1e714bb48d39..51c13c366bf3 100644 --- a/drivers/video/omap2/omapfb/omapfb-sysfs.c +++ b/drivers/video/omap2/omapfb/omapfb-sysfs.c | |||
@@ -453,6 +453,7 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr, | |||
453 | rg = ofbi->region; | 453 | rg = ofbi->region; |
454 | 454 | ||
455 | down_write_nested(&rg->lock, rg->id); | 455 | down_write_nested(&rg->lock, rg->id); |
456 | atomic_inc(&rg->lock_count); | ||
456 | 457 | ||
457 | if (atomic_read(&rg->map_count)) { | 458 | if (atomic_read(&rg->map_count)) { |
458 | r = -EBUSY; | 459 | r = -EBUSY; |
@@ -484,6 +485,7 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr, | |||
484 | 485 | ||
485 | r = count; | 486 | r = count; |
486 | out: | 487 | out: |
488 | atomic_dec(&rg->lock_count); | ||
487 | up_write(&rg->lock); | 489 | up_write(&rg->lock); |
488 | 490 | ||
489 | unlock_fb_info(fbi); | 491 | unlock_fb_info(fbi); |
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h index 676b55d98941..1305fc9880ba 100644 --- a/drivers/video/omap2/omapfb/omapfb.h +++ b/drivers/video/omap2/omapfb/omapfb.h | |||
@@ -56,6 +56,7 @@ struct omapfb2_mem_region { | |||
56 | bool map; /* kernel mapped by the driver */ | 56 | bool map; /* kernel mapped by the driver */ |
57 | atomic_t map_count; | 57 | atomic_t map_count; |
58 | struct rw_semaphore lock; | 58 | struct rw_semaphore lock; |
59 | atomic_t lock_count; | ||
59 | }; | 60 | }; |
60 | 61 | ||
61 | /* appended to fb_info */ | 62 | /* appended to fb_info */ |
@@ -166,11 +167,13 @@ static inline struct omapfb2_mem_region * | |||
166 | omapfb_get_mem_region(struct omapfb2_mem_region *rg) | 167 | omapfb_get_mem_region(struct omapfb2_mem_region *rg) |
167 | { | 168 | { |
168 | down_read_nested(&rg->lock, rg->id); | 169 | down_read_nested(&rg->lock, rg->id); |
170 | atomic_inc(&rg->lock_count); | ||
169 | return rg; | 171 | return rg; |
170 | } | 172 | } |
171 | 173 | ||
172 | static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg) | 174 | static inline void omapfb_put_mem_region(struct omapfb2_mem_region *rg) |
173 | { | 175 | { |
176 | atomic_dec(&rg->lock_count); | ||
174 | up_read(&rg->lock); | 177 | up_read(&rg->lock); |
175 | } | 178 | } |
176 | 179 | ||