]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: ni_mio_common: remove INSN_CONFIG_ANALOG_TRIG support code
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 14 Jul 2014 19:23:46 +0000 (12:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2014 20:24:42 +0000 (13:24 -0700)
None of the boardinfo that uses this code sets the 'has_analog_trig' flag so
ni_ai_config_analog_trig() always returns -EINVAL.

Also, the private data 'atrig_low', 'atrig_high', and 'atrig_mode' values
that are set by ni_ai_config_analog_trig() are never used.

Remove the incomplete INSN_CONFIG_ANALOG_TRIG support along with the unused
boardinfo and private data members.

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/ni_mio_common.c
drivers/staging/comedi/drivers/ni_stc.h

index 13270b348f821fcdabde9a2cca6ca9317fdeedc9..8854f18eaa165f28b1b5d67636cef9f77a88ed9c 100644 (file)
@@ -2732,106 +2732,6 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
        return 0;
 }
 
-static int ni_ai_config_analog_trig(struct comedi_device *dev,
-                                   struct comedi_subdevice *s,
-                                   struct comedi_insn *insn,
-                                   unsigned int *data)
-{
-       const struct ni_board_struct *board = comedi_board(dev);
-       struct ni_private *devpriv = dev->private;
-       unsigned int a, b, modebits;
-       int err = 0;
-
-       /* data[1] is flags
-        * data[2] is analog line
-        * data[3] is set level
-        * data[4] is reset level */
-       if (!board->has_analog_trig)
-               return -EINVAL;
-       if ((data[1] & 0xffff0000) != COMEDI_EV_SCAN_BEGIN) {
-               data[1] &= (COMEDI_EV_SCAN_BEGIN | 0xffff);
-               err++;
-       }
-       if (data[2] >= board->n_adchan) {
-               data[2] = board->n_adchan - 1;
-               err++;
-       }
-       if (data[3] > 255) {    /* a */
-               data[3] = 255;
-               err++;
-       }
-       if (data[4] > 255) {    /* b */
-               data[4] = 255;
-               err++;
-       }
-       /*
-        * 00 ignore
-        * 01 set
-        * 10 reset
-        *
-        * modes:
-        *   1 level:                    +b-   +a-
-        *     high mode                00 00 01 10
-        *     low mode                 00 00 10 01
-        *   2 level: (a<b)
-        *     hysteresis low mode      10 00 00 01
-        *     hysteresis high mode     01 00 00 10
-        *     middle mode              10 01 01 10
-        */
-
-       a = data[3];
-       b = data[4];
-       modebits = data[1] & 0xff;
-       if (modebits & 0xf0) {
-               /* two level mode */
-               if (b < a) {
-                       /* swap order */
-                       a = data[4];
-                       b = data[3];
-                       modebits =
-                           ((data[1] & 0xf) << 4) | ((data[1] & 0xf0) >> 4);
-               }
-               devpriv->atrig_low = a;
-               devpriv->atrig_high = b;
-               switch (modebits) {
-               case 0x81:      /* low hysteresis mode */
-                       devpriv->atrig_mode = 6;
-                       break;
-               case 0x42:      /* high hysteresis mode */
-                       devpriv->atrig_mode = 3;
-                       break;
-               case 0x96:      /* middle window mode */
-                       devpriv->atrig_mode = 2;
-                       break;
-               default:
-                       data[1] &= ~0xff;
-                       err++;
-               }
-       } else {
-               /* one level mode */
-               if (b != 0) {
-                       data[4] = 0;
-                       err++;
-               }
-               switch (modebits) {
-               case 0x06:      /* high window mode */
-                       devpriv->atrig_high = a;
-                       devpriv->atrig_mode = 0;
-                       break;
-               case 0x09:      /* low window mode */
-                       devpriv->atrig_low = a;
-                       devpriv->atrig_mode = 1;
-                       break;
-               default:
-                       data[1] &= ~0xff;
-                       err++;
-               }
-       }
-       if (err)
-               return -EAGAIN;
-       return 5;
-}
-
 static int ni_ai_insn_config(struct comedi_device *dev,
                             struct comedi_subdevice *s,
                             struct comedi_insn *insn, unsigned int *data)
@@ -2842,8 +2742,6 @@ static int ni_ai_insn_config(struct comedi_device *dev,
                return -EINVAL;
 
        switch (data[0]) {
-       case INSN_CONFIG_ANALOG_TRIG:
-               return ni_ai_config_analog_trig(dev, s, insn, data);
        case INSN_CONFIG_ALT_SOURCE:
                if (devpriv->is_m_series) {
                        if (data[1] & ~(MSeries_AI_Bypass_Cal_Sel_Pos_Mask |
index bcb3835b23c93577299e023b2e9da552d864d65d..2b937d37ae9b5db6cf9490c8d12030fbf18af97b 100644 (file)
@@ -1410,7 +1410,6 @@ struct ni_board_struct {
 
        int reg_type;
        unsigned int has_8255:1;
-       unsigned int has_analog_trig:1;
 
        enum caldac_enum caldac[3];
 };
@@ -1471,10 +1470,6 @@ struct ni_private {
        unsigned clock_ns;
        unsigned clock_source;
 
-       unsigned short atrig_mode;
-       unsigned short atrig_high;
-       unsigned short atrig_low;
-
        unsigned short pwm_up_count;
        unsigned short pwm_down_count;