summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-07-29 21:05:00 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-01 00:38:01 (GMT)
commitb08c4015e6042113625d92f9e3e32bdaa652bf76 (patch)
treeb29fcb8a4ffec9cac7f3a7ad62f4ebc295266541 /drivers/staging/comedi
parent0f13a8d02741f3fd301c5c0184e2c2d734f31a85 (diff)
downloadlinux-fsl-qoriq-b08c4015e6042113625d92f9e3e32bdaa652bf76.tar.xz
staging: comedi: das16: fail attach if board id is incorrect
This driver probes the board id during the attach to ensure that the user is attempting to attach to the correct board type. Currently an error message is output if the ids are not consistent but the attach continues anyway. Make the attach fail if the id bits do not match. Also, cleanup the printk messages and use a dev_err() only if the probe fails. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r--drivers/staging/comedi/drivers/das16.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c
index 97ba2bd..8f4b3dd 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -974,11 +974,11 @@ static int das16_probe(struct comedi_device *dev, struct comedi_devconfig *it)
/* diobits indicates boards */
diobits = inb(dev->iobase + DAS16_DIO_REG) & 0xf0;
-
- printk(KERN_INFO " id bits are 0x%02x\n", diobits);
if (board->id != diobits) {
- printk(KERN_INFO " requested board's id bits are 0x%x (ignore)\n",
- board->id);
+ dev_err(dev->class_dev,
+ "requested board's id bits are incorrect (0x%x != 0x%x)\n",
+ board->id, diobits);
+ return -EINVAL;
}
return 0;
@@ -1054,10 +1054,8 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
}
/* probe id bits to make sure they are consistent */
- if (das16_probe(dev, it)) {
- printk(KERN_ERR " id bits do not match selected board, aborting\n");
+ if (das16_probe(dev, it))
return -EINVAL;
- }
/* get master clock speed */
if (devpriv->can_burst) {