staging: comedi: das1800: use __comedi_request_region()
Use __comedi_request_region() to request the additional 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. For aesthetic reasons, rename the local variable 'retval' to simply 'ret'. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5b365a8ace
commit
8fdbc75b70
1 changed files with 14 additions and 17 deletions
|
@ -1514,18 +1514,17 @@ static int das1800_attach(struct comedi_device *dev,
|
||||||
unsigned int irq = it->options[1];
|
unsigned int irq = it->options[1];
|
||||||
unsigned int dma0 = it->options[2];
|
unsigned int dma0 = it->options[2];
|
||||||
unsigned int dma1 = it->options[3];
|
unsigned int dma1 = it->options[3];
|
||||||
unsigned long iobase2;
|
|
||||||
int board;
|
int board;
|
||||||
int retval;
|
int ret;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
retval = comedi_request_region(dev, it->options[0], DAS1800_SIZE);
|
ret = comedi_request_region(dev, it->options[0], DAS1800_SIZE);
|
||||||
if (retval)
|
if (ret)
|
||||||
return retval;
|
return ret;
|
||||||
|
|
||||||
board = das1800_probe(dev);
|
board = das1800_probe(dev);
|
||||||
if (board < 0) {
|
if (board < 0) {
|
||||||
|
@ -1539,13 +1538,11 @@ static int das1800_attach(struct comedi_device *dev,
|
||||||
|
|
||||||
/* if it is an 'ao' board with fancy analog out then we need extra io ports */
|
/* if it is an 'ao' board with fancy analog out then we need extra io ports */
|
||||||
if (thisboard->ao_ability == 2) {
|
if (thisboard->ao_ability == 2) {
|
||||||
iobase2 = dev->iobase + IOBASE2;
|
unsigned long iobase2 = dev->iobase + IOBASE2;
|
||||||
if (!request_region(iobase2, DAS1800_SIZE, dev->board_name)) {
|
|
||||||
|
ret = __comedi_request_region(dev, iobase2, DAS1800_SIZE);
|
||||||
|
if (ret) {
|
||||||
release_region(dev->iobase, DAS1800_SIZE);
|
release_region(dev->iobase, DAS1800_SIZE);
|
||||||
dev_warn(dev->class_dev,
|
|
||||||
"%s: I/O port conflict (%#lx,%d)\n",
|
|
||||||
dev->board_name,
|
|
||||||
iobase2, DAS1800_SIZE);
|
|
||||||
dev->iobase = 0;
|
dev->iobase = 0;
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -1591,9 +1588,9 @@ static int das1800_attach(struct comedi_device *dev,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = das1800_init_dma(dev, dma0, dma1);
|
ret = das1800_init_dma(dev, dma0, dma1);
|
||||||
if (retval < 0)
|
if (ret < 0)
|
||||||
return retval;
|
return ret;
|
||||||
|
|
||||||
if (devpriv->ai_buf0 == NULL) {
|
if (devpriv->ai_buf0 == NULL) {
|
||||||
devpriv->ai_buf0 =
|
devpriv->ai_buf0 =
|
||||||
|
@ -1602,9 +1599,9 @@ static int das1800_attach(struct comedi_device *dev,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = comedi_alloc_subdevices(dev, 4);
|
ret = comedi_alloc_subdevices(dev, 4);
|
||||||
if (retval)
|
if (ret)
|
||||||
return retval;
|
return ret;
|
||||||
|
|
||||||
/* analog input subdevice */
|
/* analog input subdevice */
|
||||||
s = &dev->subdevices[0];
|
s = &dev->subdevices[0];
|
||||||
|
|
Loading…
Add table
Reference in a new issue