Re: question about drivers/dma/dma-jz4780.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 20, 2015 at 10:28:14AM +0200, Julia Lawall wrote:
> On Mon, 20 Jul 2015, Alex Smith wrote:
> 
> > On 19/07/2015 10:08, Julia Lawall wrote:
> > > The file drivers/dma/dma-jz4780.c has a probe function that sets up irqs
> > > using devm_request_irq.  The probe function then ends with:
> > >
> > > err_unregister_dev:
> > > 	dma_async_device_unregister(dd);
> > >
> > > err_disable_clk:
> > >          clk_disable_unprepare(jzdma->clk);
> > > 	return ret;
> > > }
> > >
> > > The remove function, on the other hand contains:
> > >
> > >          of_dma_controller_free(pdev->dev.of_node);
> > >          devm_free_irq(&pdev->dev, jzdma->irq, jzdma);
> > >          dma_async_device_unregister(&jzdma->dma_device);
> > >
> > > The need for calling devm_free_irq explicitly would be that it needs to
> > > occur before dma_async_device_unregister, to eg avoid a reference to a
> > > dangling pointer.  But devm_free_irq is implicitly called after the call
> > > to dma_async_device_unregister at the end of the probe function.  Which
> > > one is correct?
Not just users but from a device management you are ensuring that your
device is not able to send any more interrupts and also your tasklet is not
spawned further. For this it is neccessary that devm_irq_free be called
explcitly by devices
> > >
> > > julia
> >
> > Hi,
> >
> > I think the explicit devm_free_irq() here is unnecessary, as when remove is
> > called there should be no remaining users of the DMA controller and therefore
> > no chance of an IRQ occurring between the controller being unregistered and an
> > implicit IRQ release afterwards.
Are you ensuring that device can no longer sent interrupts and all instances
of tasklet running or either completed are terminated and no further tasklet
can be spawned?

-- 
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux