diff mbox

staging: sm750fb: Improved coding style

Message ID 20170312023402.GA10352@arushi-HP-Pavilion-Notebook (mailing list archive)
State New, archived
Headers show

Commit Message

Arushi March 12, 2017, 2:34 a.m. UTC
New variables are added to make the code more readable.
Also fixed the checkpatch issue: "Alignment should match open
parenthesis".

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 drivers/staging/sm750fb/ddk750_mode.c | 112 ++++++++++++++++------------------
 1 file changed, 53 insertions(+), 59 deletions(-)

Comments

Greg KH March 12, 2017, 4:46 a.m. UTC | #1
On Sun, Mar 12, 2017 at 08:04:02AM +0530, Arushi Singhal wrote:
> New variables are added to make the code more readable.
> Also fixed the checkpatch issue: "Alignment should match open
> parenthesis".

When you have to say "also" in a commit message, that is a huge red-flag
that you need to break a patch up into different parts, as you are doing
multiple things.  Please do so here.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot March 12, 2017, 9:32 p.m. UTC | #2
Hi Arushi,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.11-rc1 next-20170310]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Arushi-Singhal/staging-sm750fb-Improved-coding-style/20170313-044528
config: x86_64-randconfig-x013-201711 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/staging/sm750fb/ddk750_mode.c: In function 'programModeRegisters':
>> drivers/staging/sm750fb/ddk750_mode.c:155:106: error: 'pvssm' undeclared (first use in this function)
      poke32(pvs, ((pModeParam->vertical_sync_height << PANEL_VERTICAL_SYNC_HEIGHT_SHIFT) & pvshm) | (pvss & pvssm));
                                                                                                             ^~~~~
   drivers/staging/sm750fb/ddk750_mode.c:155:106: note: each undeclared identifier is reported only once for each function it appears in

vim +/pvssm +155 drivers/staging/sm750fb/ddk750_mode.c

   149			poke32(pht, reg);
   150	
   151			poke32(phs, ((pModeParam->horizontal_sync_width << PANEL_HORIZONTAL_SYNC_WIDTH_SHIFT) & phswm) | (phss & phssm));
   152	
   153			poke32(pvt, (((pModeParam->vertical_total - 1) << PANEL_VERTICAL_TOTAL_TOTAL_SHIFT) & pvttm) | (pvde & pvtdem));
   154	
 > 155			poke32(pvs, ((pModeParam->vertical_sync_height << PANEL_VERTICAL_SYNC_HEIGHT_SHIFT) & pvshm) | (pvss & pvssm));
   156	
   157			tmp = DISPLAY_CTRL_TIMING | DISPLAY_CTRL_PLANE;
   158			if (pModeParam->vertical_sync_polarity)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c
index 45af806c8d55..7fd3c3f20c01 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -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,43 +72,39 @@  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;
 	unsigned int tmp, reg;
+	unsigned int cht = CRT_HORIZONTAL_TOTAL;
+	unsigned int cvt = CRT_VERTICAL_TOTAL;
+	unsigned int chs = CRT_HORIZONTAL_SYNC;
+	unsigned int cvs = CRT_VERTICAL_SYNC;
+	unsigned int chssm = CRT_HORIZONTAL_SYNC_START_MASK;
+	unsigned int cvssm = CRT_VERTICAL_SYNC_START_MASK;
+	unsigned int chtdem = CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK;
+	unsigned int cvtdem = CRT_VERTICAL_TOTAL_DISPLAY_END_MASK;
+	unsigned int chttm = CRT_HORIZONTAL_TOTAL_TOTAL_MASK;
+	unsigned int cvttm = CRT_VERTICAL_TOTAL_TOTAL_MASK;
+	unsigned int chswm = CRT_HORIZONTAL_SYNC_WIDTH_MASK;
+	unsigned int cvshm = CRT_VERTICAL_SYNC_HEIGHT_MASK;
+	unsigned int phde = pModeParam->horizontal_display_end - 1;
+	unsigned int pvde = pModeParam->vertical_display_end - 1;
+	unsigned int phss = pModeParam->horizontal_sync_start - 1;
+	unsigned int pvss = pModeParam->vertical_sync_start - 1;
 
 	if (pll->clockType == SECONDARY_PLL) {
 		/* 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));
-
-		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));
-
-		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));
-
-		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));
+
+		poke32(cht, (((pModeParam->horizontal_total - 1) << CRT_HORIZONTAL_TOTAL_TOTAL_SHIFT) & chttm) | (phde & chtdem));
+
+		poke32(chs, ((pModeParam->horizontal_sync_width << CRT_HORIZONTAL_SYNC_WIDTH_SHIFT) & chswm) | (phss & chssm));
+
+		poke32(cvt, (((pModeParam->vertical_total - 1) << CRT_VERTICAL_TOTAL_TOTAL_SHIFT) & cvttm) | (pvde & cvtdem));
+
+		poke32(cvs, ((pModeParam->vertical_sync_height << CRT_VERTICAL_SYNC_HEIGHT_SHIFT) & cvshm) | (pvss & cvssm));
 
 		tmp = DISPLAY_CTRL_TIMING | DISPLAY_CTRL_PLANE;
 		if (pModeParam->vertical_sync_polarity)
@@ -129,36 +125,34 @@  static int programModeRegisters(mode_parameter_t *pModeParam,
 
 	} else if (pll->clockType == PRIMARY_PLL) {
 		unsigned int reserved;
+		unsigned int pht = PANEL_HORIZONTAL_TOTAL;
+		unsigned int pvt = PANEL_VERTICAL_TOTAL;
+		unsigned int phs = PANEL_HORIZONTAL_SYNC;
+		unsigned int pvs = PANEL_VERTICAL_SYNC;
+		unsigned int phssm = PANEL_HORIZONTAL_SYNC_START_MASK;
+		unsigned int phtdem = PANEL_HORIZONTAL_TOTAL_DISPLAY_END_MASK;
+		unsigned int pvtdem = PANEL_VERTICAL_TOTAL_DISPLAY_END_MASK;
+		unsigned int phttm = PANEL_HORIZONTAL_TOTAL_TOTAL_MASK;
+		unsigned int pvttm = PANEL_VERTICAL_TOTAL_TOTAL_MASK;
+		unsigned int phswm = PANEL_HORIZONTAL_SYNC_WIDTH_MASK;
+		unsigned int pvshm = PANEL_VERTICAL_SYNC_HEIGHT_MASK;
+		unsigned int phde = pModeParam->horizontal_display_end - 1;
+		unsigned int pvde = pModeParam->vertical_display_end - 1;
+		unsigned int phss = pModeParam->horizontal_sync_start - 1;
+		unsigned int pvss = pModeParam->vertical_sync_start - 1;
+
 
 		poke32(PANEL_PLL_CTRL, sm750_format_pll_reg(pll));
 
-		reg = ((pModeParam->horizontal_total - 1) <<
-			PANEL_HORIZONTAL_TOTAL_TOTAL_SHIFT) &
-			PANEL_HORIZONTAL_TOTAL_TOTAL_MASK;
-		reg |= ((pModeParam->horizontal_display_end - 1) &
-			PANEL_HORIZONTAL_TOTAL_DISPLAY_END_MASK);
-		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));
-
-		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));
-
-		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));
+		reg = ((pModeParam->horizontal_total - 1) << PANEL_HORIZONTAL_TOTAL_TOTAL_SHIFT) & phttm;
+		reg |= (phde & phtdem);
+		poke32(pht, reg);
+
+		poke32(phs, ((pModeParam->horizontal_sync_width << PANEL_HORIZONTAL_SYNC_WIDTH_SHIFT) & phswm) | (phss & phssm));
+
+		poke32(pvt, (((pModeParam->vertical_total - 1) << PANEL_VERTICAL_TOTAL_TOTAL_SHIFT) & pvttm) | (pvde & pvtdem));
+
+		poke32(pvs, ((pModeParam->vertical_sync_height << PANEL_VERTICAL_SYNC_HEIGHT_SHIFT) & pvshm) | (pvss & pvssm));
 
 		tmp = DISPLAY_CTRL_TIMING | DISPLAY_CTRL_PLANE;
 		if (pModeParam->vertical_sync_polarity)