All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Benjamin Gaignard <benjamin.gaignard@st.com>,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	sean@poorly.run, airlied@linux.ie, daniel@ffwll.ch
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/modes: remove unused variables
Date: Wed, 4 Dec 2019 10:35:50 +0100	[thread overview]
Message-ID: <8056f838-3ebf-26db-f5be-3e78d61aa512@suse.de> (raw)
In-Reply-To: <20191119134706.10893-1-benjamin.gaignard@st.com>


[-- Attachment #1.1: Type: text/plain, Size: 3659 bytes --]

Hi

Am 19.11.19 um 14:47 schrieb Benjamin Gaignard:
> When compiling with W=1 few warnings about unused variables show up.
> This patch removes all the involved variables.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
>  drivers/gpu/drm/drm_modes.c | 22 +++-------------------
>  1 file changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 88232698d7a0..aca901aff042 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -233,7 +233,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay,
>  		/* 3) Nominal HSync width (% of line period) - default 8 */
>  #define CVT_HSYNC_PERCENTAGE	8
>  		unsigned int hblank_percentage;
> -		int vsyncandback_porch, vback_porch, hblank;
> +		int vsyncandback_porch, hblank;
>  
>  		/* estimated the horizontal period */
>  		tmp1 = HV_FACTOR * 1000000  -
> @@ -249,7 +249,6 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay,
>  		else
>  			vsyncandback_porch = tmp1;
>  		/* 10. Find number of lines in back porch */
> -		vback_porch = vsyncandback_porch - vsync;
>  		drm_mode->vtotal = vdisplay_rnd + 2 * vmargin +
>  				vsyncandback_porch + CVT_MIN_V_PORCH;
>  		/* 5) Definition of Horizontal blanking time limitation */
> @@ -386,9 +385,8 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, int vdisplay,
>  	int top_margin, bottom_margin;
>  	int interlace;
>  	unsigned int hfreq_est;
> -	int vsync_plus_bp, vback_porch;
> -	unsigned int vtotal_lines, vfieldrate_est, hperiod;
> -	unsigned int vfield_rate, vframe_rate;
> +	int vsync_plus_bp;
> +	unsigned int vtotal_lines;
>  	int left_margin, right_margin;
>  	unsigned int total_active_pixels, ideal_duty_cycle;
>  	unsigned int hblank, total_pixels, pixel_freq;
> @@ -451,23 +449,9 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, int vdisplay,
>  	/* [V SYNC+BP] = RINT(([MIN VSYNC+BP] * hfreq_est / 1000000)) */
>  	vsync_plus_bp = MIN_VSYNC_PLUS_BP * hfreq_est / 1000;
>  	vsync_plus_bp = (vsync_plus_bp + 500) / 1000;
> -	/*  9. Find the number of lines in V back porch alone: */
> -	vback_porch = vsync_plus_bp - V_SYNC_RQD;
>  	/*  10. Find the total number of lines in Vertical field period: */
>  	vtotal_lines = vdisplay_rnd + top_margin + bottom_margin +
>  			vsync_plus_bp + GTF_MIN_V_PORCH;
> -	/*  11. Estimate the Vertical field frequency: */
> -	vfieldrate_est = hfreq_est / vtotal_lines;
> -	/*  12. Find the actual horizontal period: */
> -	hperiod = 1000000 / (vfieldrate_rqd * vtotal_lines);
> -
> -	/*  13. Find the actual Vertical field frequency: */
> -	vfield_rate = hfreq_est / vtotal_lines;
> -	/*  14. Find the Vertical frame frequency: */
> -	if (interlaced)
> -		vframe_rate = vfield_rate / 2;
> -	else
> -		vframe_rate = vfield_rate;

The amount of unused code is quite large, which makes me wonder if
there's something missing below where these variables are supposed to be
used.

If these variables can be removed, comments should mention that steps 9
and 11 to 14 are being left out. After all, the function is fairly
explicit about implementing the GTF algorithm step by step.

Best regards
Thomas

>  	/*  15. Find number of pixels in left margin: */
>  	if (margins)
>  		left_margin = (hdisplay_rnd * GTF_MARGIN_PERCENTAGE + 500) /
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Benjamin Gaignard <benjamin.gaignard@st.com>,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	sean@poorly.run, airlied@linux.ie, daniel@ffwll.ch
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/modes: remove unused variables
Date: Wed, 4 Dec 2019 10:35:50 +0100	[thread overview]
Message-ID: <8056f838-3ebf-26db-f5be-3e78d61aa512@suse.de> (raw)
In-Reply-To: <20191119134706.10893-1-benjamin.gaignard@st.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 3659 bytes --]

Hi

Am 19.11.19 um 14:47 schrieb Benjamin Gaignard:
> When compiling with W=1 few warnings about unused variables show up.
> This patch removes all the involved variables.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
>  drivers/gpu/drm/drm_modes.c | 22 +++-------------------
>  1 file changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 88232698d7a0..aca901aff042 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -233,7 +233,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay,
>  		/* 3) Nominal HSync width (% of line period) - default 8 */
>  #define CVT_HSYNC_PERCENTAGE	8
>  		unsigned int hblank_percentage;
> -		int vsyncandback_porch, vback_porch, hblank;
> +		int vsyncandback_porch, hblank;
>  
>  		/* estimated the horizontal period */
>  		tmp1 = HV_FACTOR * 1000000  -
> @@ -249,7 +249,6 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay,
>  		else
>  			vsyncandback_porch = tmp1;
>  		/* 10. Find number of lines in back porch */
> -		vback_porch = vsyncandback_porch - vsync;
>  		drm_mode->vtotal = vdisplay_rnd + 2 * vmargin +
>  				vsyncandback_porch + CVT_MIN_V_PORCH;
>  		/* 5) Definition of Horizontal blanking time limitation */
> @@ -386,9 +385,8 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, int vdisplay,
>  	int top_margin, bottom_margin;
>  	int interlace;
>  	unsigned int hfreq_est;
> -	int vsync_plus_bp, vback_porch;
> -	unsigned int vtotal_lines, vfieldrate_est, hperiod;
> -	unsigned int vfield_rate, vframe_rate;
> +	int vsync_plus_bp;
> +	unsigned int vtotal_lines;
>  	int left_margin, right_margin;
>  	unsigned int total_active_pixels, ideal_duty_cycle;
>  	unsigned int hblank, total_pixels, pixel_freq;
> @@ -451,23 +449,9 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, int vdisplay,
>  	/* [V SYNC+BP] = RINT(([MIN VSYNC+BP] * hfreq_est / 1000000)) */
>  	vsync_plus_bp = MIN_VSYNC_PLUS_BP * hfreq_est / 1000;
>  	vsync_plus_bp = (vsync_plus_bp + 500) / 1000;
> -	/*  9. Find the number of lines in V back porch alone: */
> -	vback_porch = vsync_plus_bp - V_SYNC_RQD;
>  	/*  10. Find the total number of lines in Vertical field period: */
>  	vtotal_lines = vdisplay_rnd + top_margin + bottom_margin +
>  			vsync_plus_bp + GTF_MIN_V_PORCH;
> -	/*  11. Estimate the Vertical field frequency: */
> -	vfieldrate_est = hfreq_est / vtotal_lines;
> -	/*  12. Find the actual horizontal period: */
> -	hperiod = 1000000 / (vfieldrate_rqd * vtotal_lines);
> -
> -	/*  13. Find the actual Vertical field frequency: */
> -	vfield_rate = hfreq_est / vtotal_lines;
> -	/*  14. Find the Vertical frame frequency: */
> -	if (interlaced)
> -		vframe_rate = vfield_rate / 2;
> -	else
> -		vframe_rate = vfield_rate;

The amount of unused code is quite large, which makes me wonder if
there's something missing below where these variables are supposed to be
used.

If these variables can be removed, comments should mention that steps 9
and 11 to 14 are being left out. After all, the function is fairly
explicit about implementing the GTF algorithm step by step.

Best regards
Thomas

>  	/*  15. Find number of pixels in left margin: */
>  	if (margins)
>  		left_margin = (hdisplay_rnd * GTF_MARGIN_PERCENTAGE + 500) /
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-12-04  9:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 13:47 [PATCH] drm/modes: remove unused variables Benjamin Gaignard
2019-11-19 13:47 ` Benjamin Gaignard
2019-11-19 13:47 ` Benjamin Gaignard
2019-12-03 16:50 ` Benjamin Gaignard
2019-12-03 16:50   ` Benjamin Gaignard
2019-12-04  9:35 ` Thomas Zimmermann [this message]
2019-12-04  9:35   ` Thomas Zimmermann
2019-12-04 10:07   ` Benjamin GAIGNARD
2019-12-04 10:07     ` Benjamin GAIGNARD
2019-12-05  9:55     ` Jani Nikula
2019-12-05  9:55       ` Jani Nikula
2019-12-05 10:23       ` Benjamin GAIGNARD
2019-12-05 10:23         ` Benjamin GAIGNARD
2019-12-10  9:52         ` Daniel Vetter
2019-12-10  9:52           ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8056f838-3ebf-26db-f5be-3e78d61aa512@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=benjamin.gaignard@st.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=sean@poorly.run \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.