linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma: shdma: don't register the global die notifier multiple
@ 2011-01-06 17:04 Guennadi Liakhovetski
  2011-01-07  1:59 ` [PATCH] dma: shdma: don't register the global die notifier multiple times Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Guennadi Liakhovetski @ 2011-01-06 17:04 UTC (permalink / raw)
  To: linux-sh; +Cc: Paul Mundt, Magnus Damm, Dan Williams, linux-kernel

A recent patch has added a die notifier to the shdma driver, however, 
it registers a static die-notifier object in the probe routine, i.e., 
for each device instance. This is wrong and leads to a system lockup. 
This patch moves the die notifier registration to module init and 
exit routines respectively.

Reported-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---

This fixes the lock up on sh7372. Patch against current sh-2.6/master.

 drivers/dma/shdma.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index a0069c1..28720d3 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -1110,11 +1110,6 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
 	list_add_tail_rcu(&shdev->node, &sh_dmae_devices);
 	spin_unlock_irqrestore(&sh_dmae_lock, flags);
 
-	/* Wire up NMI handling before bringing the controller online */
-	err = register_die_notifier(&sh_dmae_nmi_notifier);
-	if (err)
-		goto notifier_err;
-
 	/* reset dma controller */
 	err = sh_dmae_rst(shdev);
 	if (err)
@@ -1218,8 +1213,6 @@ eirqres:
 eirq_err:
 #endif
 rst_err:
-	unregister_die_notifier(&sh_dmae_nmi_notifier);
-notifier_err:
 	spin_lock_irqsave(&sh_dmae_lock, flags);
 	list_del_rcu(&shdev->node);
 	spin_unlock_irqrestore(&sh_dmae_lock, flags);
@@ -1252,8 +1245,6 @@ static int __exit sh_dmae_remove(struct platform_device *pdev)
 	if (errirq > 0)
 		free_irq(errirq, shdev);
 
-	unregister_die_notifier(&sh_dmae_nmi_notifier);
-
 	spin_lock_irqsave(&sh_dmae_lock, flags);
 	list_del_rcu(&shdev->node);
 	spin_unlock_irqrestore(&sh_dmae_lock, flags);
@@ -1296,6 +1287,11 @@ static struct platform_driver sh_dmae_driver = {
 
 static int __init sh_dmae_init(void)
 {
+	/* Wire up NMI handling */
+	int err = register_die_notifier(&sh_dmae_nmi_notifier);
+	if (err)
+		return err;
+
 	return platform_driver_probe(&sh_dmae_driver, sh_dmae_probe);
 }
 module_init(sh_dmae_init);
@@ -1303,6 +1299,8 @@ module_init(sh_dmae_init);
 static void __exit sh_dmae_exit(void)
 {
 	platform_driver_unregister(&sh_dmae_driver);
+
+	unregister_die_notifier(&sh_dmae_nmi_notifier);
 }
 module_exit(sh_dmae_exit);
 
-- 
1.7.2.3


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

* Re: [PATCH] dma: shdma: don't register the global die notifier multiple times
  2011-01-06 17:04 [PATCH] dma: shdma: don't register the global die notifier multiple Guennadi Liakhovetski
@ 2011-01-07  1:59 ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2011-01-07  1:59 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-sh, Magnus Damm, Dan Williams, linux-kernel

On Thu, Jan 06, 2011 at 06:04:50PM +0100, Guennadi Liakhovetski wrote:
> A recent patch has added a die notifier to the shdma driver, however, 
> it registers a static die-notifier object in the probe routine, i.e., 
> for each device instance. This is wrong and leads to a system lockup. 
> This patch moves the die notifier registration to module init and 
> exit routines respectively.
> 
> Reported-by: Magnus Damm <damm@opensource.se>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> 
> This fixes the lock up on sh7372. Patch against current sh-2.6/master.
> 
Whoops, I suppose I should have tested on a platform with more than one
DMAC :-)

I'll piggyback this on top of the rmobile-latest branch, thanks.

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

end of thread, other threads:[~2011-01-07  1:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06 17:04 [PATCH] dma: shdma: don't register the global die notifier multiple Guennadi Liakhovetski
2011-01-07  1:59 ` [PATCH] dma: shdma: don't register the global die notifier multiple times Paul Mundt

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).