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

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 f1299aed285016082232a6f8c25118959cc4f647..2b9790ed6945c87da87bd75dc9abb9075d204b86 100644 (file)
@@ -621,16 +621,19 @@ static inline void ni_set_cdo_dma_channel(struct comedi_device *dev,
 {
        struct ni_private *devpriv = dev->private;
        unsigned long flags;
+       unsigned bits;
 
        spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags);
-       devpriv->cdio_dma_select_reg &= ~CDO_DMA_Select_Mask;
+       devpriv->cdio_dma_select_reg &= ~NI_M_CDIO_DMA_SEL_CDO_MASK;
        if (mite_channel >= 0) {
-               /*XXX just guessing ni_stc_dma_channel_select_bitfield() returns the right bits,
-                  under the assumption the cdio dma selection works just like ai/ao/gpct.
-                  Definitely works for dma channels 0 and 1. */
-               devpriv->cdio_dma_select_reg |=
-                   (ni_stc_dma_channel_select_bitfield(mite_channel) <<
-                    CDO_DMA_Select_Shift) & CDO_DMA_Select_Mask;
+               /*
+                * XXX just guessing ni_stc_dma_channel_select_bitfield()
+                * returns the right bits, under the assumption the cdio dma
+                * selection works just like ai/ao/gpct.
+                * Definitely works for dma channels 0 and 1.
+                */
+               bits = ni_stc_dma_channel_select_bitfield(mite_channel);
+               devpriv->cdio_dma_select_reg |= NI_M_CDIO_DMA_SEL_CDO(bits);
        }
        ni_writeb(dev, devpriv->cdio_dma_select_reg, NI_M_CDIO_DMA_SEL_REG);
        mmiowb();
index 983aeee79bdf35d7d95f2e7755032854a2626f94..a26e5c21aed10b526add655b080b35f586282b48 100644 (file)
@@ -925,6 +925,10 @@ static const struct comedi_lrange range_ni_E_ao_ext;
  * remapping.
  */
 #define NI_M_CDIO_DMA_SEL_REG          0x007
+#define NI_M_CDIO_DMA_SEL_CDO(x)       (((x) & 0xf) << 4)
+#define NI_M_CDIO_DMA_SEL_CDO_MASK     NI_M_CDIO_DMA_SEL_CDO(0xf)
+#define NI_M_CDIO_DMA_SEL_CDI(x)       (((x) & 0xf) << 0)
+#define NI_M_CDIO_DMA_SEL_CDI_MASK     NI_M_CDIO_DMA_SEL_CDI(0xf)
 #define NI_M_SCXI_STATUS_REG           0x007
 #define NI_M_AI_AO_SEL_REG             0x009
 #define NI_M_G0_G1_SEL_REG             0x00b
@@ -1047,13 +1051,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)
 
-enum CDIO_DMA_Select_Bits {
-       CDI_DMA_Select_Shift = 0,
-       CDI_DMA_Select_Mask = 0xf,
-       CDO_DMA_Select_Shift = 4,
-       CDO_DMA_Select_Mask = 0xf << CDO_DMA_Select_Shift
-};
-
 enum CDIO_Status_Bits {
        CDO_FIFO_Empty_Bit = 0x1,
        CDO_FIFO_Full_Bit = 0x2,