comedi: checkpatch errors/warnings
The following patch-series will fix checkpatch errors and warnings which are caused by false spacing and missing blank lines.
It will fix those errors/warnings in drivers/staging/comedi/ and all its subdirectories. The fixed errors/warnings are:
WARNING: Missing a blank line after declarations 5 times
ERROR: trailing whitespace once
ERROR: space prohibited before that ',' (ctx:WxW) once
WARNING: please, no space before tabs 8 times
ERROR: code indent should use tabs where possible 44 times
After applying the series the following checkpatch errors/warnings will remain in files in drivers/staging/comedi/ and its subdirectories:
WARNING: line over 80 characters
WARNING: quoted string split across lines
WARNING: break quoted strings at a space character
WARNING: memory barrier without comment
WARNING: suspect code indent for conditional statements (x, y)
WARNING: Use of volatile is usually wrong
PATCH 1/3 comedi: checkpatch error: tabs instead of spaces
This patch fixes all occurrences of 8 whitespaces instead of a tab. It will remove the 8 whitespaces and replace them with a tab, thereby the checkpatch-error:
ERROR: code indent should use tabs where possible
is removed from all files in drivers/staging/comedi/
It also brings some consistency of indentation in the comments.
--- drivers/staging/comedi/drivers/daqboard2000.c | 62 +++++++++++++-------------- drivers/staging/comedi/drivers/das16m1.c | 4 +- drivers/staging/comedi/drivers/dmm32at.c | 2 +- drivers/staging/comedi/drivers/pcl818.c | 36 ++++++++-------- 4 files changed, 52 insertions(+), 52 deletions(-)
drivers/staging/comedi/drivers/daqboard2000.c +31 -31
@@ -43,7 +43,7 @@ Configuration options: not applicable, uses PCI auto config available from http://www.plxtech.com/products/io/pci9080 2. The initialization done so far is: - a. program the FPGA (windows code sans a lot of error messages) + a. program the FPGA (windows code sans a lot of error messages) b. 3. Analog out seems to work OK with DAC's disabled, if DAC's are enabled,
@@ -52,52 +52,52 @@ Configuration options: not applicable, uses PCI auto configgives me no clues. I'll keep it simple so far. 4. Analog in. -Each channel in the scanlist seems to be controlled by four +Each channel in the scanlist seems to be controlled by four control words: -Word0: -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -! | | | ! | | | ! | | | ! | | | ! -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +Word0: ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +! | | | ! | | | ! | | | ! | | | ! ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -Word1: -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -! | | | ! | | | ! | | | ! | | | ! -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +Word1: ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +! | | | ! | | | ! | | | ! | | | ! ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | | | | | -+------+------+ | | | | +-- Digital input (??) ++------+------+ | | | | +-- Digital input (??) | | | | +---- 10 us settling time | | | +------ Suspend acquisition (last to scan) | | +-------- Simultaneous sample and hold | +---------- Signed data format +------------------------- Correction offset low -Word2: -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -! | | | ! | | | ! | | | ! | | | ! -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| | | | | | | | | | -+-----+ +--+--+ +++ +++ +--+--+ -| | | | +----- Expansion channel +Word2: ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +! | | | ! | | | ! | | | ! | | | ! ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| | | | | | | | | | ++-----+ +--+--+ +++ +++ +--+--+ +| | | | +----- Expansion channel | | | +----------- Expansion gain -| | +--------------- Channel (low) +| | +--------------- Channel (low) | +--------------------- Correction offset high +----------------------------- Correction gain low -Word3: -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -! | | | ! | | | ! | | | ! | | | ! -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| | | | | | | | | -+------+------+ | | +-+-+ | | +-- Low bank enable -| | | | | +---- High bank enable -| | | | +------ Hi/low select -| | | +---------- Gain (1,?,2,4,8,16,32,64) -| | +-------------- differential/single ended -| +---------------- Unipolar +Word3: ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +! | | | ! | | | ! | | | ! | | | ! ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| | | | | | | | | ++------+------+ | | +-+-+ | | +-- Low bank enable +| | | | | +---- High bank enable +| | | | +------ Hi/low select +| | | +---------- Gain (1,?,2,4,8,16,32,64) +| | +-------------- differential/single ended +| +---------------- Unipolar +------------------------- Correction gain high 999. The card seems to have an incredible amount of capabilities, but -trying to reverse engineer them from the Windows source is beyond my +trying to reverse engineer them from the Windows source is beyond my patience. */
drivers/staging/comedi/drivers/das16m1.c +2 -2
@@ -46,8 +46,8 @@ list has 2 or more channels in it, then two conditions must be satisfied:(2) - the list must have an even number of entries. Options: -[0] - base io address -[1] - irq (optional, but you probably want it) +[0] - base io address +[1] - irq (optional, but you probably want it) irq can be omitted, although the cmd interface will not work without it. */
drivers/staging/comedi/drivers/dmm32at.c +1 -1
@@ -365,7 +365,7 @@ static void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec)/* enable the ai conversion interrupt and the clock to start scans */ outb (DMM32AT_INTCLK_ADINT |DMM32AT_INTCLK_CLKEN |DMM32AT_INTCLK_CLKSEL , - dev->iobase +DMM32AT_INTCLK_REG ); + dev->iobase +DMM32AT_INTCLK_REG ); }static int dmm32at_ai_cmd (struct comedi_device *dev,struct comedi_subdevice *s)
drivers/staging/comedi/drivers/pcl818.c +18 -18
@@ -45,11 +45,11 @@ A word or two about DMA. Driver support DMA operations at two ways: [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7) [2] - DMA (0=disable, 1, 3) [3] - 0, 10=10MHz clock for 8254 - 1= 1MHz clock for 8254 + 1= 1MHz clock for 8254 [4] - 0, 5=A/D input -5V.. +5V - 1, 10=A/D input -10V..+10V + 1, 10=A/D input -10V..+10V [5] - 0, 5=D/A output 0-5V (internal reference -5V) - 1, 10=D/A output 0-10V (internal reference -10V) + 1, 10=D/A output 0-10V (internal reference -10V) 2 =D/A output unknown (external reference) Options for PCL-818, PCL-818H:
@@ -57,44 +57,44 @@ A word or two about DMA. Driver support DMA operations at two ways:[1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7) [2] - DMA (0=disable, 1, 3) [3] - 0, 10=10MHz clock for 8254 -1= 1MHz clock for 8254 +1= 1MHz clock for 8254 [4] - 0, 5=D/A output 0-5V (internal reference -5V) -1, 10=D/A output 0-10V (internal reference -10V) +1, 10=D/A output 0-10V (internal reference -10V) 2 =D/A output unknown (external reference) Options for PCL-818HD, PCL-818HG: [0] - IO Base [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7) [2] - DMA/FIFO (-1=use FIFO, 0=disable both FIFO and DMA, -1=use DMA ch 1, 3=use DMA ch 3) +1=use DMA ch 1, 3=use DMA ch 3) [3] - 0, 10=10MHz clock for 8254 -1= 1MHz clock for 8254 +1= 1MHz clock for 8254 [4] - 0, 5=D/A output 0-5V (internal reference -5V) -1, 10=D/A output 0-10V (internal reference -10V) -2 =D/A output unknown (external reference) +1, 10=D/A output 0-10V (internal reference -10V) +2 =D/A output unknown (external reference) Options for PCL-718: [0] - IO Base [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7) [2] - DMA (0=disable, 1, 3) [3] - 0, 10=10MHz clock for 8254 -1= 1MHz clock for 8254 +1= 1MHz clock for 8254 [4] - 0=A/D Range is +/-10V -1= +/-5V -2= +/-2.5V -3= +/-1V -4= +/-0.5V -5= user defined bipolar +1= +/-5V +2= +/-2.5V +3= +/-1V +4= +/-0.5V +5= user defined bipolar 6= 0-10V 7= 0-5V -8= 0-2V +8= 0-2V 9= 0-1V 10= user defined unipolar [5] - 0, 5=D/A outputs 0-5V (internal reference -5V) -1, 10=D/A outputs 0-10V (internal reference -10V) +1, 10=D/A outputs 0-10V (internal reference -10V) 2=D/A outputs unknown (external reference) [6] - 0, 60=max 60kHz A/D sampling -1,100=max 100kHz A/D sampling (PCL-718 with Option 001 installed) +1,100=max 100kHz A/D sampling (PCL-718 with Option 001 installed) */
Signature · 1 line
1.9.1
Re: [PATCH 1/3] comedi: checkpatch error: tabs instead of spaces
Quoted 7 lines · Andreas Siegling
This patch fixes all occurrences of 8 whitespaces instead of a tab. It will remove the 8 whitespaces and replace them with a tab, thereby the checkpatch-error:
ERROR: code indent should use tabs where possible
is removed from all files indrivers/staging/comedi/
It also brings some consistency of indentation in the comments.
Quoted 8 lines
Signed-off-by Andreas Siegling <[email protected]>Signed-off-by Zhutao Lu <[email protected]>--- drivers/staging/comedi/drivers/daqboard2000.c | 62 +++++++++++++-------------- drivers/staging/comedi/drivers/das16m1.c | 4 +- drivers/staging/comedi/drivers/dmm32at.c | 2 +- drivers/staging/comedi/drivers/pcl818.c | 36 ++++++++-------- 4 files changed, 52 insertions(+), 52 deletions(-)
Most of these aren't worth doing as they only affect multi-line comments that should be reformatted to the usual block comment style anyway.
drivers/staging/comedi/drivers/dmm32at.c static void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec) · line 370
Quoted 12 lines
drivers/staging/comedi/drivers/dmm32at.c +1
-1@@ -365,7 +365,7 @@ static void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec)/* enable the ai conversion interrupt and the clock to start scans */ outb (DMM32AT_INTCLK_ADINT |DMM32AT_INTCLK_CLKEN |DMM32AT_INTCLK_CLKSEL , - dev->iobase +DMM32AT_INTCLK_REG ); + dev->iobase +DMM32AT_INTCLK_REG ); }
That bit of the patch is fine, but has already been tackled in a patch by David Decotigny.
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Web: http://www.mev.co.uk/ )=-
PATCH 2/3 comedi: checkpatch error/warning: spaces
In reply to Andreas SieglingThis patch will fix the following checkpatch errors/warnings in drivers/staging/comedi/ which are brought by wrong spacing:
ERROR: trailing whitespace
ERROR: space prohibited before that ',' (ctx:WxW)
WARNING: please, no space before tabs
--- drivers/staging/comedi/drivers/daqboard2000.c | 2 +- drivers/staging/comedi/drivers/das16m1.c | 2 +- drivers/staging/comedi/drivers/ni_at_a2150.c | 2 +- drivers/staging/comedi/drivers/ni_stc.h | 4 ++-- drivers/staging/comedi/drivers/s626.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/comedi/drivers/daqboard2000.c +1 -1
@@ -40,7 +40,7 @@ Configuration options: not applicable, uses PCI auto config for the card, and here are the findings so far. 1. A good document that describes the PCI interface chip is 9080db-106.pdf - available from http://www.plxtech.com/products/io/pci9080 + available from http://www.plxtech.com/products/io/pci9080 2. The initialization done so far is: a. program the FPGA (windows code sans a lot of error messages)
drivers/staging/comedi/drivers/das16m1.c +1 -1
@@ -80,7 +80,7 @@ irq can be omitted, although the cmd interface will not work without it.89ab 8254 cdef 8254 400 8255 -404-407 8254 +404-407 8254 */
drivers/staging/comedi/drivers/ni_at_a2150.c +1 -1
@@ -108,7 +108,7 @@ TRIG_WAKE_EOS#define IRQ_LVL_BITS (x) (((x) & 0xf) << 4)/* sets irq level */ #define FIFO_INTR_EN_BIT 0x100/* enable fifo interrupts */ #define FIFO_INTR_FHF_BIT 0x200/* interrupt fifo half full */ -#define DMA_INTR_EN_BIT 0x800/* enable interrupt on dma terminal count */ +#define DMA_INTR_EN_BIT 0x800/* enable interrupt on dma terminal count */ #define DMA_DEM_EN_BIT 0x1000/* enables demand mode dma */ #define I8253_BASE_REG 0x14#define I8253_MODE_REG 0x17
drivers/staging/comedi/drivers/ni_stc.h +2 -2
@@ -166,7 +166,7 @@ enum Interrupt_B_Ack_Bits {#define AI_SCAN_IN_PROG_Pulse _bit4#define AI_EXTMUX_CLK_Pulse _bit3#define AI_LOCALMUX_CLK_Pulse _bit2 -#define AI_SC_TC_Pulse _bit1 +#define AI_SC_TC_Pulse _bit1#define AI_CONVERT_Pulse _bit0#define AO_Command_1_Register 9
@@ -642,7 +642,7 @@ static unsigned AO_UPDATE_Output_Select(enum ao_update_output_selection#define G_Load_Source_Select _bit7#define G_Reload_Source_Switching _bit15#define G_Loading_On_Gate _bit14 -#define G_Gate_Polarity _bit13 +#define G_Gate_Polarity _bit13#define G_Counting_Once (a) (((a)&0x03)<<10)#define G_Stop_Mode (a) (((a)&0x03)<<5)
drivers/staging/comedi/drivers/s626.c +1 -1
@@ -118,7 +118,7 @@ static void s626_mc_enable(struct comedi_device *dev,static void s626_mc_disable (struct comedi_device *dev,unsigned int cmd,unsigned int reg) { -writel (cmd <<16 , dev->mmio + reg); +writel (cmd <<16 , dev->mmio + reg);mmiowb (); }
Signature · 1 line
1.9.1
Re: [PATCH 2/3] comedi: checkpatch error/warning: spaces
Quoted 8 lines · Andreas Siegling
This patch will fix the following checkpatch errors/warnings in
drivers/staging/comedi/which are brought by wrong spacing:
ERROR: trailing whitespace
ERROR: space prohibited before that ',' (ctx:WxW)
WARNING: please, no space before tabsSigned-off-by Andreas Siegling <[email protected]>Signed-off-by Zhutao Lu <[email protected]>
Quoted 7 lines
--- drivers/staging/comedi/drivers/daqboard2000.c | 2 +- drivers/staging/comedi/drivers/das16m1.c | 2 +- drivers/staging/comedi/drivers/ni_at_a2150.c | 2 +- drivers/staging/comedi/drivers/ni_stc.h | 4 ++-- drivers/staging/comedi/drivers/s626.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
Those should really be split into separate patches, but as for your PATCH 1/3 it's not worth fixing up the comments this way as they need reformatting anyway.
Quoted 27 lines
drivers/staging/comedi/drivers/ni_at_a2150.c +1
-1@@ -108,7 +108,7 @@ TRIG_WAKE_EOS#define IRQ_LVL_BITS (x) (((x) & 0xf) << 4)/* sets irq level */ #define FIFO_INTR_EN_BIT 0x100/* enable fifo interrupts */ #define FIFO_INTR_FHF_BIT 0x200/* interrupt fifo half full */ -#define DMA_INTR_EN_BIT 0x800/* enable interrupt on dma terminal count */ +#define DMA_INTR_EN_BIT 0x800/* enable interrupt on dma terminal count */ #define DMA_DEM_EN_BIT 0x1000/* enables demand mode dma */ #define I8253_BASE_REG 0x14#define I8253_MODE_REG 0x17drivers/staging/comedi/drivers/ni_stc.h +1
-1@@ -166,7 +166,7 @@ enum Interrupt_B_Ack_Bits {#define AI_SCAN_IN_PROG_Pulse _bit4#define AI_EXTMUX_CLK_Pulse _bit3#define AI_LOCALMUX_CLK_Pulse _bit2 -#define AI_SC_TC_Pulse _bit1 +#define AI_SC_TC_Pulse _bit1#define AI_CONVERT_Pulse _bit0#define AO_Command_1_Register 9
drivers/staging/comedi/drivers/ni_stc.h static unsigned AO_UPDATE_Output_Select(enum ao_update_output_selection · line 648
Quoted 8 lines
drivers/staging/comedi/drivers/ni_stc.h +1
-1@@ -642,7 +642,7 @@ static unsigned AO_UPDATE_Output_Select(enum ao_update_output_selection#define G_Load_Source_Select _bit7#define G_Reload_Source_Switching _bit15#define G_Loading_On_Gate _bit14 -#define G_Gate_Polarity _bit13 +#define G_Gate_Polarity _bit13#define G_Counting_Once (a) (((a)&0x03)<<10)#define G_Stop_Mode (a) (((a)&0x03)<<5)
Those parts of the patch are okay.
drivers/staging/comedi/drivers/s626.c static void s626_mc_enable(struct comedi_device *dev, · line 123
Quoted 12 lines
drivers/staging/comedi/drivers/s626.c +1
-1@@ -118,7 +118,7 @@ static void s626_mc_enable(struct comedi_device *dev,static void s626_mc_disable (struct comedi_device *dev,unsigned int cmd,unsigned int reg) { -writel (cmd <<16 , dev->mmio + reg); +writel (cmd <<16 , dev->mmio + reg);mmiowb (); }
That part of the patch has also been tackled in a separate patch by jitendra kumar khasdev. Your patch predates it, but jitendra's patch is split better.
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Web: http://www.mev.co.uk/ )=-
PATCH 3/3 comedi: checkpatch warning: missing blank line
In reply to Andreas SieglingThis patch will fix all occurrences of the checkpatch warning:
WARNING: Missing a blank line after declarations
in drivers/staging/comedi/.
--- drivers/staging/comedi/drivers/comedi_bond.c | 1 + drivers/staging/comedi/drivers/ni_stc.h | 4 ++++ 2 files changed, 5 insertions(+)
drivers/staging/comedi/drivers/comedi_bond.c +1 -0
@@ -261,6 +261,7 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it) {/* Append dev:subdev to devpriv->name */ char buf[20 ]; +snprintf (buf,sizeof (buf),"%u:%u " , bdev->minor, bdev->subdev); strlcat(devpriv->name, buf,
drivers/staging/comedi/drivers/ni_stc.h +4 -0
@@ -326,6 +326,7 @@ static inline unsigned RTSI_Output_Bit(unsigned channel, int is_mseries) {unsigned max_channel;unsigned base_bit_shift; +if (is_mseries) { base_bit_shift =8 ; max_channel =7 ;
@@ -1142,6 +1143,7 @@ static inline unsigned MSeries_AI_Config_Bank_Bits(enum ni_reg_type reg_type, unsigned channel) {unsigned bits = channel &0x30 ; +if (reg_type == ni_reg_622x) {if (channel &0x40 ) bits |=0x400 ;
@@ -1191,6 +1193,7 @@ enum MSeries_PLL_Control_Bits {static inline unsigned MSeries_PLL_Divisor_Bits (unsigned divisor) {static const unsigned max_divisor =0x10 ; +if (divisor <1 || divisor > max_divisor) {pr_err ("%s: bug, invalid divisor=%i\n" , __func__, divisor);return 0 ;
@@ -1201,6 +1204,7 @@ static inline unsigned MSeries_PLL_Divisor_Bits(unsigned divisor)static inline unsigned MSeries_PLL_Multiplier_Bits (unsigned multiplier) {static const unsigned max_multiplier =0x100 ; +if (multiplier <1 || multiplier > max_multiplier) {pr_err ("%s: bug, invalid multiplier=%i\n" , __func__, multiplier);
Signature · 1 line
1.9.1
Re: [PATCH 3/3] comedi: checkpatch warning: missing blank line
Quoted 53 lines · Andreas Siegling
This patch will fix all occurrences of the checkpatch warning:
WARNING: Missing a blank line after declarations
indrivers/staging/comedi/.Signed-off-by Andreas Siegling <[email protected]>Signed-off-by Zhutao Lu <[email protected]>--- drivers/staging/comedi/drivers/comedi_bond.c | 1 + drivers/staging/comedi/drivers/ni_stc.h | 4 ++++ 2 files changed, 5 insertions(+)drivers/staging/comedi/drivers/comedi_bond.c +1
-0@@ -261,6 +261,7 @@ static int do_dev_config(struct comedi_device *dev, struct comedi_devconfig *it) {/* Append dev:subdev to devpriv->name */ char buf[20 ]; +snprintf (buf,sizeof (buf),"%u:%u " , bdev->minor, bdev->subdev); strlcat(devpriv->name, buf,drivers/staging/comedi/drivers/ni_stc.h +3
-0@@ -326,6 +326,7 @@ static inline unsigned RTSI_Output_Bit(unsigned channel, int is_mseries) {unsigned max_channel;unsigned base_bit_shift; +if (is_mseries) { base_bit_shift =8 ; max_channel =7 ;@@ -1142,6 +1143,7 @@ static inline unsigned MSeries_AI_Config_Bank_Bits(enum ni_reg_type reg_type, unsigned channel) {unsigned bits = channel &0x30 ; +if (reg_type == ni_reg_622x) {if (channel &0x40 ) bits |=0x400 ;@@ -1191,6 +1193,7 @@ enum MSeries_PLL_Control_Bits {static inline unsigned MSeries_PLL_Divisor_Bits (unsigned divisor) {static const unsigned max_divisor =0x10 ; +if (divisor <1 || divisor > max_divisor) {pr_err ("%s: bug, invalid divisor=%i\n" , __func__, divisor);return 0 ;
drivers/staging/comedi/drivers/ni_stc.h static inline unsigned MSeries_PLL_Divisor_Bits(unsigned divisor) · line 1210
Quoted 7 lines
drivers/staging/comedi/drivers/ni_stc.h +1
-0@@ -1201,6 +1204,7 @@ static inline unsigned MSeries_PLL_Divisor_Bits(unsigned divisor)static inline unsigned MSeries_PLL_Multiplier_Bits (unsigned multiplier) {static const unsigned max_multiplier =0x100 ; +if (multiplier <1 || multiplier > max_multiplier) {pr_err ("%s: bug, invalid multiplier=%i\n" , __func__, multiplier);
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Web: http://www.mev.co.uk/ )=-