Skip to contentSkip to conversation

staging: fbtft: fb_ili9xxx.c: fix multiple coding style issues

PATCH New Eva Rachel Retuya 1 participant 6 messages Feb 12, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover staging: fbtft: fb_ili9xxx.c: fix multiple coding style issues

Address checkpatch WARNING and CHECK issues on the fb_ili9xxx series of files.

Change in v2:
* Modify subject lines to avoid duplicates from a different patchset.

Eva Rachel Retuya (5):
staging: fbtft: Modify block comments based on kernel coding style
staging: fbtft: Fix alignment to match open parenthesis
staging: fbtft: Insert blank line after function declaration
staging: fbtft: Delete blank line after '{' brace
staging: fbtft: Remove the use of CamelCase

 drivers/staging/fbtft/fb_ili9163.c | 103 +++++++++++++++++++------------------
 drivers/staging/fbtft/fb_ili9320.c |  13 ++---
 drivers/staging/fbtft/fb_ili9325.c |  81 +++++++++++++++--------------
 drivers/staging/fbtft/fb_ili9340.c |   8 +--
 drivers/staging/fbtft/fb_ili9341.c |  19 +++----
 drivers/staging/fbtft/fb_ili9481.c |   7 ++-
 6 files changed, 117 insertions(+), 114 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/5 staging: fbtft: Modify block comments based on kernel coding style

Add the required trailing * on subsequent lines as well as move the */ on a separate line. Checkpatch found this issue.

---
 drivers/staging/fbtft/fb_ili9163.c | 69 ++++++++++++++++----------------
 drivers/staging/fbtft/fb_ili9320.c |  8 ++--
 drivers/staging/fbtft/fb_ili9325.c | 80 +++++++++++++++++++-------------------
 drivers/staging/fbtft/fb_ili9341.c |  8 ++--
 4 files changed, 83 insertions(+), 82 deletions(-)
drivers/staging/fbtft/fb_ili9163.c +35 -34
index cbcfbb5..3f6c245 100644
@@ -39,11 +39,11 @@
 #endif
 
 /* ILI9163C commands */
-#define CMD_FRMCTR1	0xB1 /* Frame Rate Control
-				(In normal mode/Full colors) */
+#define CMD_FRMCTR1	0xB1 /* Frame Rate Control */
+			     /*	(In normal mode/Full colors) */
 #define CMD_FRMCTR2	0xB2 /* Frame Rate Control (In Idle mode/8-colors) */
-#define CMD_FRMCTR3	0xB3 /* Frame Rate Control
-				(In Partial mode/full colors) */
+#define CMD_FRMCTR3	0xB3 /* Frame Rate Control */
+			     /*	(In Partial mode/full colors) */
 #define CMD_DINVCTR	0xB4 /* Display Inversion Control */
 #define CMD_RGBBLK	0xB5 /* RGB Interface Blanking Porch setting */
 #define CMD_DFUNCTR	0xB6 /* Display Function set 5 */
@@ -63,17 +63,18 @@
 #define CMD_GAMRSEL	0xF2 /* GAM_R_SEL */
 
 /*
-This display:
-http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-Color-TFT-LCD-Display-Module-/271422122271
-This particular display has a design error! The controller has 3 pins to
-configure to constrain the memory and resolution to a fixed dimension (in
-that case 128x128) but they leaved those pins configured for 128x160 so
-there was several pixel memory addressing problems.
-I solved by setup several parameters that dinamically fix the resolution as
-needit so below the parameters for this display. If you have a strain or a
-correct display (can happen with chinese) you can copy those parameters and
-create setup for different displays.
-*/
+ * This display:
+ * http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-
+ * Color-TFT-LCD-Display-Module-/271422122271
+ * This particular display has a design error! The controller has 3 pins to
+ * configure to constrain the memory and resolution to a fixed dimension (in
+ * that case 128x128) but they leaved those pins configured for 128x160 so
+ * there was several pixel memory addressing problems.
+ * I solved by setup several parameters that dinamically fix the resolution as
+ * needit so below the parameters for this display. If you have a strain or a
+ * correct display (can happen with chinese) you can copy those parameters and
+ * create setup for different displays.
+ */
 
 #ifdef RED
 #define __OFFSET		32 /*see note 2 - this is the red version */
@@ -153,25 +154,25 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys,
 }
 
 /*
-7) MY:  1(bottom to top),	0(top to bottom)    Row Address Order
-6) MX:  1(R to L),		0(L to R)	    Column Address Order
-5) MV:  1(Exchanged),		0(normal)	    Row/Column exchange
-4) ML:  1(bottom to top),	0(top to bottom)    Vertical Refresh Order
-3) RGB: 1(BGR),			0(RGB)		    Color Space
-2) MH:  1(R to L),		0(L to R)	    Horizontal Refresh Order
-1)
-0)
-
-	MY, MX, MV, ML,RGB, MH, D1, D0
-	0 | 0 | 0 | 0 | 1 | 0 | 0 | 0	//normal
-	1 | 0 | 0 | 0 | 1 | 0 | 0 | 0	//Y-Mirror
-	0 | 1 | 0 | 0 | 1 | 0 | 0 | 0	//X-Mirror
-	1 | 1 | 0 | 0 | 1 | 0 | 0 | 0	//X-Y-Mirror
-	0 | 0 | 1 | 0 | 1 | 0 | 0 | 0	//X-Y Exchange
-	1 | 0 | 1 | 0 | 1 | 0 | 0 | 0	//X-Y Exchange, Y-Mirror
-	0 | 1 | 1 | 0 | 1 | 0 | 0 | 0	//XY exchange
-	1 | 1 | 1 | 0 | 1 | 0 | 0 | 0
-*/
+ * 7) MY:  1(bottom to top),	0(top to bottom)    Row Address Order
+ * 6) MX:  1(R to L),		0(L to R)	    Column Address Order
+ * 5) MV:  1(Exchanged),	0(normal)	    Row/Column exchange
+ * 4) ML:  1(bottom to top),	0(top to bottom)    Vertical Refresh Order
+ * 3) RGB: 1(BGR),		0(RGB)		    Color Space
+ * 2) MH:  1(R to L),		0(L to R)	    Horizontal Refresh Order
+ * 1)
+ * 0)
+ *
+ *	MY, MX, MV, ML,RGB, MH, D1, D0
+ *	0 | 0 | 0 | 0 | 1 | 0 | 0 | 0	//normal
+ *	1 | 0 | 0 | 0 | 1 | 0 | 0 | 0	//Y-Mirror
+ *	0 | 1 | 0 | 0 | 1 | 0 | 0 | 0	//X-Mirror
+ *	1 | 1 | 0 | 0 | 1 | 0 | 0 | 0	//X-Y-Mirror
+ *	0 | 0 | 1 | 0 | 1 | 0 | 0 | 0	//X-Y Exchange
+ *	1 | 0 | 1 | 0 | 1 | 0 | 0 | 0	//X-Y Exchange, Y-Mirror
+ *	0 | 1 | 1 | 0 | 1 | 0 | 0 | 0	//XY exchange
+ *	1 | 1 | 1 | 0 | 1 | 0 | 0 | 0
+ */
 static int set_var(struct fbtft_par *par)
 {
 	u8 mactrl_data = 0; /* Avoid compiler warning */
drivers/staging/fbtft/fb_ili9320.c +4 -4
index 3ed50fe..5da2764 100644
@@ -216,10 +216,10 @@ static int set_var(struct fbtft_par *par)
 }
 
 /*
-  Gamma string format:
-    VRP0 VRP1 RP0 RP1 KP0 KP1 KP2 KP3 KP4 KP5
-    VRN0 VRN1 RN0 RN1 KN0 KN1 KN2 KN3 KN4 KN5
-*/
+ * Gamma string format:
+ *  VRP0 VRP1 RP0 RP1 KP0 KP1 KP2 KP3 KP4 KP5
+ *  VRN0 VRN1 RN0 RN1 KN0 KN1 KN2 KN3 KN4 KN5
+ */
 #define CURVE(num, idx)  curves[num * par->gamma.num_values + idx]
 static int set_gamma(struct fbtft_par *par, unsigned long *curves)
 {
drivers/staging/fbtft/fb_ili9325.c +40 -40

92 lines not on this page · raw message

drivers/staging/fbtft/fb_ili9341.c +4 -4
index d1e13cd..e8107d1 100644
@@ -116,10 +116,10 @@ static int set_var(struct fbtft_par *par)
 }
 
 /*
-  Gamma string format:
-    Positive: Par1 Par2 [...] Par15
-    Negative: Par1 Par2 [...] Par15
-*/
+ * Gamma string format:
+ *  Positive: Par1 Par2 [...] Par15
+ *  Negative: Par1 Par2 [...] Par15
+ */
 #define CURVE(num, idx)  curves[num * par->gamma.num_values + idx]
 static int set_gamma(struct fbtft_par *par, unsigned long *curves)
 {
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/5 staging: fbtft: Fix alignment to match open parenthesis

In reply to Eva Rachel Retuya

Fix alignment issues by properly indenting function parameters in accordance to the kernel coding style. Checkpatch pointed out this issue.

CHECK: Alignment should match open parenthesis

---
 drivers/staging/fbtft/fb_ili9163.c | 33 ++++++++++++++++-----------------
 drivers/staging/fbtft/fb_ili9320.c |  4 ++--
 drivers/staging/fbtft/fb_ili9340.c |  8 ++++----
 drivers/staging/fbtft/fb_ili9341.c | 10 +++++-----
 4 files changed, 27 insertions(+), 28 deletions(-)
drivers/staging/fbtft/fb_ili9163.c +16 -17
index 3f6c245..9f7c7ec 100644
@@ -122,7 +122,7 @@ static int init_display(struct fbtft_par *par)
 }
 
 static void set_addr_win(struct fbtft_par *par, int xs, int ys,
-				int xe, int ye)
+			 int xe, int ye)
 {
 	switch (par->info->var.rotate) {
 	case 0:
@@ -215,22 +215,21 @@ static int gamma_adj(struct fbtft_par *par, unsigned long *curves)
 			CURVE(i, j) &= mask[i * par->gamma.num_values + j];
 
 	write_reg(par, CMD_PGAMMAC,
-				CURVE(0, 0),
-				CURVE(0, 1),
-				CURVE(0, 2),
-				CURVE(0, 3),
-				CURVE(0, 4),
-				CURVE(0, 5),
-				CURVE(0, 6),
-				(CURVE(0, 7) << 4) | CURVE(0, 8),
-				CURVE(0, 9),
-				CURVE(0, 10),
-				CURVE(0, 11),
-				CURVE(0, 12),
-				CURVE(0, 13),
-				CURVE(0, 14),
-				CURVE(0, 15)
-				);
+		  CURVE(0, 0),
+		  CURVE(0, 1),
+		  CURVE(0, 2),
+		  CURVE(0, 3),
+		  CURVE(0, 4),
+		  CURVE(0, 5),
+		  CURVE(0, 6),
+		  (CURVE(0, 7) << 4) | CURVE(0, 8),
+		  CURVE(0, 9),
+		  CURVE(0, 10),
+		  CURVE(0, 11),
+		  CURVE(0, 12),
+		  CURVE(0, 13),
+		  CURVE(0, 14),
+		  CURVE(0, 15));
 
 	/* Write Data to GRAM mode */
 	write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
drivers/staging/fbtft/fb_ili9320.c +2 -2
index 5da2764..6c6bc3d 100644
@@ -47,10 +47,10 @@ static int init_display(struct fbtft_par *par)
 
 	devcode = read_devicecode(par);
 	fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "Device code: 0x%04X\n",
-		devcode);
+		      devcode);
 	if ((devcode != 0x0000) && (devcode != 0x9320))
 		dev_warn(par->info->device,
-			"Unrecognized Device code: 0x%04X (expected 0x9320)\n",
+			 "Unrecognized Device code: 0x%04X (expected 0x9320)\n",
 			devcode);
 
 	/* Initialization sequence from ILI9320 Application Notes */
drivers/staging/fbtft/fb_ili9340.c +4 -4
index 9b24c9e..0711121 100644
@@ -71,13 +71,13 @@ static int init_display(struct fbtft_par *par)
 
 	/* Positive Gamma Correction */
 	write_reg(par, 0xE0,
-		0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1,
-		0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00);
+		  0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1,
+		  0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00);
 
 	/* Negative Gamma Correction */
 	write_reg(par, 0xE1,
-		0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1,
-		0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F);
+		  0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1,
+		  0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F);
 
 	write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
 
drivers/staging/fbtft/fb_ili9341.c +5 -5
index e8107d1..e92d771 100644
@@ -127,11 +127,11 @@ static int set_gamma(struct fbtft_par *par, unsigned long *curves)
 
 	for (i = 0; i < par->gamma.num_curves; i++)
 		write_reg(par, 0xE0 + i,
-			CURVE(i, 0), CURVE(i, 1), CURVE(i, 2),
-			CURVE(i, 3), CURVE(i, 4), CURVE(i, 5),
-			CURVE(i, 6), CURVE(i, 7), CURVE(i, 8),
-			CURVE(i, 9), CURVE(i, 10), CURVE(i, 11),
-			CURVE(i, 12), CURVE(i, 13), CURVE(i, 14));
+			  CURVE(i, 0), CURVE(i, 1), CURVE(i, 2),
+			  CURVE(i, 3), CURVE(i, 4), CURVE(i, 5),
+			  CURVE(i, 6), CURVE(i, 7), CURVE(i, 8),
+			  CURVE(i, 9), CURVE(i, 10), CURVE(i, 11),
+			  CURVE(i, 12), CURVE(i, 13), CURVE(i, 14));
 
 	return 0;
 }
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 3/5 staging: fbtft: Insert blank line after function declaration

In reply to Eva Rachel Retuya

Insert the required whitespace after the function declaration as suggested by checkpatch.

CHECK: Please use a blank line after function/struct/union/enum declarations

---
 drivers/staging/fbtft/fb_ili9163.c | 1 +
 drivers/staging/fbtft/fb_ili9320.c | 1 +
 drivers/staging/fbtft/fb_ili9325.c | 1 +
 drivers/staging/fbtft/fb_ili9341.c | 1 +
 4 files changed, 4 insertions(+)
drivers/staging/fbtft/fb_ili9163.c +1 -0
index 9f7c7ec..6b8f8b1 100644
@@ -236,6 +236,7 @@ static int gamma_adj(struct fbtft_par *par, unsigned long *curves)
 
 	return 0;
 }
+
 #undef CURVE
 #endif
 
drivers/staging/fbtft/fb_ili9320.c +1 -0
index 6c6bc3d..6ff222d 100644
@@ -248,6 +248,7 @@ static int set_gamma(struct fbtft_par *par, unsigned long *curves)
 
 	return 0;
 }
+
 #undef CURVE
 
 static struct fbtft_display display = {
drivers/staging/fbtft/fb_ili9325.c +1 -0
index 64cdf55..fdf98d3 100644
@@ -245,6 +245,7 @@ static int set_gamma(struct fbtft_par *par, unsigned long *curves)
 
 	return 0;
 }
+
 #undef CURVE
 
 static struct fbtft_display display = {
drivers/staging/fbtft/fb_ili9341.c +1 -0
index e92d771..ff35c86 100644
@@ -135,6 +135,7 @@ static int set_gamma(struct fbtft_par *par, unsigned long *curves)
 
 	return 0;
 }
+
 #undef CURVE
 
 static struct fbtft_display display = {
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 4/5 staging: fbtft: Delete blank line after '{' brace

In reply to Eva Rachel Retuya

Omit the whitespace after '{' brace as suggested by checkpatch.

CHECK: Blank lines aren't necessary after an open brace '{'

---
 drivers/staging/fbtft/fb_ili9481.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/fbtft/fb_ili9481.c +0 -1
index 6fa5e4c..fb0e6c3 100644
@@ -28,7 +28,6 @@
 #define HEIGHT		480
 
 static int default_init_sequence[] = {
-
 	/* SLP_OUT - Sleep out */
 	-1, MIPI_DCS_EXIT_SLEEP_MODE,
 	-2, 50,
Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 5/5 staging: fbtft: Remove the use of CamelCase

In reply to Eva Rachel Retuya

Rename the macro defining constant ROWxCOL into ROW_X_COL to remove checkpatch check concerning use of CamelCase and to achieve better readability.

CHECK: Avoid CamelCase: <ROWxCOL>

---
 drivers/staging/fbtft/fb_ili9481.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/fbtft/fb_ili9481.c +3 -3
index fb0e6c3..242adb3 100644
@@ -64,13 +64,13 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
 
 #define HFLIP 0x01
 #define VFLIP 0x02
-#define ROWxCOL 0x20
+#define ROW_X_COL 0x20
 static int set_var(struct fbtft_par *par)
 {
 	switch (par->info->var.rotate) {
 	case 270:
 		write_reg(par, MIPI_DCS_SET_ADDRESS_MODE,
-			  ROWxCOL | HFLIP | VFLIP | (par->bgr << 3));
+			  ROW_X_COL | HFLIP | VFLIP | (par->bgr << 3));
 		break;
 	case 180:
 		write_reg(par, MIPI_DCS_SET_ADDRESS_MODE,
@@ -78,7 +78,7 @@ static int set_var(struct fbtft_par *par)
 		break;
 	case 90:
 		write_reg(par, MIPI_DCS_SET_ADDRESS_MODE,
-			  ROWxCOL | (par->bgr << 3));
+			  ROW_X_COL | (par->bgr << 3));
 		break;
 	default:
 		write_reg(par, MIPI_DCS_SET_ADDRESS_MODE,
Signature · 1 line
1.9.1