aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-04-09 19:13:19 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-11 15:47:38 -0400
commit71827d43421824a11ac50d83b9e212061a84b025 (patch)
treef3eb46bc867a871fd176f711ed702e9fe4cd9e0a /drivers/staging
parent9308902f301d628802e40b6c3fbefa11fc9dd9d9 (diff)
staging: comedi: ampcl_dio200: use comedi_request_region()
Use comedi_request_region() to request the I/O region used by this driver. Remove the noise when the board is first attached as well as the error message when the request_region() fails, comedi_request_reqion() will output the error message if necessary. 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>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
index 1d1f2feaeb66..dc35cc9fb081 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200.c
@@ -268,44 +268,24 @@ static const struct dio200_board dio200_isa_boards[] = {
268 }, 268 },
269}; 269};
270 270
271/*
272 * This function checks and requests an I/O region, reporting an error
273 * if there is a conflict.
274 */
275static int
276dio200_request_region(struct comedi_device *dev,
277 unsigned long from, unsigned long extent)
278{
279 if (!from || !request_region(from, extent, dev->board_name)) {
280 dev_err(dev->class_dev, "I/O port conflict (%#lx,%lu)!\n",
281 from, extent);
282 return -EIO;
283 }
284 return 0;
285}
286
287static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) 271static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
288{ 272{
289 const struct dio200_board *thisboard = comedi_board(dev); 273 const struct dio200_board *thisboard = comedi_board(dev);
290 struct dio200_private *devpriv; 274 struct dio200_private *devpriv;
291 unsigned long iobase;
292 unsigned int irq; 275 unsigned int irq;
293 int ret; 276 int ret;
294 277
295 iobase = it->options[0];
296 irq = it->options[1]; 278 irq = it->options[1];
297 dev_info(dev->class_dev, "%s: attach %s 0x%lX,%u\n",
298 dev->driver->driver_name, dev->board_name, iobase, irq);
299 279
300 devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL); 280 devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
301 if (!devpriv) 281 if (!devpriv)
302 return -ENOMEM; 282 return -ENOMEM;
303 dev->private = devpriv; 283 dev->private = devpriv;
304 284
305 ret = dio200_request_region(dev, iobase, thisboard->mainsize); 285 ret = comedi_request_region(dev, it->options[0], thisboard->mainsize);
306 if (ret < 0) 286 if (ret)
307 return ret; 287 return ret;
308 devpriv->io.u.iobase = iobase; 288 devpriv->io.u.iobase = dev->iobase;
309 devpriv->io.regtype = io_regtype; 289 devpriv->io.regtype = io_regtype;
310 return amplc_dio200_common_attach(dev, irq, 0); 290 return amplc_dio200_common_attach(dev, irq, 0);
311} 291}