Skip to contentSkip to conversation

staging: xgifb: Rename local variable

PATCH In review Janani Ravichandran 3 participants 5 messages Feb 9, 2016 – Feb 10, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: xgifb: Rename local variable

As one of the global variables and a local variable share the same name, change the name of the local variable to avoid confusion.

---
Changes since v1:
* Changed the name of the variable to something more meaningful

 drivers/staging/xgifb/XGI_main_26.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/xgifb/XGI_main_26.c +2 -2
index f11cea1..0091d8d 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 local_refresh_rate, 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;
+		local_refresh_rate = 60;
 
 	search_idx = 0;
 	while ((XGIbios_mode[search_idx].mode_no != 0) &&
Signature · 1 line
2.5.0
#1 lore raw
Quoted 25 lines · Janani Ravichandran

As one of the global variables and a local variable share the same name, change the name of the local variable to avoid confusion.

---
Changes since v1:
* Changed the name of the variable to something more meaningful

 drivers/staging/xgifb/XGI_main_26.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/xgifb/XGI_main_26.c +1 -1
index f11cea1..0091d8d 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 local_refresh_rate, 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 5 lines
drivers/staging/xgifb/XGI_main_26.c +1 -1
@@ -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;
+		local_refresh_rate = 60;

So this variable is only initialized, but never used? If that is the case, then a better solution would be to drop it.

Or maybe it was not intended to introduce the local variable. You might want to see what you can find with git blame on the line that makes the local declaration.

julia

Quoted 13 lines
drivers/staging/xgifb/XGI_main_26.c +0 -0
 	search_idx = 0;
 	while ((XGIbios_mode[search_idx].mode_no != 0) &&
Signature · 8 lines
2.5.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/20160210033729.GA2677%40janani-Inspiron-3521.
For more options, visit https://groups.google.com/d/optout.
#2 lore raw
Quoted 38 lines · Julia Lawall
Quoted 25 lines · Janani Ravichandran

As one of the global variables and a local variable share the same name, change the name of the local variable to avoid confusion.

---
Changes since v1:
* Changed the name of the variable to something more meaningful

 drivers/staging/xgifb/XGI_main_26.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/xgifb/XGI_main_26.c +1 -1
index f11cea1..0091d8d 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 local_refresh_rate, 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 5 lines
drivers/staging/xgifb/XGI_main_26.c +1 -1
@@ -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;
+		local_refresh_rate = 60;

So this variable is only initialized, but never used? If that is the case, then a better solution would be to drop it.

Quoted 3 lines

Or maybe it was not intended to introduce the local variable. You might want to see what you can find with git blame on the line that makes the local declaration.

If you remember in the last round of Outreachy also we had a similar discussion, I will see if I can find out that thread.

regards
sudip

#3 lore raw
Quoted 5 lines
Quoted 4 lines

So this variable is only initialized, but never used? If that is the case, then a better solution would be to drop it.

I was in fact debating between dropping it and renaming it but decided on renaming it as I thought it might be used in the future, looking at the if() check and the comment above it. Not sure if this was a good idea.

Quoted 4 lines
Quoted 3 lines

Or maybe it was not intended to introduce the local variable. You might want to see what you can find with git blame on the line that makes the local declaration.

Sure, I will do that.

Quoted 3 lines

If you remember in the last round of Outreachy also we had a similar discussion, I will see if I can find out that thread.

I'd love to see it, Sudip.

Thanks,
Janani.

Quoted 4 lines

regards
sudip

#4 lore raw
Quoted 13 lines · Janani Ravichandran
Quoted 5 lines
Quoted 4 lines

So this variable is only initialized, but never used? If that is the case, then a better solution would be to drop it.

I was in fact debating between dropping it and renaming it but decided on renaming it as I thought it might be used in the future, looking at the if() check and the comment above it. Not sure if this was a good idea.

Quoted 4 lines
Quoted 3 lines

Or maybe it was not intended to introduce the local variable. You might want to see what you can find with git blame on the line that makes the local declaration.

Quoted 7 lines

Sure, I will do that.

Quoted 3 lines

If you remember in the last round of Outreachy also we had a similar discussion, I will see if I can find out that thread.

I'd love to see it, Sudip.

https://groups.google.com/forum/#!searchin/outreachy-kernel/Staging$3A$20xgifb$3A$20XGI_main_26$3A$20Remove$20unused$20code/outreachy-kernel/fsXHgjdyx40/Omgja2r3CgAJ

regards
sudip