提交 e608796a 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: das1800: use comedi_legacy_detach()

Use the new comedi_legacy_detach() helper in the (*detach) to release
the first I/O region requested by this driver.

An additional I/O region is requested for some of the boards this driver
supports. The iobase for that region is stored in the private data so
that the (*detach) knows it needs to be released. Remove the extra
cleanup in the (*attach) that releases the first region.

For aesthetics, move the release of the additional region in the
(*detach) so it follows the (*attach) order.
Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: NIan Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 4b3fb0ff
...@@ -1541,11 +1541,8 @@ static int das1800_attach(struct comedi_device *dev, ...@@ -1541,11 +1541,8 @@ static int das1800_attach(struct comedi_device *dev,
unsigned long iobase2 = dev->iobase + IOBASE2; unsigned long iobase2 = dev->iobase + IOBASE2;
ret = __comedi_request_region(dev, iobase2, DAS1800_SIZE); ret = __comedi_request_region(dev, iobase2, DAS1800_SIZE);
if (ret) { if (ret)
release_region(dev->iobase, DAS1800_SIZE); return ret;
dev->iobase = 0;
return -EIO;
}
devpriv->iobase2 = iobase2; devpriv->iobase2 = iobase2;
} }
...@@ -1671,21 +1668,20 @@ static void das1800_detach(struct comedi_device *dev) ...@@ -1671,21 +1668,20 @@ static void das1800_detach(struct comedi_device *dev)
{ {
struct das1800_private *devpriv = dev->private; struct das1800_private *devpriv = dev->private;
if (dev->iobase)
release_region(dev->iobase, DAS1800_SIZE);
if (dev->irq) if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv) { if (devpriv) {
if (devpriv->iobase2)
release_region(devpriv->iobase2, DAS1800_SIZE);
if (devpriv->dma0) if (devpriv->dma0)
free_dma(devpriv->dma0); free_dma(devpriv->dma0);
if (devpriv->dma1) if (devpriv->dma1)
free_dma(devpriv->dma1); free_dma(devpriv->dma1);
kfree(devpriv->ai_buf0); kfree(devpriv->ai_buf0);
kfree(devpriv->ai_buf1); kfree(devpriv->ai_buf1);
if (devpriv->iobase2)
release_region(devpriv->iobase2, DAS1800_SIZE);
} }
}; comedi_legacy_detach(dev);
}
static struct comedi_driver das1800_driver = { static struct comedi_driver das1800_driver = {
.driver_name = "das1800", .driver_name = "das1800",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册