Commit adfaa207 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: das16: 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. Save the iobase for that region in the private data so that
the (*detach) knows it needs to be released.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a3fd5e51
...@@ -393,6 +393,8 @@ struct das16_private_struct { ...@@ -393,6 +393,8 @@ struct das16_private_struct {
struct timer_list timer; /* for timed interrupt */ struct timer_list timer; /* for timed interrupt */
volatile short timer_running; volatile short timer_running;
volatile short timer_mode; /* true if using timer mode */ volatile short timer_mode; /* true if using timer mode */
unsigned long extra_iobase;
}; };
static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s,
...@@ -1122,11 +1124,9 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1122,11 +1124,9 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* Request an additional region for the 8255 */ /* Request an additional region for the 8255 */
ret = __comedi_request_region(dev, dev->iobase + 0x400, ret = __comedi_request_region(dev, dev->iobase + 0x400,
board->size & 0x3ff); board->size & 0x3ff);
if (ret) { if (ret)
release_region(dev->iobase, 0x10); return ret;
dev->iobase = 0; devpriv->extra_iobase = dev->iobase + 0x400;
return -EIO;
}
} }
/* probe id bits to make sure they are consistent */ /* probe id bits to make sure they are consistent */
...@@ -1356,15 +1356,9 @@ static void das16_detach(struct comedi_device *dev) ...@@ -1356,15 +1356,9 @@ static void das16_detach(struct comedi_device *dev)
} }
if (dev->irq) if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->iobase) { if (devpriv->extra_iobase)
if (board->size < 0x400) { release_region(devpriv->extra_iobase, board->size & 0x3ff);
release_region(dev->iobase, board->size); comedi_legacy_detach(dev);
} else {
release_region(dev->iobase, 0x10);
release_region(dev->iobase + 0x400,
board->size & 0x3ff);
}
}
} }
static const struct das16_board das16_boards[] = { static const struct das16_board das16_boards[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment