diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-11-15 05:04:10 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-12-02 01:54:38 -0500 |
commit | 063fd701abba3b58c36b6043d5feacf0fdc76cbd (patch) | |
tree | 2f229d8e35f086da7d87c0e406fb47ce945e931b | |
parent | af3d64b2c674bc6246bb04654b484f34287fbbc3 (diff) |
OMAPDSS: APPLY: move spinlock outside the struct
dss_cache struct contains a spinlock used to protect the struct. A more
logical place for the spinlock is outside the struct that it is
protecting. So move it there.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/omap2/dss/apply.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index 9c035e272e19..a2c6c50430ee 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c | |||
@@ -89,13 +89,15 @@ struct mgr_priv_data { | |||
89 | }; | 89 | }; |
90 | 90 | ||
91 | static struct { | 91 | static struct { |
92 | spinlock_t lock; | ||
93 | struct ovl_priv_data ovl_priv_data_array[MAX_DSS_OVERLAYS]; | 92 | struct ovl_priv_data ovl_priv_data_array[MAX_DSS_OVERLAYS]; |
94 | struct mgr_priv_data mgr_priv_data_array[MAX_DSS_MANAGERS]; | 93 | struct mgr_priv_data mgr_priv_data_array[MAX_DSS_MANAGERS]; |
95 | 94 | ||
96 | bool irq_enabled; | 95 | bool irq_enabled; |
97 | } dss_cache; | 96 | } dss_cache; |
98 | 97 | ||
98 | /* protects dss_cache */ | ||
99 | static spinlock_t data_lock; | ||
100 | |||
99 | static struct ovl_priv_data *get_ovl_priv(struct omap_overlay *ovl) | 101 | static struct ovl_priv_data *get_ovl_priv(struct omap_overlay *ovl) |
100 | { | 102 | { |
101 | return &dss_cache.ovl_priv_data_array[ovl->id]; | 103 | return &dss_cache.ovl_priv_data_array[ovl->id]; |
@@ -108,7 +110,7 @@ static struct mgr_priv_data *get_mgr_priv(struct omap_overlay_manager *mgr) | |||
108 | 110 | ||
109 | void dss_apply_init(void) | 111 | void dss_apply_init(void) |
110 | { | 112 | { |
111 | spin_lock_init(&dss_cache.lock); | 113 | spin_lock_init(&data_lock); |
112 | } | 114 | } |
113 | 115 | ||
114 | static bool ovl_manual_update(struct omap_overlay *ovl) | 116 | static bool ovl_manual_update(struct omap_overlay *ovl) |
@@ -149,10 +151,10 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr) | |||
149 | unsigned long flags; | 151 | unsigned long flags; |
150 | bool shadow_dirty, dirty; | 152 | bool shadow_dirty, dirty; |
151 | 153 | ||
152 | spin_lock_irqsave(&dss_cache.lock, flags); | 154 | spin_lock_irqsave(&data_lock, flags); |
153 | dirty = mp->dirty; | 155 | dirty = mp->dirty; |
154 | shadow_dirty = mp->shadow_dirty; | 156 | shadow_dirty = mp->shadow_dirty; |
155 | spin_unlock_irqrestore(&dss_cache.lock, flags); | 157 | spin_unlock_irqrestore(&data_lock, flags); |
156 | 158 | ||
157 | if (!dirty && !shadow_dirty) { | 159 | if (!dirty && !shadow_dirty) { |
158 | r = 0; | 160 | r = 0; |
@@ -212,10 +214,10 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl) | |||
212 | unsigned long flags; | 214 | unsigned long flags; |
213 | bool shadow_dirty, dirty; | 215 | bool shadow_dirty, dirty; |
214 | 216 | ||
215 | spin_lock_irqsave(&dss_cache.lock, flags); | 217 | spin_lock_irqsave(&data_lock, flags); |
216 | dirty = op->dirty; | 218 | dirty = op->dirty; |
217 | shadow_dirty = op->shadow_dirty; | 219 | shadow_dirty = op->shadow_dirty; |
218 | spin_unlock_irqrestore(&dss_cache.lock, flags); | 220 | spin_unlock_irqrestore(&data_lock, flags); |
219 | 221 | ||
220 | if (!dirty && !shadow_dirty) { | 222 | if (!dirty && !shadow_dirty) { |
221 | r = 0; | 223 | r = 0; |
@@ -464,7 +466,7 @@ static void dss_apply_irq_handler(void *data, u32 mask) | |||
464 | for (i = 0; i < num_mgrs; i++) | 466 | for (i = 0; i < num_mgrs; i++) |
465 | mgr_busy[i] = dispc_mgr_go_busy(i); | 467 | mgr_busy[i] = dispc_mgr_go_busy(i); |
466 | 468 | ||
467 | spin_lock(&dss_cache.lock); | 469 | spin_lock(&data_lock); |
468 | 470 | ||
469 | for (i = 0; i < num_ovls; ++i) { | 471 | for (i = 0; i < num_ovls; ++i) { |
470 | ovl = omap_dss_get_overlay(i); | 472 | ovl = omap_dss_get_overlay(i); |
@@ -498,7 +500,7 @@ static void dss_apply_irq_handler(void *data, u32 mask) | |||
498 | dss_unregister_vsync_isr(); | 500 | dss_unregister_vsync_isr(); |
499 | 501 | ||
500 | end: | 502 | end: |
501 | spin_unlock(&dss_cache.lock); | 503 | spin_unlock(&data_lock); |
502 | } | 504 | } |
503 | 505 | ||
504 | static int omap_dss_mgr_apply_ovl(struct omap_overlay *ovl) | 506 | static int omap_dss_mgr_apply_ovl(struct omap_overlay *ovl) |
@@ -620,7 +622,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) | |||
620 | if (r) | 622 | if (r) |
621 | return r; | 623 | return r; |
622 | 624 | ||
623 | spin_lock_irqsave(&dss_cache.lock, flags); | 625 | spin_lock_irqsave(&data_lock, flags); |
624 | 626 | ||
625 | /* Configure overlays */ | 627 | /* Configure overlays */ |
626 | list_for_each_entry(ovl, &mgr->overlays, list) | 628 | list_for_each_entry(ovl, &mgr->overlays, list) |
@@ -641,7 +643,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) | |||
641 | dss_write_regs(); | 643 | dss_write_regs(); |
642 | } | 644 | } |
643 | 645 | ||
644 | spin_unlock_irqrestore(&dss_cache.lock, flags); | 646 | spin_unlock_irqrestore(&data_lock, flags); |
645 | 647 | ||
646 | dispc_runtime_put(); | 648 | dispc_runtime_put(); |
647 | 649 | ||