Skip to contentSkip to conversation

staging: fbtft: remove unnecessary braces in if statements and space before close parenthesis in function call

PATCH In review Riyan Dhiman 2 participants 6 messages Jul 23, 2024 – Jul 24, 2024

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

PATCH 1/1 staging: fbtft: remove unnecessary braces in if statements and space before close parenthesis in function call

Adhere to Linux kernel coding style.

Reported by checkpatch:

CHECK: Unnecessary parentheses around 'devcode != 0x0000'
CHECK: Unnecessary parentheses around 'devcode != 0x9320'
CHECK: Unnecessary parentheses around 'par->info->var.xres == 320'
CHECK: Unnecessary parentheses around 'par->info->var.yres == 240'
CHECK: Unnecessary parentheses around 'par->spi->bits_per_word == 8'
CHECK: Unnecessary parentheses around '!txbuflen'
CHECK: Unnecessary parentheses around 'bpp > 8'
ERROR: space prohibited before that close parenthesis ')'

---
 drivers/staging/fbtft/fb_ili9320.c | 2 +-
 drivers/staging/fbtft/fb_ra8875.c  | 2 +-
 drivers/staging/fbtft/fbtft-bus.c  | 6 +++---
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_ili9320.c +1 -1
index 0be7c2d51548..409b54cc562e 100644
@@ -37,7 +37,7 @@ 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);
-	if ((devcode != 0x0000) && (devcode != 0x9320))
+	if (devcode != 0x0000 && devcode != 0x9320)
 		dev_warn(par->info->device,
 			 "Unrecognized Device code: 0x%04X (expected 0x9320)\n",
 			devcode);
drivers/staging/fbtft/fb_ra8875.c +1 -1
index 398bdbf53c9a..ce305a0bea48 100644
@@ -50,7 +50,7 @@ static int init_display(struct fbtft_par *par)
 
 	par->fbtftops.reset(par);
 
-	if ((par->info->var.xres == 320) && (par->info->var.yres == 240)) {
+	if (par->info->var.xres == 320 && par->info->var.yres == 240) {
 		/* PLL clock frequency */
 		write_reg(par, 0x88, 0x0A);
 		write_reg(par, 0x89, 0x02);
drivers/staging/fbtft/fbtft-bus.c +3 -3
index 3d422bc11641..02d7dbd38678 100644
@@ -62,9 +62,9 @@ out:									      \
 }                                                                             \
 EXPORT_SYMBOL(func);
 
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8,)
 define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
-define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16,)
 
 void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
 {
@@ -85,7 +85,7 @@ void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
 	if (len <= 0)
 		return;
 
-	if (par->spi && (par->spi->bits_per_word == 8)) {
+	if (par->spi && par->spi->bits_per_word == 8) {
 		/* we're emulating 9-bit, pad start of buffer with no-ops
 		 * (assuming here that zero is a no-op)
 		 */
drivers/staging/fbtft/fbtft-core.c +1 -1
index 8e2fd0c0fee2..53b104559502 100644
@@ -666,7 +666,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
 		txbuflen = 0;
 
 #ifdef __LITTLE_ENDIAN
-	if ((!txbuflen) && (bpp > 8))
+	if (!txbuflen && bpp > 8)
 		txbuflen = PAGE_SIZE; /* need buffer for byteswapping */
 #endif
 
Signature · 1 line
2.39.2
maintainer
#1 lore raw
Quoted 89 lines · Riyan Dhiman

Adhere to Linux kernel coding style.

Reported by checkpatch:

CHECK: Unnecessary parentheses around 'devcode != 0x0000'
CHECK: Unnecessary parentheses around 'devcode != 0x9320'
CHECK: Unnecessary parentheses around 'par->info->var.xres == 320'
CHECK: Unnecessary parentheses around 'par->info->var.yres == 240'
CHECK: Unnecessary parentheses around 'par->spi->bits_per_word == 8'
CHECK: Unnecessary parentheses around '!txbuflen'
CHECK: Unnecessary parentheses around 'bpp > 8'
ERROR: space prohibited before that close parenthesis ')'

---
 drivers/staging/fbtft/fb_ili9320.c | 2 +-
 drivers/staging/fbtft/fb_ra8875.c  | 2 +-
 drivers/staging/fbtft/fbtft-bus.c  | 6 +++---
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/fbtft/fb_ili9320.c +1 -1
index 0be7c2d51548..409b54cc562e 100644
@@ -37,7 +37,7 @@ 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);
-	if ((devcode != 0x0000) && (devcode != 0x9320))
+	if (devcode != 0x0000 && devcode != 0x9320)
 		dev_warn(par->info->device,
 			 "Unrecognized Device code: 0x%04X (expected 0x9320)\n",
 			devcode);
drivers/staging/fbtft/fb_ra8875.c +1 -1
index 398bdbf53c9a..ce305a0bea48 100644
@@ -50,7 +50,7 @@ static int init_display(struct fbtft_par *par)
 
 	par->fbtftops.reset(par);
 
-	if ((par->info->var.xres == 320) && (par->info->var.yres == 240)) {
+	if (par->info->var.xres == 320 && par->info->var.yres == 240) {
 		/* PLL clock frequency */
 		write_reg(par, 0x88, 0x0A);
 		write_reg(par, 0x89, 0x02);
drivers/staging/fbtft/fbtft-bus.c +3 -3
index 3d422bc11641..02d7dbd38678 100644
@@ -62,9 +62,9 @@ out:									      \
 }                                                                             \
 EXPORT_SYMBOL(func);
 
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8,)
 define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
-define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16,)
 
 void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
 {
@@ -85,7 +85,7 @@ void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
 	if (len <= 0)
 		return;
 
-	if (par->spi && (par->spi->bits_per_word == 8)) {
+	if (par->spi && par->spi->bits_per_word == 8) {
 		/* we're emulating 9-bit, pad start of buffer with no-ops
 		 * (assuming here that zero is a no-op)
 		 */
drivers/staging/fbtft/fbtft-core.c +1 -1
index 8e2fd0c0fee2..53b104559502 100644
@@ -666,7 +666,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
 		txbuflen = 0;
 
 #ifdef __LITTLE_ENDIAN
-	if ((!txbuflen) && (bpp > 8))
+	if (!txbuflen && bpp > 8)
 		txbuflen = PAGE_SIZE; /* need buffer for byteswapping */
 #endif
 
Signature · 1 line
2.39.2

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You sent a patch that has been sent multiple times in the past, and is identical to ones that has been recently rejected. Please always look at the mailing list traffic to determine if you are duplicating other people's work.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot

#2 lore raw

Hi,

Thank you for your feedback on my patch submission.
I have reviewed the mailing list traffic and noted that the last patch addressing the same coding style issue was submitted in April. Given this timeframe, I believed it was appropriate to submit my patch to contribute to the resolution of the ongoing issue.
As this is my first contribution to the Linux kernel, I want to ensure that my submission aligns with the requirements. I would greatly appreciate your guidance on how to improve my patch and avoid duplicating previous efforts.

Thank you for your time and consideration.

Best regards,
Riyan Dhiman

Quoted 127 lines · Greg KH
Quoted 14 lines · Riyan Dhiman

Adhere to Linux kernel coding style.

Reported by checkpatch:

CHECK: Unnecessary parentheses around 'devcode != 0x0000'
CHECK: Unnecessary parentheses around 'devcode != 0x9320'
CHECK: Unnecessary parentheses around 'par->info->var.xres == 320'
CHECK: Unnecessary parentheses around 'par->info->var.yres == 240'
CHECK: Unnecessary parentheses around 'par->spi->bits_per_word == 8'
CHECK: Unnecessary parentheses around '!txbuflen'
CHECK: Unnecessary parentheses around 'bpp > 8'
ERROR: space prohibited before that close parenthesis ')'

Review

Quoted 8 lines
---
 drivers/staging/fbtft/fb_ili9320.c | 2 +-
 drivers/staging/fbtft/fb_ra8875.c  | 2 +-
 drivers/staging/fbtft/fbtft-bus.c  | 6 +++---
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/fbtft/fb_ili9320.c

drivers/staging/fbtft/fb_ili9320.c static int init_display(struct fbtft_par *par) · line 42

Quoted 11 lines

index 0be7c2d51548..409b54cc562e 100644

drivers/staging/fbtft/fb_ili9320.c +1 -1
@@ -37,7 +37,7 @@ 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);
-     if ((devcode != 0x0000) && (devcode != 0x9320))
+     if (devcode != 0x0000 && devcode != 0x9320)
              dev_warn(par->info->device,
                       "Unrecognized Device code: 0x%04X (expected

0x9320)\n",

Review

Quoted 2 lines
drivers/staging/fbtft/fb_ili9320.c +0 -0
                      devcode);
(quoted diff) +0 -0

b/drivers/staging/fbtft/fb_ra8875.c

Review

Quoted 13 lines

index 398bdbf53c9a..ce305a0bea48 100644

drivers/staging/fbtft/fb_ra8875.c +1 -1
@@ -50,7 +50,7 @@ static int init_display(struct fbtft_par *par)
 
      par->fbtftops.reset(par);
 
-     if ((par->info->var.xres == 320) && (par->info->var.yres == 240)) {
+     if (par->info->var.xres == 320 && par->info->var.yres == 240) {
              /* PLL clock frequency */
              write_reg(par, 0x88, 0x0A);
              write_reg(par, 0x89, 0x02);
(quoted diff) +0 -0

b/drivers/staging/fbtft/fbtft-bus.c

drivers/staging/fbtft/fbtft-bus.c out:

Quoted 4 lines

index 3d422bc11641..02d7dbd38678 100644

drivers/staging/fbtft/fbtft-bus.c +0 -0
@@ -62,9 +62,9 @@ out:
                            \

drivers/staging/fbtft/fbtft-bus.c out: · line 62

Quoted 1 line
drivers/staging/fbtft/fbtft-bus.c +0 -0
 }
       \

drivers/staging/fbtft/fbtft-bus.c void fbtft_write_reg8_bus9(struct fbtft_par *par, int

Quoted 11 lines
drivers/staging/fbtft/fbtft-bus.c +2 -2
 EXPORT_SYMBOL(func);
 
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8,)
 define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
-define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16,)
 
 void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
 {
@@ -85,7 +85,7 @@ void fbtft_write_reg8_bus9(struct fbtft_par *par, int

len, ...)

Review

Quoted 9 lines
drivers/staging/fbtft/fbtft-bus.c +1 -1
      if (len <= 0)
              return;
 
-     if (par->spi && (par->spi->bits_per_word == 8)) {
+     if (par->spi && par->spi->bits_per_word == 8) {
              /* we're emulating 9-bit, pad start of buffer with no-ops
               * (assuming here that zero is a no-op)
               */
(quoted diff) +0 -0

b/drivers/staging/fbtft/fbtft-core.c

drivers/staging/fbtft/fbtft-core.c struct fb_info *fbtft_framebuffer_alloc(struct

Quoted 4 lines

index 8e2fd0c0fee2..53b104559502 100644

drivers/staging/fbtft/fbtft-core.c +0 -0
@@ -666,7 +666,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct

fbtft_display *display,

Quoted 9 lines
drivers/staging/fbtft/fbtft-core.c +1 -2
              txbuflen = 0;
 
 #ifdef __LITTLE_ENDIAN
-     if ((!txbuflen) && (bpp > 8))
+     if (!txbuflen && bpp > 8)
              txbuflen = PAGE_SIZE; /* need buffer for byteswapping */
 #endif
 
--
Quoted 3 lines

2.39.2

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You sent a patch that has been sent multiple times in the past, and is identical to ones that has been recently rejected. Please always look at the mailing list traffic to determine if you are duplicating other people's work.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot

maintainer
#3 lore raw
Quoted 10 lines · Riyan Dhiman

Hi,

Thank you for your feedback on my patch submission.
I have reviewed the mailing list traffic and noted that the last patch addressing the same coding style issue was submitted in April. Given this timeframe, I believed it was appropriate to submit my patch to contribute to the resolution of the ongoing issue.
As this is my first contribution to the Linux kernel, I want to ensure that my submission aligns with the requirements. I would greatly appreciate your guidance on how to improve my patch and avoid duplicating previous efforts.

The issue is that the checkpatch warning for too many () characters is just not right, and shouldn't be applied for staging fixes, sorry. The code is fine as-is.

thanks,

greg k-h

#4 lore raw

Hi,

Thank you for your feedback on my patch submission.
I understand that the fix provided by my patch is not needed. As this is my first contribution to the Linux kernel, I am eager to learn and make valuable contributions.
To ensure my future submissions are more aligned with the needs, I would like to know if it would be helpful for me to focus on the following types of fixes:

- CHECK: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst
- WARNING: Unnecessary ftrace-like logging - prefer using ftrace

Could you please advise if these contributions would be valuable and if there are any additional areas where I can be of assistance? Thank you for your time and consideration.

Best regards,
Riyan Dhiman

maintainer
#5 lore raw
Quoted 10 lines · Riyan Dhiman

Hi,

Thank you for your feedback on my patch submission.
I understand that the fix provided by my patch is not needed. As this is my first contribution to the Linux kernel, I am eager to learn and make valuable contributions.
To ensure my future submissions are more aligned with the needs, I would like to know if it would be helpful for me to focus on the following types of fixes:

Quoted 2 lines

- CHECK: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst

That's very hard to fix without access to the device and the knowledge of what needs to happen. See the archives for where people have tried to do this and the responses they got.

Quoted 1 line

- WARNING: Unnecessary ftrace-like logging - prefer using ftrace

That's good to clean up, try that and see!

thanks,
g
reg k-h