[PATCH v3] staging: comedi: ni_pcidio: make defines uppercase

2019-01-10 Thread Alexander Schroth
According to the Linux coding guidelines, defines should be written
in uppercase. This patch converts all define-statements in the
ni_pcidio.c file to uppercase, thus matching the coding style of the
kernel.

Signed-off-by: Alexander Schroth 
Signed-off-by: Marco Ammon 

---

v2: After feedback, renamed defines we had proposed to delete in the
original patch series.

v3: rephrased subject line to add correct tags
---
 drivers/staging/comedi/drivers/ni_pcidio.c | 444 +++--
 1 file changed, 223 insertions(+), 221 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index b9a0dc6eac44..4bdef87d5dd7 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -49,116 +49,117 @@
 
 /* defines for the PCI-DIO-32HS */
 
-#define Window_Address 4   /* W */
-#define Interrupt_And_Window_Status4   /* R */
-#define IntStatus1 BIT(0)
-#define IntStatus2 BIT(1)
-#define WindowAddressStatus_mask   0x7c
-
-#define Master_DMA_And_Interrupt_Control 5 /* W */
-#define InterruptLine(x)   ((x) & 3)
-#define OpenIntBIT(2)
-#define Group_Status   5   /* R */
-#define DataLeft   BIT(0)
-#define ReqBIT(2)
-#define StopTrig   BIT(3)
-
-#define Group_1_Flags  6   /* R */
-#define Group_2_Flags  7   /* R */
-#define TransferReady  BIT(0)
-#define CountExpired   BIT(1)
-#define Waited BIT(5)
-#define PrimaryTC  BIT(6)
-#define SecondaryTCBIT(7)
+#define WINDOW_ADDRESS 4   /* W */
+#define INTERRUPT_AND_WINDOW_STATUS4   /* R */
+#define INT_STATUS_1   BIT(0)
+#define INT_STATUS_2   BIT(1)
+#define WINDOW_ADDRESS_STATUS_MASK 0x7c
+
+#define MASTER_DMA_AND_INTERRUPT_CONTROL 5 /* W */
+#define INTERRUPT_LINE(x)  ((x) & 3)
+#define OPEN_INT   BIT(2)
+#define GROUP_STATUS   5   /* R */
+#define DATA_LEFT  BIT(0)
+#define REQBIT(2)
+#define STOP_TRIG  BIT(3)
+
+#define GROUP_1_FLAGS  6   /* R */
+#define GROUP_2_FLAGS  7   /* R */
+#define TRANSFER_READY BIT(0)
+#define COUNT_EXPIRED  BIT(1)
+#define WAITED BIT(5)
+#define PRIMARY_TC BIT(6)
+#define SECONDARY_TC   BIT(7)
   /* #define SerialRose */
   /* #define ReqRose */
   /* #define Paused */
 
-#define Group_1_First_Clear6   /* W */
-#define Group_2_First_Clear7   /* W */
-#define ClearWaitedBIT(3)
-#define ClearPrimaryTC BIT(4)
-#define ClearSecondaryTC   BIT(5)
-#define DMAReset   BIT(6)
-#define FIFOReset  BIT(7)
-#define ClearAll   0xf8
-
-#define Group_1_FIFO   8   /* W */
-#define Group_2_FIFO   12  /* W */
-
-#define Transfer_Count 20
-#define Chip_ID_D  24
-#define Chip_ID_I  25
-#define Chip_ID_O  26
-#define Chip_Version   27
-#define Port_IO(x) (28 + (x))
-#define Port_Pin_Directions(x) (32 + (x))
-#define Port_Pin_Mask(x)   (36 + (x))
-#define Port_Pin_Polarities(x) (40 + (x))
-
-#define Master_Clock_Routing   45
-#define RTSIClocking(x)(((x) & 3) << 4)
-
-#define Group_1_Second_Clear   46  /* W */
-#define Group_2_Second_Clear   47  /* W */
-#define ClearExpired   BIT(0)
-
-#define Port_Pattern(x)(48 + (x))
-
-#define Data_Path  64
-#define FIFOEnableABIT(0)
-#define FIFOEnableBBIT(1)
-#define FIFOEnableCBIT(2)
-#define FIFOEnableDBIT(3)
-#define Funneling(x)   (((x) & 3) << 4)
-#define GroupDirection BIT(7)
-
-#define Protocol_Register_165
-#define OpMode Protocol_Register_1
-#define RunMode(x) ((x) & 7)
-#define Numbered   BIT(3)
-
-#define Protocol_Register_266
-#define ClockReg   Protocol_Register_2
-#define ClockLine(x)

Re: [PATCH 2/2] comedi/ni_pcidio: make all defines uppercase

2018-12-17 Thread Alexander Schroth
We agree that preserving the reverse-engineered knowledge is more
important than reducing code size. In turn, we have modified the patch
to keep these defines and converted them to uppercase as well.
Also, we agree that further abbreviating would be a bad idea.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] comedi/ni_pcidio: make all defines uppercase

2018-12-17 Thread Alexander Schroth
According to the Linux coding guidelines, defines should be written
in uppercase. This patch converts all define-statements in the
ni_pcidio.c file to uppercase, thus matching the coding style of the
kernel.

Signed-off-by: Alexander Schroth 
Signed-off-by: Marco Ammon 
---
 drivers/staging/comedi/drivers/ni_pcidio.c | 442 +++--
 1 file changed, 222 insertions(+), 220 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index b9a0dc6eac44..407922b096a3 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -49,116 +49,117 @@
 
 /* defines for the PCI-DIO-32HS */
 
-#define Window_Address 4   /* W */
-#define Interrupt_And_Window_Status4   /* R */
-#define IntStatus1 BIT(0)
-#define IntStatus2 BIT(1)
-#define WindowAddressStatus_mask   0x7c
-
-#define Master_DMA_And_Interrupt_Control 5 /* W */
-#define InterruptLine(x)   ((x) & 3)
-#define OpenIntBIT(2)
-#define Group_Status   5   /* R */
-#define DataLeft   BIT(0)
-#define ReqBIT(2)
-#define StopTrig   BIT(3)
-
-#define Group_1_Flags  6   /* R */
-#define Group_2_Flags  7   /* R */
-#define TransferReady  BIT(0)
-#define CountExpired   BIT(1)
-#define Waited BIT(5)
-#define PrimaryTC  BIT(6)
-#define SecondaryTCBIT(7)
+#define WINDOW_ADDRESS 4   /* W */
+#define INTERRUPT_AND_WINDOW_STATUS4   /* R */
+#define INT_STATUS_1   BIT(0)
+#define INT_STATUS_2   BIT(1)
+#define WINDOW_ADDRESS_STATUS_MASK 0x7c
+
+#define MASTER_DMA_AND_INTERRUPT_CONTROL 5 /* W */
+#define INTERRUPT_LINE(x)  ((x) & 3)
+#define OPEN_INT   BIT(2)
+#define GROUP_STATUS   5   /* R */
+#define DATA_LEFT  BIT(0)
+#define REQBIT(2)
+#define STOP_TRIG  BIT(3)
+
+#define GROUP_1_FLAGS  6   /* R */
+#define GROUP_2_FLAGS  7   /* R */
+#define TRANSFER_READY BIT(0)
+#define COUNT_EXPIRED  BIT(1)
+#define WAITED BIT(5)
+#define PRIMARY_TC BIT(6)
+#define SECONDARY_TC   BIT(7)
   /* #define SerialRose */
   /* #define ReqRose */
   /* #define Paused */
 
-#define Group_1_First_Clear6   /* W */
-#define Group_2_First_Clear7   /* W */
-#define ClearWaitedBIT(3)
-#define ClearPrimaryTC BIT(4)
-#define ClearSecondaryTC   BIT(5)
-#define DMAReset   BIT(6)
-#define FIFOReset  BIT(7)
-#define ClearAll   0xf8
-
-#define Group_1_FIFO   8   /* W */
-#define Group_2_FIFO   12  /* W */
-
-#define Transfer_Count 20
-#define Chip_ID_D  24
-#define Chip_ID_I  25
-#define Chip_ID_O  26
-#define Chip_Version   27
-#define Port_IO(x) (28 + (x))
-#define Port_Pin_Directions(x) (32 + (x))
-#define Port_Pin_Mask(x)   (36 + (x))
-#define Port_Pin_Polarities(x) (40 + (x))
-
-#define Master_Clock_Routing   45
-#define RTSIClocking(x)(((x) & 3) << 4)
-
-#define Group_1_Second_Clear   46  /* W */
-#define Group_2_Second_Clear   47  /* W */
-#define ClearExpired   BIT(0)
-
-#define Port_Pattern(x)(48 + (x))
-
-#define Data_Path  64
-#define FIFOEnableABIT(0)
-#define FIFOEnableBBIT(1)
-#define FIFOEnableCBIT(2)
-#define FIFOEnableDBIT(3)
-#define Funneling(x)   (((x) & 3) << 4)
-#define GroupDirection BIT(7)
-
-#define Protocol_Register_165
-#define OpMode Protocol_Register_1
-#define RunMode(x) ((x) & 7)
-#define Numbered   BIT(3)
-
-#define Protocol_Register_266
-#define ClockReg   Protocol_Register_2
-#define ClockLine(x)   (((x) & 3) << 5)
-#define InvertStopTrig BIT(7)
-#define DataLatching(x)   (((x) & 3) << 5)
-
-#define

[PATCH 1/2] comedi/ni_pcidio: remove unused defines

2018-12-11 Thread Alexander Schroth
Define-statements, which are not used within the file, are being removed
as they add clutter to the code.
Because the file is not being included from anywhere else, this has no
negative side-effects.

Signed-off-by: Alexander Schroth 
Signed-off-by: Marco Ammon 
---
 drivers/staging/comedi/drivers/ni_pcidio.c | 56 --
 1 file changed, 56 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index b9a0dc6eac44..91ffcfb45f55 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -49,22 +49,12 @@
 
 /* defines for the PCI-DIO-32HS */
 
-#define Window_Address 4   /* W */
 #define Interrupt_And_Window_Status4   /* R */
-#define IntStatus1 BIT(0)
-#define IntStatus2 BIT(1)
-#define WindowAddressStatus_mask   0x7c
 
 #define Master_DMA_And_Interrupt_Control 5 /* W */
-#define InterruptLine(x)   ((x) & 3)
-#define OpenIntBIT(2)
-#define Group_Status   5   /* R */
 #define DataLeft   BIT(0)
-#define ReqBIT(2)
-#define StopTrig   BIT(3)
 
 #define Group_1_Flags  6   /* R */
-#define Group_2_Flags  7   /* R */
 #define TransferReady  BIT(0)
 #define CountExpired   BIT(1)
 #define Waited BIT(5)
@@ -75,43 +65,22 @@
   /* #define Paused */
 
 #define Group_1_First_Clear6   /* W */
-#define Group_2_First_Clear7   /* W */
 #define ClearWaitedBIT(3)
 #define ClearPrimaryTC BIT(4)
 #define ClearSecondaryTC   BIT(5)
-#define DMAReset   BIT(6)
-#define FIFOReset  BIT(7)
-#define ClearAll   0xf8
 
 #define Group_1_FIFO   8   /* W */
-#define Group_2_FIFO   12  /* W */
 
 #define Transfer_Count 20
-#define Chip_ID_D  24
-#define Chip_ID_I  25
-#define Chip_ID_O  26
 #define Chip_Version   27
 #define Port_IO(x) (28 + (x))
 #define Port_Pin_Directions(x) (32 + (x))
 #define Port_Pin_Mask(x)   (36 + (x))
-#define Port_Pin_Polarities(x) (40 + (x))
-
-#define Master_Clock_Routing   45
-#define RTSIClocking(x)(((x) & 3) << 4)
 
 #define Group_1_Second_Clear   46  /* W */
-#define Group_2_Second_Clear   47  /* W */
 #define ClearExpired   BIT(0)
 
-#define Port_Pattern(x)(48 + (x))
-
 #define Data_Path  64
-#define FIFOEnableABIT(0)
-#define FIFOEnableBBIT(1)
-#define FIFOEnableCBIT(2)
-#define FIFOEnableDBIT(3)
-#define Funneling(x)   (((x) & 3) << 4)
-#define GroupDirection BIT(7)
 
 #define Protocol_Register_165
 #define OpMode Protocol_Register_1
@@ -120,8 +89,6 @@
 
 #define Protocol_Register_266
 #define ClockReg   Protocol_Register_2
-#define ClockLine(x)   (((x) & 3) << 5)
-#define InvertStopTrig BIT(7)
 #define DataLatching(x)   (((x) & 3) << 5)
 
 #define Protocol_Register_367
@@ -132,27 +99,15 @@
 
 #define Protocol_Register_470
 #define ReqReg Protocol_Register_4
-#define ReqConditioning(x) (((x) & 7) << 3)
 
 #define Protocol_Register_571
 #define BlockMode  Protocol_Register_5
 
-#define FIFO_Control   72
-#define ReadyLevel(x)  ((x) & 7)
-
 #define Protocol_Register_673
 #define LinePolarities Protocol_Register_6
-#define InvertAck  BIT(0)
-#define InvertReq  BIT(1)
-#define InvertClockBIT(2)
-#define InvertSerial   BIT(3)
-#define OpenAckBIT(4)
-#define OpenClock  BIT(5)
 
 #define Protocol_Register_774
 #define AckSer Protocol_Register_7
-#define AckLine(x) (((x) & 3) << 2)
-#define ExchangePins   BIT(7)
 
 #define Interrupt_Control  75
   /* bits same as flags */
@@ -173,20 +128,9 @@ static inline unsigned int 
secondary_DMAChannel_bits(unsigned int channel)
 #define Transfer_Size_Control  77
 #define TransferWidth(x)   ((x) & 3)
 #define TransferLength(x)  (((x) & 3) << 3)
-#define RequireRLeve

[PATCH 2/2] comedi/ni_pcidio: make all defines uppercase

2018-12-11 Thread Alexander Schroth
According to the Linux coding guidelines, defines should be written
in uppercase. This patch converts all define-statements in the
ni_pcidio.c file to uppercase, thus matching the coding style of the
kernel.

Signed-off-by: Alexander Schroth 
Signed-off-by: Marco Ammon 
---
 drivers/staging/comedi/drivers/ni_pcidio.c | 306 +++--
 1 file changed, 154 insertions(+), 152 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index 91ffcfb45f55..350b32643a50 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -49,71 +49,72 @@
 
 /* defines for the PCI-DIO-32HS */
 
-#define Interrupt_And_Window_Status4   /* R */
+#define INTERRUPT_AND_WINDOW_STATUS4   /* R */
 
-#define Master_DMA_And_Interrupt_Control 5 /* W */
-#define DataLeft   BIT(0)
+#define MASTER_DMA_AND_INTERRUPT_CONTROL 5 /* W */
+#define DATA_LEFT  BIT(0)
 
-#define Group_1_Flags  6   /* R */
-#define TransferReady  BIT(0)
-#define CountExpired   BIT(1)
-#define Waited BIT(5)
-#define PrimaryTC  BIT(6)
-#define SecondaryTCBIT(7)
+#define GROUP_1_FLAGS  6   /* R */
+#define TRANSFER_READY BIT(0)
+#define COUNT_EXPIRED  BIT(1)
+#define WAITED BIT(5)
+#define PRIMARY_TC BIT(6)
+#define SECONDARY_TC   BIT(7)
   /* #define SerialRose */
   /* #define ReqRose */
   /* #define Paused */
 
-#define Group_1_First_Clear6   /* W */
-#define ClearWaitedBIT(3)
-#define ClearPrimaryTC BIT(4)
-#define ClearSecondaryTC   BIT(5)
+#define GROUP_1_FIRST_CLEAR6   /* W */
+#define CLEAR_WAITED   BIT(3)
+#define CLEAR_PRIMARY_TC   BIT(4)
+#define CLEAR_SECONDARY_TC BIT(5)
 
-#define Group_1_FIFO   8   /* W */
+#define GROUP_1_FIFO   8   /* W */
 
-#define Transfer_Count 20
-#define Chip_Version   27
-#define Port_IO(x) (28 + (x))
-#define Port_Pin_Directions(x) (32 + (x))
-#define Port_Pin_Mask(x)   (36 + (x))
+#define TRANSFER_COUNT 20
+#define CHIP_VERSION   27
+#define PORT_IO(x) (28 + (x))
+#define PORT_PIN_DIRECTIONS(x) (32 + (x))
+#define PORT_PIN_MASK(x)   (36 + (x))
 
-#define Group_1_Second_Clear   46  /* W */
-#define ClearExpired   BIT(0)
+#define GROUP_1_SECOND_CLEAR   46  /* W */
+#define CLEAR_EXPIRED  BIT(0)
 
-#define Data_Path  64
+#define DATA_PATH  64
 
-#define Protocol_Register_165
-#define OpMode Protocol_Register_1
-#define RunMode(x) ((x) & 7)
-#define Numbered   BIT(3)
+#define PROTOCOL_REGISTER_165
+#define OP_MODEPROTOCOL_REGISTER_1
+#define RUN_MODE(x)((x) & 7)
+#define NUMBERED   BIT(3)
 
-#define Protocol_Register_266
-#define ClockReg   Protocol_Register_2
-#define DataLatching(x)   (((x) & 3) << 5)
+#define PROTOCOL_REGISTER_266
+#define CLOCK_REG  PROTOCOL_REGISTER_2
+#define DATA_LATCHING(x)   (((x) & 3) << 5)
 
-#define Protocol_Register_367
-#define Sequence   Protocol_Register_3
+#define PROTOCOL_REGISTER_367
+#define SEQUENCE   PROTOCOL_REGISTER_3
 
-#define Protocol_Register_14   68  /* 16 bit */
-#define ClockSpeed Protocol_Register_14
+#define PROTOCOL_REGISTER_14   68  /* 16 bit */
+#define CLOCK_SPEEDPROTOCOL_REGISTER_14
 
-#define Protocol_Register_470
-#define ReqReg Protocol_Register_4
+#define PROTOCOL_REGISTER_470
+#define REQ_REGPROTOCOL_REGISTER_4
 
-#define Protocol_Register_571
-#define BlockMode  Protocol_Register_5
+#define PROTOCOL_REGISTER_571
+#define BLOCK_MODE PROTOCOL_REGISTER_5
 
-#define Protocol_Register_673
-#define LinePolarities Protocol_Register_6
+#define PROTOCOL_REGISTER_673
+#define LINE_POLARITIESPROTOCOL_REGISTER_6
 
-#define Protocol_Register_774
-#define AckSer 

[no subject]

2018-12-11 Thread Alexander Schroth
This patch series improves the conformance of comedi/drivers/ni_pcidio.c
to the Linux coding guidelines. It focuses on the usage of #define and
is based on the next-20181207 tag.

Signed-off-by: Alexander Schroth 
Signed-off-by: Marco Ammon 


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel