linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] omap: dmtimers: Fix locking issue in omap_dm_timer_request*()
@ 2012-08-12 10:45 Timo Kokkonen
  2012-08-13 13:24 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Timo Kokkonen @ 2012-08-12 10:45 UTC (permalink / raw)
  To: linux-omap; +Cc: Timo Kokkonen, Tony Lindgren, Tarun Kanti DebBarma

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: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Tarun Kanti DebBarma <tarun.kanti@ti.com>
---
 arch/arm/plat-omap/dmtimer.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 626ad8c..1f66cac 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -189,6 +189,7 @@ struct omap_dm_timer *omap_dm_timer_request(void)
 		timer->reserved = 1;
 		break;
 	}
+	spin_unlock_irqrestore(&dm_timer_lock, flags);
 
 	if (timer) {
 		ret = omap_dm_timer_prepare(timer);
@@ -197,7 +198,6 @@ struct omap_dm_timer *omap_dm_timer_request(void)
 			timer = NULL;
 		}
 	}
-	spin_unlock_irqrestore(&dm_timer_lock, flags);
 
 	if (!timer)
 		pr_debug("%s: timer request failed!\n", __func__);
@@ -220,6 +220,7 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
 			break;
 		}
 	}
+	spin_unlock_irqrestore(&dm_timer_lock, flags);
 
 	if (timer) {
 		ret = omap_dm_timer_prepare(timer);
@@ -228,7 +229,6 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)
 			timer = NULL;
 		}
 	}
-	spin_unlock_irqrestore(&dm_timer_lock, flags);
 
 	if (!timer)
 		pr_debug("%s: timer%d request failed!\n", __func__, id);
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] omap: dmtimers: Fix locking issue in omap_dm_timer_request*()
  2012-08-12 10:45 [PATCH 1/1] omap: dmtimers: Fix locking issue in omap_dm_timer_request*() Timo Kokkonen
@ 2012-08-13 13:24 ` Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2012-08-13 13:24 UTC (permalink / raw)
  To: Timo Kokkonen; +Cc: linux-omap, Tarun Kanti DebBarma

* Timo Kokkonen <timo.t.kokkonen@iki.fi> [120812 03:46]:
> 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.

Thanks applying into fixes.

Tony

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-13 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-12 10:45 [PATCH 1/1] omap: dmtimers: Fix locking issue in omap_dm_timer_request*() Timo Kokkonen
2012-08-13 13:24 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).