staging: sm750fb: multiple checkpatch issues
cover staging: sm750fb: multiple checkpatch issues
Improve readability by fixing multiple checkpatch.pl issues in sm750fb driver.
Arushi Singhal (3):
staging: sm750fb: function prototype argument should have an
identifier name
staging: sm750fb: fixes add blank line after
function/struct/union/enum declarations
staging: sm750fb: Alignment should match open parenthesis
drivers/staging/sm750fb/ddk750_display.h | 2 +- drivers/staging/sm750fb/ddk750_mode.c | 79 ++++++++++++++++---------------- drivers/staging/sm750fb/ddk750_mode.h | 2 +- drivers/staging/sm750fb/ddk750_power.h | 2 +- drivers/staging/sm750fb/sm750.h | 2 +- drivers/staging/sm750fb/sm750_cursor.c | 3 ++ 6 files changed, 46 insertions(+), 44 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/3 staging: sm750fb: function prototype argument should have an identifier name
function prototype arguments like 'struct vb_device_info *','unsigned long' etc. should have an identifier name.
--- drivers/staging/sm750fb/ddk750_display.h | 2 +- drivers/staging/sm750fb/ddk750_mode.h | 2 +- drivers/staging/sm750fb/ddk750_power.h | 2 +- drivers/staging/sm750fb/sm750.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/sm750fb/ddk750_display.h +1 -1
@@ -102,6 +102,6 @@ typedef enum _disp_output_t { } disp_output_t; -void ddk750_setLogicalDispOut (disp_output_t ); +void ddk750_setLogicalDispOut (disp_output_t output);#endif
drivers/staging/sm750fb/ddk750_mode.h +1 -1
@@ -34,6 +34,6 @@ typedef struct _mode_parameter_t { } mode_parameter_t; -int ddk750_setModeTiming (mode_parameter_t *,clock_type_t ); +int ddk750_setModeTiming (mode_parameter_t *parm,clock_type_t clock);#endif
drivers/staging/sm750fb/ddk750_power.h +1 -1
@@ -14,7 +14,7 @@ DPMS_t; (peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) | (off)); \ } -void ddk750_set_dpms (DPMS_t ); +void ddk750_set_dpms (DPMS_t state);void sm750_set_power_mode (unsigned int powerMode);void sm750_set_current_gate (unsigned int gate);
drivers/staging/sm750fb/sm750.h +1 -1
@@ -184,7 +184,7 @@ static inline unsigned long ps_to_hz(unsigned int psvalue) }int hw_sm750_map (struct sm750_dev *sm750_dev,struct pci_dev *pdev); -int hw_sm750_inithw (struct sm750_dev *,struct pci_dev *); +int hw_sm750_inithw (struct sm750_dev *sm750_dev,struct pci_dev *pdev);void hw_sm750_initAccel (struct sm750_dev *);int hw_sm750_deWait (void );int hw_sm750le_deWait (void );
Signature · 1 line
2.11.0
Re: [Outreachy kernel] [PATCH 1/3] staging: sm750fb: function prototype argument should have an identifier name
Quoted 28 lines · Arushi Singhal
function prototype arguments like 'struct
vb_device_info*','unsigned long' etc. should have an identifier name.Signed-off-by Arushi Singhal <[email protected]>--- drivers/staging/sm750fb/ddk750_display.h | 2 +- drivers/staging/sm750fb/ddk750_mode.h | 2 +- drivers/staging/sm750fb/ddk750_power.h | 2 +- drivers/staging/sm750fb/sm750.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)drivers/staging/sm750fb/ddk750_display.h +1
-1@@ -102,6 +102,6 @@ typedef enum _disp_output_t { } disp_output_t; -void ddk750_setLogicalDispOut (disp_output_t ); +void ddk750_setLogicalDispOut (disp_output_t output);#endif drivers/staging/sm750fb/ddk750_mode.h +0
-0
drivers/staging/sm750fb/ddk750_mode.h typedef struct _mode_parameter_t { · line 37
Quoted 5 lines
drivers/staging/sm750fb/ddk750_mode.h +1
-1@@ -34,6 +34,6 @@ typedef struct _mode_parameter_t { } mode_parameter_t; -int ddk750_setModeTiming (mode_parameter_t *,clock_type_t ); +int ddk750_setModeTiming (mode_parameter_t *parm,clock_type_t clock);
There are typedefs here that you could get rid of in a future patch.
Quoted 20 lines
drivers/staging/sm750fb/ddk750_mode.h +0
-0#endif drivers/staging/sm750fb/ddk750_power.h +1
-1@@ -14,7 +14,7 @@ DPMS_t; (peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) | (off)); \ } -void ddk750_set_dpms (DPMS_t ); +void ddk750_set_dpms (DPMS_t state);void sm750_set_power_mode (unsigned int powerMode);void sm750_set_current_gate (unsigned int gate);drivers/staging/sm750fb/sm750.h +0
-0
drivers/staging/sm750fb/sm750.h static inline unsigned long ps_to_hz(unsigned int psvalue) · line 188
Quoted 6 lines
drivers/staging/sm750fb/sm750.h +1
-1@@ -184,7 +184,7 @@ static inline unsigned long ps_to_hz(unsigned int psvalue) }int hw_sm750_map (struct sm750_dev *sm750_dev,struct pci_dev *pdev); -int hw_sm750_inithw (struct sm750_dev *,struct pci_dev *); +int hw_sm750_inithw (struct sm750_dev *sm750_dev,struct pci_dev *pdev);void hw_sm750_initAccel (struct sm750_dev *);
This prototype should be updated too.
julia
Quoted 12 lines
drivers/staging/sm750fb/sm750.h +0
-1int hw_sm750_deWait (void );int hw_sm750le_deWait (void ); --2.11.0
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170311032410.8265-2-arushisinghal19971997%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
PATCH 2/3 staging: sm750fb: fixes add blank line after function/struct/union/enum declarations
In reply to Arushi SinghalThis patch fixes the warnings reported by checkpatch.pl for please use a blank line after function/struct/union/enum declarations.
--- drivers/staging/sm750fb/sm750_cursor.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/sm750fb/sm750_cursor.c +3 -0
@@ -54,6 +54,7 @@ void sm750_hw_cursor_enable(struct lynx_cursor *cursor) reg = (cursor->offset &HWC_ADDRESS_ADDRESS_MASK ) |HWC_ADDRESS_ENABLE ;poke32 (HWC_ADDRESS , reg); } +void sm750_hw_cursor_disable (struct lynx_cursor *cursor) {poke32 (HWC_ADDRESS ,0 );
@@ -65,6 +66,7 @@ void sm750_hw_cursor_setSize(struct lynx_cursor *cursor, cursor->w = w; cursor->h = h; } +void sm750_hw_cursor_setPos (struct lynx_cursor *cursor,int x,int y) {
@@ -74,6 +76,7 @@ void sm750_hw_cursor_setPos(struct lynx_cursor *cursor, (x &HWC_LOCATION_X_MASK );poke32 (HWC_LOCATION , reg); } +void sm750_hw_cursor_setColor (struct lynx_cursor *cursor,u32 fg,u32 bg) {
Signature · 1 line
2.11.0
PATCH 3/3 staging: sm750fb: Alignment should match open parenthesis
In reply to Arushi SinghalFix checkpatch issues: "CHECK: Alignment should match open parenthesis".
--- drivers/staging/sm750fb/ddk750_mode.c | 79 +++++++++++++++++------------------ 1 file changed, 39 insertions(+), 40 deletions(-)
drivers/staging/sm750fb/ddk750_mode.c +39 -40
@@ -28,9 +28,9 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam,poke32 (CRT_AUTO_CENTERING_TL ,0 );poke32 (CRT_AUTO_CENTERING_BR , - (((y -1 ) <<CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT ) & -CRT_AUTO_CENTERING_BR_BOTTOM_MASK ) | - ((x -1 ) &CRT_AUTO_CENTERING_BR_RIGHT_MASK )); + (((y -1 ) <<CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT ) & +CRT_AUTO_CENTERING_BR_BOTTOM_MASK ) | + ((x -1 ) &CRT_AUTO_CENTERING_BR_RIGHT_MASK ));/* * Assume common fields in dispControl have been properly set before
@@ -72,8 +72,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, }/* only timing related registers will be programed */ -static int programModeRegisters (mode_parameter_t *pModeParam, -struct pll_value *pll) +static int programModeRegisters (mode_parameter_t *pModeParam,struct pll_value *pll) {int ret =0 ;int cnt =0 ;
@@ -83,32 +82,32 @@ static int programModeRegisters(mode_parameter_t *pModeParam,/* programe secondary pixel clock */ poke32 (CRT_PLL_CTRL ,sm750_format_pll_reg (pll));poke32 (CRT_HORIZONTAL_TOTAL , - (((pModeParam->horizontal_total -1 ) << -CRT_HORIZONTAL_TOTAL_TOTAL_SHIFT ) & -CRT_HORIZONTAL_TOTAL_TOTAL_MASK ) | - ((pModeParam->horizontal_display_end -1 ) & -CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK )); + (((pModeParam->horizontal_total -1 ) << +CRT_HORIZONTAL_TOTAL_TOTAL_SHIFT ) & +CRT_HORIZONTAL_TOTAL_TOTAL_MASK ) | + ((pModeParam->horizontal_display_end -1 ) & +CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK ));poke32 (CRT_HORIZONTAL_SYNC , - ((pModeParam->horizontal_sync_width << -CRT_HORIZONTAL_SYNC_WIDTH_SHIFT ) & -CRT_HORIZONTAL_SYNC_WIDTH_MASK ) | - ((pModeParam->horizontal_sync_start -1 ) & -CRT_HORIZONTAL_SYNC_START_MASK )); + ((pModeParam->horizontal_sync_width << +CRT_HORIZONTAL_SYNC_WIDTH_SHIFT ) & +CRT_HORIZONTAL_SYNC_WIDTH_MASK ) | + ((pModeParam->horizontal_sync_start -1 ) & +CRT_HORIZONTAL_SYNC_START_MASK ));poke32 (CRT_VERTICAL_TOTAL , - (((pModeParam->vertical_total -1 ) << -CRT_VERTICAL_TOTAL_TOTAL_SHIFT ) & -CRT_VERTICAL_TOTAL_TOTAL_MASK ) | - ((pModeParam->vertical_display_end -1 ) & -CRT_VERTICAL_TOTAL_DISPLAY_END_MASK )); + (((pModeParam->vertical_total -1 ) << +CRT_VERTICAL_TOTAL_TOTAL_SHIFT ) & +CRT_VERTICAL_TOTAL_TOTAL_MASK ) | + ((pModeParam->vertical_display_end -1 ) & +CRT_VERTICAL_TOTAL_DISPLAY_END_MASK ));poke32 (CRT_VERTICAL_SYNC , - ((pModeParam->vertical_sync_height << -CRT_VERTICAL_SYNC_HEIGHT_SHIFT ) & -CRT_VERTICAL_SYNC_HEIGHT_MASK ) | - ((pModeParam->vertical_sync_start -1 ) & -CRT_VERTICAL_SYNC_START_MASK )); + ((pModeParam->vertical_sync_height << +CRT_VERTICAL_SYNC_HEIGHT_SHIFT ) & +CRT_VERTICAL_SYNC_HEIGHT_MASK ) | + ((pModeParam->vertical_sync_start -1 ) & +CRT_VERTICAL_SYNC_START_MASK )); tmp =DISPLAY_CTRL_TIMING |DISPLAY_CTRL_PLANE ;if (pModeParam->vertical_sync_polarity)
@@ -140,25 +139,25 @@ static int programModeRegisters(mode_parameter_t *pModeParam,poke32 (PANEL_HORIZONTAL_TOTAL , reg);poke32 (PANEL_HORIZONTAL_SYNC , - ((pModeParam->horizontal_sync_width << -PANEL_HORIZONTAL_SYNC_WIDTH_SHIFT ) & -PANEL_HORIZONTAL_SYNC_WIDTH_MASK ) | - ((pModeParam->horizontal_sync_start -1 ) & -PANEL_HORIZONTAL_SYNC_START_MASK )); + ((pModeParam->horizontal_sync_width << +PANEL_HORIZONTAL_SYNC_WIDTH_SHIFT ) & +PANEL_HORIZONTAL_SYNC_WIDTH_MASK ) | + ((pModeParam->horizontal_sync_start -1 ) & +PANEL_HORIZONTAL_SYNC_START_MASK ));poke32 (PANEL_VERTICAL_TOTAL , - (((pModeParam->vertical_total -1 ) << -PANEL_VERTICAL_TOTAL_TOTAL_SHIFT ) & -PANEL_VERTICAL_TOTAL_TOTAL_MASK ) | - ((pModeParam->vertical_display_end -1 ) & -PANEL_VERTICAL_TOTAL_DISPLAY_END_MASK )); + (((pModeParam->vertical_total -1 ) << +PANEL_VERTICAL_TOTAL_TOTAL_SHIFT ) & +PANEL_VERTICAL_TOTAL_TOTAL_MASK ) | + ((pModeParam->vertical_display_end -1 ) & +PANEL_VERTICAL_TOTAL_DISPLAY_END_MASK ));poke32 (PANEL_VERTICAL_SYNC , - ((pModeParam->vertical_sync_height << -PANEL_VERTICAL_SYNC_HEIGHT_SHIFT ) & -PANEL_VERTICAL_SYNC_HEIGHT_MASK ) | - ((pModeParam->vertical_sync_start -1 ) & -PANEL_VERTICAL_SYNC_START_MASK )); + ((pModeParam->vertical_sync_height << +PANEL_VERTICAL_SYNC_HEIGHT_SHIFT ) & +PANEL_VERTICAL_SYNC_HEIGHT_MASK ) | + ((pModeParam->vertical_sync_start -1 ) & +PANEL_VERTICAL_SYNC_START_MASK )); tmp =DISPLAY_CTRL_TIMING |DISPLAY_CTRL_PLANE ;if (pModeParam->vertical_sync_polarity)
Signature · 1 line
2.11.0
Re: [Outreachy kernel] [PATCH 3/3] staging: sm750fb: Alignment should match open parenthesis
Quoted 38 lines · Arushi Singhal
Fix checkpatch issues: "CHECK: Alignment should match open parenthesis".
Signed-off-by Arushi Singhal <[email protected]>--- drivers/staging/sm750fb/ddk750_mode.c | 79 +++++++++++++++++------------------ 1 file changed, 39 insertions(+), 40 deletions(-)drivers/staging/sm750fb/ddk750_mode.c +4
-5@@ -28,9 +28,9 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam,poke32 (CRT_AUTO_CENTERING_TL ,0 );poke32 (CRT_AUTO_CENTERING_BR , - (((y -1 ) <<CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT ) & -CRT_AUTO_CENTERING_BR_BOTTOM_MASK ) | - ((x -1 ) &CRT_AUTO_CENTERING_BR_RIGHT_MASK )); + (((y -1 ) <<CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT ) & +CRT_AUTO_CENTERING_BR_BOTTOM_MASK ) | + ((x -1 ) &CRT_AUTO_CENTERING_BR_RIGHT_MASK ));/* * Assume common fields in dispControl have been properly set before @@ -72,8 +72,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam, }/* only timing related registers will be programed */ -static int programModeRegisters (mode_parameter_t *pModeParam, -struct pll_value *pll) +static int programModeRegisters (mode_parameter_t *pModeParam,struct pll_value *pll) {int ret =0 ;int cnt =0 ;@@ -83,32 +82,32 @@ static int programModeRegisters(mode_parameter_t *pModeParam,/* programe secondary pixel clock */ poke32 (CRT_PLL_CTRL ,sm750_format_pll_reg (pll)); poke32(CRT_HORIZONTAL_TOTAL,
drivers/staging/sm750fb/ddk750_mode.c static int programModeRegisters(mode_parameter_t *pModeParam, · line 89
Quoted 10 lines
drivers/staging/sm750fb/ddk750_mode.c +5
-5- (((pModeParam->horizontal_total -1 ) << -CRT_HORIZONTAL_TOTAL_TOTAL_SHIFT ) & -CRT_HORIZONTAL_TOTAL_TOTAL_MASK ) | - ((pModeParam->horizontal_display_end -1 ) & - CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK)); + (((pModeParam->horizontal_total -1 ) << +CRT_HORIZONTAL_TOTAL_TOTAL_SHIFT ) & +CRT_HORIZONTAL_TOTAL_TOTAL_MASK ) | + ((pModeParam->horizontal_display_end -1 ) & + CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK));
This code seems quite hard to read. Maybe you could introduce some new variables based on the parameter names of poke32, and store the argument of poke32 in those variables before making the call. Then you could also shorten the names of the constants a little, by using HORIZ and VERT instead of HORIZONTAL and VERTICAL. That might let eg the shift operations fit on one line.
To find out the types of the new variables, you would need to look at the definition of poke32 and see how the variables are used there. Unfortunately poke32 is a macro, so it doesn't give type information directly.
julia
Quoted 90 lines
drivers/staging/sm750fb/ddk750_mode.c +30
-31poke32 (CRT_HORIZONTAL_SYNC , - ((pModeParam->horizontal_sync_width << -CRT_HORIZONTAL_SYNC_WIDTH_SHIFT ) & -CRT_HORIZONTAL_SYNC_WIDTH_MASK ) | - ((pModeParam->horizontal_sync_start -1 ) & -CRT_HORIZONTAL_SYNC_START_MASK )); + ((pModeParam->horizontal_sync_width << +CRT_HORIZONTAL_SYNC_WIDTH_SHIFT ) & +CRT_HORIZONTAL_SYNC_WIDTH_MASK ) | + ((pModeParam->horizontal_sync_start -1 ) & +CRT_HORIZONTAL_SYNC_START_MASK ));poke32 (CRT_VERTICAL_TOTAL , - (((pModeParam->vertical_total -1 ) << -CRT_VERTICAL_TOTAL_TOTAL_SHIFT ) & -CRT_VERTICAL_TOTAL_TOTAL_MASK ) | - ((pModeParam->vertical_display_end -1 ) & -CRT_VERTICAL_TOTAL_DISPLAY_END_MASK )); + (((pModeParam->vertical_total -1 ) << +CRT_VERTICAL_TOTAL_TOTAL_SHIFT ) & +CRT_VERTICAL_TOTAL_TOTAL_MASK ) | + ((pModeParam->vertical_display_end -1 ) & +CRT_VERTICAL_TOTAL_DISPLAY_END_MASK ));poke32 (CRT_VERTICAL_SYNC , - ((pModeParam->vertical_sync_height << -CRT_VERTICAL_SYNC_HEIGHT_SHIFT ) & -CRT_VERTICAL_SYNC_HEIGHT_MASK ) | - ((pModeParam->vertical_sync_start -1 ) & -CRT_VERTICAL_SYNC_START_MASK )); + ((pModeParam->vertical_sync_height << +CRT_VERTICAL_SYNC_HEIGHT_SHIFT ) & +CRT_VERTICAL_SYNC_HEIGHT_MASK ) | + ((pModeParam->vertical_sync_start -1 ) & +CRT_VERTICAL_SYNC_START_MASK )); tmp =DISPLAY_CTRL_TIMING |DISPLAY_CTRL_PLANE ;if (pModeParam->vertical_sync_polarity)@@ -140,25 +139,25 @@ static int programModeRegisters(mode_parameter_t *pModeParam,poke32 (PANEL_HORIZONTAL_TOTAL , reg);poke32 (PANEL_HORIZONTAL_SYNC , - ((pModeParam->horizontal_sync_width << -PANEL_HORIZONTAL_SYNC_WIDTH_SHIFT ) & -PANEL_HORIZONTAL_SYNC_WIDTH_MASK ) | - ((pModeParam->horizontal_sync_start -1 ) & -PANEL_HORIZONTAL_SYNC_START_MASK )); + ((pModeParam->horizontal_sync_width << +PANEL_HORIZONTAL_SYNC_WIDTH_SHIFT ) & +PANEL_HORIZONTAL_SYNC_WIDTH_MASK ) | + ((pModeParam->horizontal_sync_start -1 ) & +PANEL_HORIZONTAL_SYNC_START_MASK ));poke32 (PANEL_VERTICAL_TOTAL , - (((pModeParam->vertical_total -1 ) << -PANEL_VERTICAL_TOTAL_TOTAL_SHIFT ) & -PANEL_VERTICAL_TOTAL_TOTAL_MASK ) | - ((pModeParam->vertical_display_end -1 ) & -PANEL_VERTICAL_TOTAL_DISPLAY_END_MASK )); + (((pModeParam->vertical_total -1 ) << +PANEL_VERTICAL_TOTAL_TOTAL_SHIFT ) & +PANEL_VERTICAL_TOTAL_TOTAL_MASK ) | + ((pModeParam->vertical_display_end -1 ) & +PANEL_VERTICAL_TOTAL_DISPLAY_END_MASK ));poke32 (PANEL_VERTICAL_SYNC , - ((pModeParam->vertical_sync_height << -PANEL_VERTICAL_SYNC_HEIGHT_SHIFT ) & -PANEL_VERTICAL_SYNC_HEIGHT_MASK ) | - ((pModeParam->vertical_sync_start -1 ) & -PANEL_VERTICAL_SYNC_START_MASK )); + ((pModeParam->vertical_sync_height << +PANEL_VERTICAL_SYNC_HEIGHT_SHIFT ) & +PANEL_VERTICAL_SYNC_HEIGHT_MASK ) | + ((pModeParam->vertical_sync_start -1 ) & +PANEL_VERTICAL_SYNC_START_MASK )); tmp =DISPLAY_CTRL_TIMING |DISPLAY_CTRL_PLANE ;if (pModeParam->vertical_sync_polarity) --2.11.0
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170311032410.8265-4-arushisinghal19971997%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Greg KH
maintainerQuoted 9 lines · Arushi Singhal
Improve readability by fixing multiple checkpatch.pl issues in sm750fb driver.
Arushi Singhal (3):
staging: sm750fb: function prototype argument should have an
identifier name
staging: sm750fb: fixes add blank line after
function/struct/union/enum declarations
staging: sm750fb: Alignment should match open parenthesis
This is a v2 series, right? Please always say so. Otherwise I'm going to drop it from my queue, like I just did :(
thanks,
greg k-h