]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: ni_stc.h: tidy up NI_M_PFI_OUT_SEL_REG bits
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 1 May 2015 21:58:43 +0000 (14:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 May 2015 17:05:05 +0000 (19:05 +0200)
Rename the CamelCase and convert the inline helper functions
that set/get the bits in this register to macros.

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 af095e621e9f7f4e0faebe286dfa2ea288295c1b..740a92c4b98fc95ceb04e69ea2bc2aa914d07d8c 100644 (file)
@@ -4367,7 +4367,7 @@ static unsigned ni_m_series_get_pfi_routing(struct comedi_device *dev,
        struct ni_private *devpriv = dev->private;
        const unsigned array_offset = chan / 3;
 
-       return MSeries_PFI_Output_Select_Source(chan,
+       return NI_M_PFI_OUT_SEL_TO_SRC(chan,
                                devpriv->pfi_output_select_reg[array_offset]);
 }
 
@@ -4381,8 +4381,8 @@ static int ni_m_series_set_pfi_routing(struct comedi_device *dev,
        if ((source & 0x1f) != source)
                return -EINVAL;
 
-       val &= ~MSeries_PFI_Output_Select_Mask(chan);
-       val |= MSeries_PFI_Output_Select_Bits(chan, source);
+       val &= ~NI_M_PFI_OUT_SEL_MASK(chan);
+       val |= NI_M_PFI_OUT_SEL(chan, source);
        ni_writew(dev, val, NI_M_PFI_OUT_SEL_REG(index));
        devpriv->pfi_output_select_reg[index] = val;
 
index 33ed998890a0dfdc7b405b6c52bd5be588004061..be9efdc18693cf10b4cab0ebde7d316ab9740260 100644 (file)
@@ -1005,6 +1005,10 @@ static const struct comedi_lrange range_ni_E_ao_ext;
 #define NI_M_PLL_STATUS_REG            0x1c8
 #define NI_M_PLL_STATUS_LOCKED         BIT(0)
 #define NI_M_PFI_OUT_SEL_REG(x)                (0x1d0 + ((x) * 2))
+#define NI_M_PFI_CHAN(_c)              (((_c) % 3) * 5)
+#define NI_M_PFI_OUT_SEL(_c, _s)       (((_s) & 0x1f) << NI_M_PFI_CHAN(_c))
+#define NI_M_PFI_OUT_SEL_MASK(_c)      (0x1f << NI_M_PFI_CHAN(_c))
+#define NI_M_PFI_OUT_SEL_TO_SRC(_c, _b)        (((_b) >> NI_M_PFI_CHAN(_c)) & 0x1f)
 #define NI_M_PFI_DI_REG                        0x1dc
 #define NI_M_PFI_DO_REG                        0x1de
 #define NI_M_CFG_BYPASS_FIFO_REG       0x218
@@ -1041,24 +1045,6 @@ static const struct comedi_lrange range_ni_E_ao_ext;
 #define NI_M_AO_REF_ATTENUATION_REG(x) (0x264 + (x))
 #define NI_M_AO_REF_ATTENUATION_X5     BIT(0)
 
-static inline unsigned MSeries_PFI_Output_Select_Mask(unsigned channel)
-{
-       return 0x1f << (channel % 3) * 5;
-};
-
-static inline unsigned MSeries_PFI_Output_Select_Bits(unsigned channel,
-                                                     unsigned source)
-{
-       return (source & 0x1f) << ((channel % 3) * 5);
-};
-
-/* inverse to MSeries_PFI_Output_Select_Bits */
-static inline unsigned MSeries_PFI_Output_Select_Source(unsigned channel,
-                                                       unsigned bits)
-{
-       return (bits >> ((channel % 3) * 5)) & 0x1f;
-};
-
 static inline unsigned MSeries_PFI_Filter_Select_Mask(unsigned channel)
 {
        return 0x3 << (channel * 2);