Commit c5491d1a authored by Timo Kokkonen's avatar Timo Kokkonen Committed by Tony Lindgren

ARM: OMAP: dmtimers: Fix locking issue in omap_dm_timer_request*()

Calling omap_dm_timer_prepare while the spinlock is held is not
allowed as sleeping functions are called later on during the
preparation (namely within clk_get()).

dm_timer_lock is only required for protecting the
omap_timer_list. After the timer is marked as reserved, the lock is no
longer needed and should be freed.
Signed-off-by: default avatarTimo Kokkonen <timo.t.kokkonen@iki.fi>
Cc: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent cf835e8d
...@@ -189,6 +189,7 @@ struct omap_dm_timer *omap_dm_timer_request(void) ...@@ -189,6 +189,7 @@ struct omap_dm_timer *omap_dm_timer_request(void)
timer->reserved = 1; timer->reserved = 1;
break; break;
} }
spin_unlock_irqrestore(&dm_timer_lock, flags);
if (timer) { if (timer) {
ret = omap_dm_timer_prepare(timer); ret = omap_dm_timer_prepare(timer);
...@@ -197,7 +198,6 @@ struct omap_dm_timer *omap_dm_timer_request(void) ...@@ -197,7 +198,6 @@ struct omap_dm_timer *omap_dm_timer_request(void)
timer = NULL; timer = NULL;
} }
} }
spin_unlock_irqrestore(&dm_timer_lock, flags);
if (!timer) if (!timer)
pr_debug("%s: timer request failed!\n", __func__); pr_debug("%s: timer request failed!\n", __func__);
...@@ -220,6 +220,7 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id) ...@@ -220,6 +220,7 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
break; break;
} }
} }
spin_unlock_irqrestore(&dm_timer_lock, flags);
if (timer) { if (timer) {
ret = omap_dm_timer_prepare(timer); ret = omap_dm_timer_prepare(timer);
...@@ -228,7 +229,6 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id) ...@@ -228,7 +229,6 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
timer = NULL; timer = NULL;
} }
} }
spin_unlock_irqrestore(&dm_timer_lock, flags);
if (!timer) if (!timer)
pr_debug("%s: timer%d request failed!\n", __func__, id); pr_debug("%s: timer%d request failed!\n", __func__, id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment