staging: comedi: das16m1: use comedi_request_region()
Use comedi_request_region() to request the I/O region used by this driver. Remove the error message when the request_region() fails, comedi_request_reqion() will output the error message if necessary. This driver does a second request_region() for the I/O space needed by the 8255 chip. Modify the error message if that request fails so it matches to format of the comedi_request_region() message. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
45f9fcc2ff
commit
a983834ee4
1 changed files with 9 additions and 11 deletions
|
@ -571,26 +571,24 @@ static int das16m1_attach(struct comedi_device *dev,
|
||||||
struct comedi_subdevice *s;
|
struct comedi_subdevice *s;
|
||||||
int ret;
|
int ret;
|
||||||
unsigned int irq;
|
unsigned int irq;
|
||||||
unsigned long iobase;
|
|
||||||
|
|
||||||
iobase = it->options[0];
|
|
||||||
|
|
||||||
devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
|
devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
|
||||||
if (!devpriv)
|
if (!devpriv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
dev->private = devpriv;
|
dev->private = devpriv;
|
||||||
|
|
||||||
if (!request_region(iobase, DAS16M1_SIZE, dev->board_name)) {
|
ret = comedi_request_region(dev, it->options[0], DAS16M1_SIZE);
|
||||||
comedi_error(dev, "I/O port conflict\n");
|
if (ret)
|
||||||
return -EIO;
|
return ret;
|
||||||
}
|
/* Request an additional region for the 8255 */
|
||||||
if (!request_region(iobase + DAS16M1_82C55, DAS16M1_SIZE2,
|
if (!request_region(dev->iobase + DAS16M1_82C55, DAS16M1_SIZE2,
|
||||||
dev->board_name)) {
|
dev->board_name)) {
|
||||||
release_region(iobase, DAS16M1_SIZE);
|
release_region(dev->iobase, DAS16M1_SIZE);
|
||||||
comedi_error(dev, "I/O port conflict\n");
|
dev_warn(dev->class_dev, "%s: I/O port conflict (%#lx,%d)\n",
|
||||||
|
dev->board_name,
|
||||||
|
dev->iobase + DAS16M1_82C55, DAS16M1_SIZE2);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
dev->iobase = iobase;
|
|
||||||
|
|
||||||
/* now for the irq */
|
/* now for the irq */
|
||||||
irq = it->options[1];
|
irq = it->options[1];
|
||||||
|
|
Loading…
Add table
Reference in a new issue