fix rejection of CONFIG_ALT_SOURCE insn for 611x
authorFrank Mori Hess <fmhess@speakeasy.net>
Mon, 25 Nov 2002 20:13:55 +0000 (20:13 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Mon, 25 Nov 2002 20:13:55 +0000 (20:13 +0000)
comedi/drivers/ni_mio_common.c

index 9b5a9d7cd8db81cc67571480563b8b1f16b7e211..9476b2cbb0e272f03eb7fae44c4a97df38f29a1f 100644 (file)
@@ -1812,14 +1812,16 @@ static int ni_ai_insn_config(comedi_device *dev,comedi_subdevice *s,
                break;
        case INSN_CONFIG_ALT_SOURCE:
                {
-               if(data[1] >= 8)
-                       return -EINVAL;
-               devpriv->ai_calib_source = data[1] & 0xf;
-               if( boardtype.reg_611x )
-               {
-                       unsigned int calib_source_adjust;
+               unsigned int calib_source;
+               unsigned int calib_source_adjust;
 
-                       calib_source_adjust = ( data[1] >> 4 ) & 0xff;
+               calib_source = data[1] & 0xf;
+               calib_source_adjust = ( data[1] >> 4 ) & 0xff;
+
+               if(calib_source >= 8)
+                       return -EINVAL;
+               devpriv->ai_calib_source = calib_source;
+               if( boardtype.reg_611x ){
                        ni_writeb( calib_source_adjust, Cal_Gain_Select_611x );
                }
                return 2;