staging: comedi: ni_stc.h: simplify MSeries_AI_Config_Bank_Bits()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 1 May 2015 21:58:33 +0000 (14:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 May 2015 17:05:03 +0000 (19:05 +0200)
Simplify this helper function by using a bit-shift to set the high
banks select bit.

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_stc.h

index aca6e5c34080bb1c1fdd0f81abffe4e66d0e6a69..3c5ba613a2d6b15c5463f27571512be9d5b03cd7 100644 (file)
@@ -992,11 +992,7 @@ static inline unsigned MSeries_AI_Config_Channel_Bits(unsigned channel)
 
 static inline unsigned MSeries_AI_Config_Bank_Bits(unsigned channel)
 {
-       unsigned bits = channel & 0x30;
-
-       if (channel & 0x40)
-               bits |= 0x400;
-       return bits;
+       return ((channel & 0x40) << 4) | (channel & 0x30);
 }
 
 static inline unsigned MSeries_AI_Config_Gain_Bits(unsigned range)