Re: [PATCH 16/16] staging: comedi: rtd520: 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.

Remove the unnecessary read/write of the PLC_INTRCS_REG. The rtd_reset()
function writes '0' to this register.

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

diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c
index 6fc4ed3..92bf42846 100644
--- a/drivers/staging/comedi/drivers/rtd520.c
+++ b/drivers/staging/comedi/drivers/rtd520.c
@@ -1361,23 +1361,15 @@ static void rtd_detach(struct comedi_device *dev)
  	struct rtd_private *devpriv = dev->private;

  	if (devpriv) {
-		/* Shut down any board ops by resetting it */
-		if (dev->mmio && devpriv->lcfg)
-			rtd_reset(dev);
-		if (dev->irq) {
-			writel(readl(devpriv->lcfg + PLX_INTRCS_REG) &
-				~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E),
-				devpriv->lcfg + PLX_INTRCS_REG);
-			free_irq(dev->irq, dev);
+		if (devpriv->lcfg) {
+			if (dev->mmio)
+				rtd_reset(dev);
+			iounmap(devpriv->lcfg);
  		}
-		if (dev->mmio)
-			iounmap(dev->mmio);
  		if (devpriv->las1)
  			iounmap(devpriv->las1);
-		if (devpriv->lcfg)
-			iounmap(devpriv->lcfg);
  	}
-	comedi_pci_disable(dev);
+	comedi_pci_detach(dev);
  }

  static struct comedi_driver rtd520_driver = {


Again, there's a race between the interrupt handler and iounmap(devpriv->las1).

--
-=( 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