All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: xgifb: XGI_main_26: Remove unused code
@ 2015-10-12  9:09 Shivani Bhardwaj
  2015-10-12  9:22 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Shivani Bhardwaj @ 2015-10-12  9:09 UTC (permalink / raw)
  To: outreachy-kernel

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

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
 drivers/staging/xgifb/XGI_main_26.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 5a6251a4..e723082 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -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)) {
-- 
2.1.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: XGI_main_26: Remove unused code
  2015-10-12  9:09 [PATCH] Staging: xgifb: XGI_main_26: Remove unused code Shivani Bhardwaj
@ 2015-10-12  9:22 ` Julia Lawall
  2015-10-12  9:58   ` Shivani Bhardwaj
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2015-10-12  9:22 UTC (permalink / raw)
  To: Shivani Bhardwaj; +Cc: outreachy-kernel

On Mon, 12 Oct 2015, Shivani Bhardwaj wrote:

> Remove unused variable and its occurences as it is not used anywhere in
> the code.
> Issue found using coccinelle.
>
> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
> ---
>  drivers/staging/xgifb/XGI_main_26.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
> index 5a6251a4..e723082 100644
> --- a/drivers/staging/xgifb/XGI_main_26.c
> +++ b/drivers/staging/xgifb/XGI_main_26.c
> @@ -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;

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

julia

> -
>  	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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: XGI_main_26: Remove unused code
  2015-10-12  9:22 ` [Outreachy kernel] " Julia Lawall
@ 2015-10-12  9:58   ` Shivani Bhardwaj
  2015-10-12 10:44     ` Sudip Mukherjee
  0 siblings, 1 reply; 5+ messages in thread
From: Shivani Bhardwaj @ 2015-10-12  9:58 UTC (permalink / raw)
  To: Julia Lawall; +Cc: outreachy-kernel

On Mon, Oct 12, 2015 at 2:52 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Mon, 12 Oct 2015, Shivani Bhardwaj wrote:
>
>> Remove unused variable and its occurences as it is not used anywhere in
>> the code.
>> Issue found using coccinelle.
>>
>> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
>> ---
>>  drivers/staging/xgifb/XGI_main_26.c | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
>> index 5a6251a4..e723082 100644
>> --- a/drivers/staging/xgifb/XGI_main_26.c
>> +++ b/drivers/staging/xgifb/XGI_main_26.c
>> @@ -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;
>
> 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.

>> -
>>       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 outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> 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.
>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: XGI_main_26: Remove unused code
  2015-10-12  9:58   ` Shivani Bhardwaj
@ 2015-10-12 10:44     ` Sudip Mukherjee
  2015-10-12 11:26       ` Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2015-10-12 10:44 UTC (permalink / raw)
  To: Shivani Bhardwaj; +Cc: Julia Lawall, outreachy-kernel

On Mon, Oct 12, 2015 at 03:28:33PM +0530, Shivani Bhardwaj wrote:
> On Mon, Oct 12, 2015 at 2:52 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > On Mon, 12 Oct 2015, Shivani Bhardwaj wrote:
> >
> >> Remove unused variable and its occurences as it is not used anywhere in
> >> the code.
> >> Issue found using coccinelle.
> >>
> >> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
> >> ---
> >>
> >> -     /* 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.

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

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 5a6251a4..0436dbe 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: XGI_main_26: Remove unused code
  2015-10-12 10:44     ` Sudip Mukherjee
@ 2015-10-12 11:26       ` Julia Lawall
  0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2015-10-12 11:26 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Shivani Bhardwaj, outreachy-kernel



On Mon, 12 Oct 2015, Sudip Mukherjee wrote:

> On Mon, Oct 12, 2015 at 03:28:33PM +0530, Shivani Bhardwaj wrote:
> > On Mon, Oct 12, 2015 at 2:52 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > > On Mon, 12 Oct 2015, Shivani Bhardwaj wrote:
> > >
> > >> Remove unused variable and its occurences as it is not used anywhere in
> > >> the code.
> > >> Issue found using coccinelle.
> > >>
> > >> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
> > >> ---
> > >>
> > >> -     /* 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.
>
> From C syntax point of view your patch is correct. But looking at the
> comment mentioned there this could have been:
>
> diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
> index 5a6251a4..0436dbe 100644
> --- a/drivers/staging/xgifb/XGI_main_26.c
> +++ b/drivers/staging/xgifb/XGI_main_26.c
> @@ -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.

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

julia


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-12 11:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-12  9:09 [PATCH] Staging: xgifb: XGI_main_26: Remove unused code Shivani Bhardwaj
2015-10-12  9:22 ` [Outreachy kernel] " Julia Lawall
2015-10-12  9:58   ` Shivani Bhardwaj
2015-10-12 10:44     ` Sudip Mukherjee
2015-10-12 11:26       ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.