Re: [PATCH 13/16] staging: comedi: cb_pcidas64: use comedi_pci_detach()

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

 



On 2014-08-04 23:55, H Hartley Sweeten wrote:
Use comedi_pci_detach() to handle the boilerplate part of the (*detach)
for this PCI driver.

This also fixes a race condition where the interrupt handler is released
before the interrupts are disabled in the hardware.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
  drivers/staging/comedi/drivers/cb_pcidas64.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index cc492ee..f9bbd7d 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -4038,8 +4038,6 @@ static void detach(struct comedi_device *dev)
  {
  	struct pcidas64_private *devpriv = dev->private;

-	if (dev->irq)
-		free_irq(dev->irq, dev);
  	if (devpriv) {
  		if (devpriv->plx9080_iobase) {
  			disable_plx_interrupts(dev);
@@ -4047,10 +4045,8 @@ static void detach(struct comedi_device *dev)
  		}
  		if (devpriv->main_iobase)
  			iounmap(devpriv->main_iobase);
-		if (dev->mmio)
-			iounmap(dev->mmio);
  	}
-	comedi_pci_disable(dev);
+	comedi_pci_detach(dev);
  	cb_pcidas64_free_dma(dev);
  }



It still has a race condition between the interrupt handler and iounmap(devpriv->main_iobase) though. (Even though you've disabled PLX interrupts, the handler could already be running.)

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux