Skip to contentSkip to conversation

Staging: xgifb: XGI_main_26: Remove unused code

PATCH In review Shivani Bhardwaj 3 participants 5 messages Oct 12, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: xgifb: XGI_main_26: Remove unused code

Remove unused variable and its occurences as it is not used anywhere in the code.
Issue found using coccinelle.

---
 drivers/staging/xgifb/XGI_main_26.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/xgifb/XGI_main_26.c +1 -5
index 5a6251a4..e723082 100644
@@ -1230,7 +1230,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 	unsigned int vtotal = 0;
 	unsigned int drate = 0, hrate = 0;
 	int found_mode = 0;
-	int refresh_rate, search_idx;
+	int search_idx;
 
 	if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
 		vtotal = var->upper_margin + var->yres + var->lower_margin
@@ -1266,10 +1266,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 		xgifb_info->refresh_rate = 60;
 	}
 
-	/* Calculation wrong for 1024x600 - force it to 60Hz */
-	if ((var->xres == 1024) && (var->yres == 600))
-		refresh_rate = 60;
-
 	search_idx = 0;
 	while ((XGIbios_mode[search_idx].mode_no != 0) &&
 		(XGIbios_mode[search_idx].xres <= var->xres)) {
Signature · 1 line
2.1.0
#1 lore raw
Quoted 23 lines · Shivani Bhardwaj

Remove unused variable and its occurences as it is not used anywhere in the code.
Issue found using coccinelle.

---
 drivers/staging/xgifb/XGI_main_26.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/xgifb/XGI_main_26.c +1 -1
index 5a6251a4..e723082 100644
@@ -1230,7 +1230,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 	unsigned int vtotal = 0;
 	unsigned int drate = 0, hrate = 0;
 	int found_mode = 0;
-	int refresh_rate, search_idx;
+	int search_idx;
 
 	if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
 		vtotal = var->upper_margin + var->yres + var->lower_margin

drivers/staging/xgifb/XGI_main_26.c static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) · line 1271

Quoted 6 lines
drivers/staging/xgifb/XGI_main_26.c +0 -3
@@ -1266,10 +1266,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 		xgifb_info->refresh_rate = 60;
 	}
 
-	/* Calculation wrong for 1024x600 - force it to 60Hz */
-	if ((var->xres == 1024) && (var->yres == 600))
-		refresh_rate = 60;

Could it be supposed to be xgifb_info->refresh_rate = 60; ?

julia

Quoted 14 lines
drivers/staging/xgifb/XGI_main_26.c +0 -2
-
 	search_idx = 0;
 	while ((XGIbios_mode[search_idx].mode_no != 0) &&
 		(XGIbios_mode[search_idx].xres <= var->xres)) {
--

2.1.0

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151012090922.GA30043%40ubuntu.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 28 lines · Julia Lawall
Quoted 26 lines · Shivani Bhardwaj

Remove unused variable and its occurences as it is not used anywhere in the code.
Issue found using coccinelle.

---
 drivers/staging/xgifb/XGI_main_26.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/xgifb/XGI_main_26.c +1 -1
index 5a6251a4..e723082 100644
@@ -1230,7 +1230,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
      unsigned int vtotal = 0;
      unsigned int drate = 0, hrate = 0;
      int found_mode = 0;
-     int refresh_rate, search_idx;
+     int search_idx;
 
      if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
              vtotal = var->upper_margin + var->yres + var->lower_margin
@@ -1266,10 +1266,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
              xgifb_info->refresh_rate = 60;
      }
 
Quoted 8 lines

drivers/staging/xgifb/XGI_main_26.c static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) · line 1271

Quoted 3 lines
drivers/staging/xgifb/XGI_main_26.c +0 -3
-     /* Calculation wrong for 1024x600 - force it to 60Hz */
-     if ((var->xres == 1024) && (var->yres == 600))
-             refresh_rate = 60;

Could it be supposed to be xgifb_info->refresh_rate = 60; ?

julia

Won't that be a part of structure whose object is xgifb_info? This is any normal int type. Plus, it doesn't give any errors when removed, it should have if it were xgifb_info's member. Please correct me if I am wrong.

Quoted 14 lines
Quoted 14 lines
drivers/staging/xgifb/XGI_main_26.c +0 -2
-
      search_idx = 0;
      while ((XGIbios_mode[search_idx].mode_no != 0) &&
              (XGIbios_mode[search_idx].xres <= var->xres)) {
--

2.1.0

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151012090922.GA30043%40ubuntu.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 16 lines · Shivani Bhardwaj
Quoted 15 lines · Julia Lawall

Review

Quoted 10 lines · Shivani Bhardwaj

Remove unused variable and its occurences as it is not used anywhere in the code.
Issue found using coccinelle.

---

(quoted diff) +0 -3
-     /* Calculation wrong for 1024x600 - force it to 60Hz */
-     if ((var->xres == 1024) && (var->yres == 600))
-             refresh_rate = 60;

Could it be supposed to be xgifb_info->refresh_rate = 60; ?

Quoted 7 lines
Quoted 2 lines

julia

Won't that be a part of structure whose object is xgifb_info? This is any normal int type. Plus, it doesn't give any errors when removed, it should have if it were xgifb_info's member. Please correct me if I am wrong.

From C syntax point of view your patch is correct. But looking at the comment mentioned there this could have been:

drivers/staging/xgifb/XGI_main_26.c +2 -2
index 5a6251a4..0436dbe 100644
@@ -1230,7 +1230,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 	unsigned int vtotal = 0;
 	unsigned int drate = 0, hrate = 0;
 	int found_mode = 0;
-	int refresh_rate, search_idx;
+	int search_idx;
 
 	if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
 		vtotal = var->upper_margin + var->yres + var->lower_margin
@@ -1268,7 +1268,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
 	/* Calculation wrong for 1024x600 - force it to 60Hz */
 	if ((var->xres == 1024) && (var->yres == 600))
-		refresh_rate = 60;
+		xgifb_info->refresh_rate = 60;
 
 	search_idx = 0;
 	while ((XGIbios_mode[search_idx].mode_no != 0) &&

---
Maybe this was the actual intention of the developer as there is also another global static variable named as refresh_rate which is having the refresh frequency and saving the Hz value in xgifb_info->refresh_rate. But that part is in the probe function and the probe will be called before fb_check_var callback.
Anyways, this was just a thought, please donot send v2 based on this. Let Greg see it first.

regards
sudip

#4 lore raw
Quoted 52 lines · Sudip Mukherjee
Quoted 16 lines · Shivani Bhardwaj
Quoted 15 lines · Julia Lawall

Review

Quoted 10 lines · Shivani Bhardwaj

Remove unused variable and its occurences as it is not used anywhere in the code.
Issue found using coccinelle.

---

(quoted diff) +0 -3
-     /* Calculation wrong for 1024x600 - force it to 60Hz */
-     if ((var->xres == 1024) && (var->yres == 600))
-             refresh_rate = 60;

Could it be supposed to be xgifb_info->refresh_rate = 60; ?

Quoted 7 lines
Quoted 2 lines

julia

Won't that be a part of structure whose object is xgifb_info? This is any normal int type. Plus, it doesn't give any errors when removed, it should have if it were xgifb_info's member. Please correct me if I am wrong.

From C syntax point of view your patch is correct. But looking at the comment mentioned there this could have been:

drivers/staging/xgifb/XGI_main_26.c +2 -3
index 5a6251a4..0436dbe 100644
@@ -1230,7 +1230,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 	unsigned int vtotal = 0;
 	unsigned int drate = 0, hrate = 0;
 	int found_mode = 0;
-	int refresh_rate, search_idx;
+	int search_idx;
 
 	if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
 		vtotal = var->upper_margin + var->yres + var->lower_margin
@@ -1268,7 +1268,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
 	/* Calculation wrong for 1024x600 - force it to 60Hz */
 	if ((var->xres == 1024) && (var->yres == 600))
-		refresh_rate = 60;
+		xgifb_info->refresh_rate = 60;
 
 	search_idx = 0;
 	while ((XGIbios_mode[search_idx].mode_no != 0) &&
 
---
Quoted 7 lines

Maybe this was the actual intention of the developer as there is also another global static variable named as refresh_rate which is having the refresh frequency and saving the Hz value in xgifb_info->refresh_rate. But that part is in the probe function and the probe will be called before fb_check_var callback.
Anyways, this was just a thought, please donot send v2 based on this. Let Greg see it first.

Perhaps it is possible to ask the specific maintainer for the code, or the original developer.

julia