staging: comedi: me4000: remove sanity checks in me4000_ao_insn_write()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 25 Aug 2014 23:04:54 +0000 (16:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Aug 2014 20:22:34 +0000 (13:22 -0700)
The comedi core does the sanity checking of the comedi_insn before
calling the (*insn_write). Remove the unnecessary checks.

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>
drivers/staging/comedi/drivers/me4000.c

index 2cc5becd455fa683e845bb3d41837c05160ac058..d20b508065831fe61a5c5389614c3b228ab6afb1 100644 (file)
@@ -1188,44 +1188,15 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-/*=============================================================================
-  Analog output section
-  ===========================================================================*/
-
 static int me4000_ao_insn_write(struct comedi_device *dev,
                                struct comedi_subdevice *s,
-                               struct comedi_insn *insn, unsigned int *data)
+                               struct comedi_insn *insn,
+                               unsigned int *data)
 {
-       const struct me4000_board *thisboard = comedi_board(dev);
        struct me4000_info *info = dev->private;
        int chan = CR_CHAN(insn->chanspec);
-       int rang = CR_RANGE(insn->chanspec);
-       int aref = CR_AREF(insn->chanspec);
        unsigned int tmp;
 
-       if (insn->n == 0) {
-               return 0;
-       } else if (insn->n > 1) {
-               dev_err(dev->class_dev, "Invalid instruction length %d\n",
-                       insn->n);
-               return -EINVAL;
-       }
-
-       if (chan >= thisboard->ao_nchan) {
-               dev_err(dev->class_dev, "Invalid channel %d\n", insn->n);
-               return -EINVAL;
-       }
-
-       if (rang != 0) {
-               dev_err(dev->class_dev, "Invalid range %d\n", insn->n);
-               return -EINVAL;
-       }
-
-       if (aref != AREF_GROUND && aref != AREF_COMMON) {
-               dev_err(dev->class_dev, "Invalid aref %d\n", insn->n);
-               return -EINVAL;
-       }
-
        /* Stop any running conversion */
        tmp = inl(dev->iobase + ME4000_AO_CTRL_REG(chan));
        tmp |= ME4000_AO_CTRL_BIT_IMMEDIATE_STOP;