]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: addi_apci_3xxx: remove sanity checks in i_APCI3XXX_InsnReadAnalogInput()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 12 Jun 2013 23:16:25 +0000 (16:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jun 2013 21:33:43 +0000 (14:33 -0700)
The comedi core validates the insn->chanspec channel and range before
calling the subdevice (*insn_read) function.

Remove the unnecessary sanity 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/addi-data/hwdrv_apci3xxx.c

index a6142abdaeeb1b39d65e2d2fe3f6fb2817ec0e7d..dbe7a90858db8272b5d163e6977401888b9c73e1 100644 (file)
@@ -314,7 +314,6 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
                                          struct comedi_insn *insn,
                                          unsigned int *data)
 {
-       const struct apci3xxx_boardinfo *this_board = comedi_board(dev);
        struct apci3xxx_private *devpriv = dev->private;
        int i_ReturnValue = insn->n;
        unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec);
@@ -324,41 +323,6 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
        unsigned int dw_AcquisitionCpt = 0;
        unsigned char b_Interrupt = 0;
 
-          /***************************/
-               /* Test the channel number */
-          /***************************/
-
-               if (((b_Channel < this_board->i_NbrAiChannel)
-                               && (devpriv->b_SingelDiff == APCI3XXX_SINGLE))
-                       || ((b_Channel < this_board->i_NbrAiChannelDiff)
-                               && (devpriv->b_SingelDiff == APCI3XXX_DIFF))) {
-             /**********************************/
-                       /* Test the channel configuration */
-             /**********************************/
-
-                       if (b_Configuration > 7) {
-                /***************************/
-                               /* Channel not initialised */
-                /***************************/
-
-                               i_ReturnValue = -4;
-                               printk("Channel %d range %d selection error\n",
-                                       b_Channel, b_Configuration);
-                       }
-               } else {
-             /***************************/
-                       /* Channel selection error */
-             /***************************/
-
-                       i_ReturnValue = -3;
-                       printk("Channel %d selection error\n", b_Channel);
-               }
-
-          /**************************/
-               /* Test if no error occur */
-          /**************************/
-
-               if (i_ReturnValue >= 0) {
              /************************/
                        /* Test the buffer size */
              /************************/
@@ -493,7 +457,6 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
                                printk("Buffer size error\n");
                                i_ReturnValue = -101;
                        }
-               }
 
        return i_ReturnValue;
 }