diff mbox

[26/32] dmaengine: s3c24xx: kill the tasklets upon exit

Message ID 1467730478-9696-27-git-send-email-vinod.koul@intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Vinod Koul July 5, 2016, 2:54 p.m. UTC
drivers should ensure that tasklets are killed, so that they can't be
executed after driver remove is executed, so ensure they are killed.

This driver used vchan tasklets, so those need to be killed.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 drivers/dma/s3c24xx-dma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Krzysztof Kozlowski July 6, 2016, 9:08 a.m. UTC | #1
On Tue, Jul 5, 2016 at 4:54 PM, Vinod Koul <vinod.koul@intel.com> wrote:
> drivers should ensure that tasklets are killed, so that they can't be
> executed after driver remove is executed, so ensure they are killed.
>
> This driver used vchan tasklets, so those need to be killed.
>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> Cc: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> ---
>  drivers/dma/s3c24xx-dma.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/s3c24xx-dma.c b/drivers/dma/s3c24xx-dma.c
> index 163d95f339e6..ce67075589f5 100644
> --- a/drivers/dma/s3c24xx-dma.c
> +++ b/drivers/dma/s3c24xx-dma.c
> @@ -1136,8 +1136,10 @@ static void s3c24xx_dma_free_virtual_channels(struct dma_device *dmadev)
>         struct s3c24xx_dma_chan *next;
>
>         list_for_each_entry_safe(chan,
> -                                next, &dmadev->channels, vc.chan.device_node)
> +                                next, &dmadev->channels, vc.chan.device_node) {
>                 list_del(&chan->vc.chan.device_node);
> +               tasklet_kill(&chan->vc.task);
> +       }
>  }

Looks correct:
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Unrelated to the patch: this looks obfuscated that driver uses
virt-dma helper for init but has to clean up on its own. Some helper
vchan_exit() or vchan_free() would be useful here.

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vinod Koul July 16, 2016, 1:01 p.m. UTC | #2
On Wed, Jul 06, 2016 at 11:08:20AM +0200, Krzysztof Kozlowski wrote:
> On Tue, Jul 5, 2016 at 4:54 PM, Vinod Koul <vinod.koul@intel.com> wrote:
> > drivers should ensure that tasklets are killed, so that they can't be
> > executed after driver remove is executed, so ensure they are killed.
> >
> > This driver used vchan tasklets, so those need to be killed.
> >
> > Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> > Cc: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> > ---
> >  drivers/dma/s3c24xx-dma.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/s3c24xx-dma.c b/drivers/dma/s3c24xx-dma.c
> > index 163d95f339e6..ce67075589f5 100644
> > --- a/drivers/dma/s3c24xx-dma.c
> > +++ b/drivers/dma/s3c24xx-dma.c
> > @@ -1136,8 +1136,10 @@ static void s3c24xx_dma_free_virtual_channels(struct dma_device *dmadev)
> >         struct s3c24xx_dma_chan *next;
> >
> >         list_for_each_entry_safe(chan,
> > -                                next, &dmadev->channels, vc.chan.device_node)
> > +                                next, &dmadev->channels, vc.chan.device_node) {
> >                 list_del(&chan->vc.chan.device_node);
> > +               tasklet_kill(&chan->vc.task);
> > +       }
> >  }
> 
> Looks correct:
> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Thanks,


> 
> Unrelated to the patch: this looks obfuscated that driver uses
> virt-dma helper for init but has to clean up on its own. Some helper
> vchan_exit() or vchan_free() would be useful here.

Yes that's next in my queue.. This became a bit bigger so wanted to finsih
this out before I start those. There are few more drivers that need it.
diff mbox

Patch

diff --git a/drivers/dma/s3c24xx-dma.c b/drivers/dma/s3c24xx-dma.c
index 163d95f339e6..ce67075589f5 100644
--- a/drivers/dma/s3c24xx-dma.c
+++ b/drivers/dma/s3c24xx-dma.c
@@ -1136,8 +1136,10 @@  static void s3c24xx_dma_free_virtual_channels(struct dma_device *dmadev)
 	struct s3c24xx_dma_chan *next;
 
 	list_for_each_entry_safe(chan,
-				 next, &dmadev->channels, vc.chan.device_node)
+				 next, &dmadev->channels, vc.chan.device_node) {
 		list_del(&chan->vc.chan.device_node);
+		tasklet_kill(&chan->vc.task);
+	}
 }
 
 /* s3c2410, s3c2440 and s3c2442 have a 0x40 stride without separate clocks */