Skip to contentSkip to conversation

Remove explicit type conversions

PATCH New Shivani Bhardwaj 1 participant 4 messages Oct 16, 2015

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

cover Remove explicit type conversions

This patch removes explicit type conversions as compiler can convert the type of variables implicitly.
After applying this patch, code looks better.

Shivani Bhardwaj (3):
Staging: fbtft: fb_agm1264k-fl: Remove unnecessary cast
Staging: fbtft: fb_ra8875: Remove useless cast
Staging: fbtft: fb_ssd1331: Remove unnecessary cast

 drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +-
 drivers/staging/fbtft/fb_ra8875.c      | 2 +-
 drivers/staging/fbtft/fb_ssd1331.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/3 Staging: fbtft: fb_agm1264k-fl: Remove unnecessary cast

Remove explicit typecast from variables as compiler can typecast implicitly.
Semantic patch used:

@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

---
 drivers/staging/fbtft/fb_agm1264k-fl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fb_agm1264k-fl.c +1 -1
index 19f6136..2a50cf9 100644
@@ -177,7 +177,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
 {
 	va_list args;
 	int i, ret;
-	u8 *buf = (u8 *)par->buf;
+	u8 *buf = par->buf;
 
 	if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) {
 		va_start(args, len);
Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/3 Staging: fbtft: fb_ra8875: Remove useless cast

In reply to Shivani Bhardwaj

Remove explicit type conversion as it is not required. Semantic patch used:

@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

---
 drivers/staging/fbtft/fb_ra8875.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fb_ra8875.c +1 -1
index 86e43e1..b167c50 100644
@@ -204,7 +204,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
 {
 	va_list args;
 	int i, ret;
-	u8 *buf = (u8 *)par->buf;
+	u8 *buf = par->buf;
 
 	/* slow down spi-speed for writing registers */
 	par->fbtftops.write = write_spi;
Signature · 1 line
2.1.0
#3 lore raw

PATCH 3/3 Staging: fbtft: fb_ssd1331: Remove unnecessary cast

In reply to Shivani Bhardwaj

Compiler can typecast variables implicitly so, explicit type cast is not required and should be removed.
Semantic patch used:

@@
type T;
T e;
identifier x;
@@

* T x = (T)e;

---
 drivers/staging/fbtft/fb_ssd1331.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fb_ssd1331.c +1 -1
index 53cb8e9..bd294f8 100644
@@ -60,7 +60,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
 {
 	va_list args;
 	int i, ret;
-	u8 *buf = (u8 *)par->buf;
+	u8 *buf = par->buf;
 
 	if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) {
 		va_start(args, len);
Signature · 1 line
2.1.0