Skip to contentSkip to conversation

staging: fbtft: Remove unnecessary parentheses in fbtft-core.c

PATCH In review Sandeep Salwan 2 participants 2 messages Jan 5, 2025 – Jan 7, 2025

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

PATCH 1/1 staging: fbtft: Remove unnecessary parentheses in fbtft-core.c

This patch removes unnecessary parentheses around the conditional checks (!txbuflen) and (bpp > 8) in fbtft-core.c. According to the kernel coding style, reducing superfluous parentheses makes the code more readable and straightforward. There are no functional changes; it’s purely a cleanup to align the code with kernel style guidelines.

---
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fbtft-core.c +1 -1
index 4cfa494243b9..b4e9d6000b9a 100644
@@ -664,7 +664,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.47.1
maintainer
#1 lore raw
Quoted 1 line · Sandeep Salwan

This patch removes unnecessary parentheses around the conditional checks (!txbuflen) and (bpp > 8) in fbtft-core.c. According to the kernel coding style, reducing superfluous parentheses makes the code more readable and straightforward. There are no functional changes; it’s purely a cleanup to align the code with kernel style guidelines.

Please wrap your changelog at 72 columns like your editor asked you to.

Quoted 11 lines
---
 drivers/staging/fbtft/fbtft-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fbtft-core.c +0 -0
index 4cfa494243b9..b4e9d6000b9a 100644

drivers/staging/fbtft/fbtft-core.c struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, · line 667

Quoted 5 lines
drivers/staging/fbtft/fbtft-core.c +1 -1
@@ -664,7 +664,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
 		txbuflen = 0;
 
 #ifdef __LITTLE_ENDIAN
-	if ((!txbuflen) && (bpp > 8))
+	if (!txbuflen && bpp > 8)

No, please see the zillions of times I have rejected changes like this in the past on the mailing list. checkpatch.pl is wrong here.

We write code for people first, compilers second. With your change, now you need to look up the order of operations (quick, which is comes first in order, '&&' or '!' or '>')?

With the () there, you know what the intent is, and what the order is, without having to always know what comes before what.

thanks,

greg k-h