From 7a5c106a0e8fd03a806d0da77eef10b4045c43a6 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 21 May 2010 15:28:51 +0000 Subject: sh: prevent the DMA driver from unloading, while in use This prevents the driver from unloading, while it is in use. Unloading of the driver, while its DMA channels are held, leads to a kernel Oops. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Paul Mundt --- drivers/dma/shdma.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/dma/shdma.c') diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index a172752..427d514 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c @@ -1188,6 +1188,7 @@ static struct platform_driver sh_dmae_driver = { .remove = __exit_p(sh_dmae_remove), .shutdown = sh_dmae_shutdown, .driver = { + .owner = THIS_MODULE, .name = "sh-dma-engine", }, }; -- cgit v1.1 From 9255f1deec151ac0e84871d06bc27406cb81f26f Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 21 May 2010 15:30:12 +0000 Subject: sh: guard cookie consistency across termination in the DMA driver If all descriptors on a channel are terminated or the channel is released, update the completed cookie counter to match the last cookie. This prevents inconsistency warning on resumed DMA operation. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Paul Mundt --- drivers/dma/shdma.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/dma/shdma.c') diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 427d514..a2a519f 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c @@ -722,6 +722,10 @@ static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all) { while (__ld_cleanup(sh_chan, all)) ; + + if (all) + /* Terminating - forgive uncompleted cookies */ + sh_chan->completed_cookie = sh_chan->common.cookie; } static void sh_chan_xfer_ld_queue(struct sh_dmae_chan *sh_chan) -- cgit v1.1