Skip to contentSkip to conversation

drm/modes: tag unused variables to avoid warnings

PATCH In review Benjamin Gaignard 3 participants 4 messages Dec 10, 2019 – Jan 9, 2020

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

PATCH 1/1 drm/modes: tag unused variables to avoid warnings

Some variables are set but never used. To avoid warning when compiling with W=1 and keep the algorithm like it is tag theses variables with _maybe_unused macro.

---
changes in this version:
- do not modify the code to remove the unused variables just prefix them with __maybe_unused macro.

 drivers/gpu/drm/drm_modes.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_modes.c +5 -4
index 88232698d7a0..70aed4e2990d 100644
@@ -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, __maybe_unused vback_porch, hblank;
 
 		/* estimated the horizontal period */
 		tmp1 = HV_FACTOR * 1000000  -
@@ -386,9 +386,10 @@ 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, __maybe_unused vback_porch;
+	unsigned int vtotal_lines, __maybe_unused vfieldrate_est;
+	unsigned int __maybe_unused hperiod;
+	unsigned int vfield_rate, __maybe_unused vframe_rate;
 	int left_margin, right_margin;
 	unsigned int total_active_pixels, ideal_duty_cycle;
 	unsigned int hblank, total_pixels, pixel_freq;
Signature · 1 line
2.15.0
#1 lore raw
Quoted 4 lines · Benjamin Gaignard

Some variables are set but never used. To avoid warning when compiling with W=1 and keep the algorithm like it is tag theses variables with _maybe_unused macro.

Gentle ping.
Thanks,
Benjamin

Quoted 44 lines

---
changes in this version:
- do not modify the code to remove the unused variables just prefix them with __maybe_unused macro.

 drivers/gpu/drm/drm_modes.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_modes.c +5 -5
index 88232698d7a0..70aed4e2990d 100644
@@ -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, __maybe_unused vback_porch, hblank;
 
                /* estimated the horizontal period */
                tmp1 = HV_FACTOR * 1000000  -
@@ -386,9 +386,10 @@ 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, __maybe_unused vback_porch;
+       unsigned int vtotal_lines, __maybe_unused vfieldrate_est;
+       unsigned int __maybe_unused hperiod;
+       unsigned int vfield_rate, __maybe_unused vframe_rate;
        int left_margin, right_margin;
        unsigned int total_active_pixels, ideal_duty_cycle;
        unsigned int hblank, total_pixels, pixel_freq;
--

2.15.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Benjamin Gaignard

Hi

Am 10.12.19 um 11:24 schrieb Benjamin Gaignard:

Quoted 5 lines

Some variables are set but never used. To avoid warning when compiling with W=1 and keep the algorithm like it is tag theses variables with _maybe_unused macro.

Quoted 36 lines

---
changes in this version:
- do not modify the code to remove the unused variables just prefix them with __maybe_unused macro.

 drivers/gpu/drm/drm_modes.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_modes.c +5 -4
index 88232698d7a0..70aed4e2990d 100644
@@ -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, __maybe_unused vback_porch, hblank;
 
 		/* estimated the horizontal period */
 		tmp1 = HV_FACTOR * 1000000  -
@@ -386,9 +386,10 @@ 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, __maybe_unused vback_porch;
+	unsigned int vtotal_lines, __maybe_unused vfieldrate_est;
+	unsigned int __maybe_unused hperiod;
+	unsigned int vfield_rate, __maybe_unused vframe_rate;
 	int left_margin, right_margin;
 	unsigned int total_active_pixels, ideal_duty_cycle;
 	unsigned int hblank, total_pixels, pixel_freq;
Signature · 6 lines
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

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 9 lines · Thomas Zimmermann

Hi

Am 10.12.19 um 11:24 schrieb Benjamin Gaignard:

Quoted 5 lines

Some variables are set but never used. To avoid warning when compiling with W=1 and keep the algorithm like it is tag theses variables with _maybe_unused macro.

Applied on drm-misc-next.

Thanks,

Benjamin

Quoted 37 lines
Quoted 37 lines

---
changes in this version:
- do not modify the code to remove the unused variables just prefix them with __maybe_unused macro.

  drivers/gpu/drm/drm_modes.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_modes.c +5 -4
index 88232698d7a0..70aed4e2990d 100644
@@ -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, __maybe_unused vback_porch, hblank;
 
  		/* estimated the horizontal period */
  		tmp1 = HV_FACTOR * 1000000  -
@@ -386,9 +386,10 @@ 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, __maybe_unused vback_porch;
+	unsigned int vtotal_lines, __maybe_unused vfieldrate_est;
+	unsigned int __maybe_unused hperiod;
+	unsigned int vfield_rate, __maybe_unused vframe_rate;
  	int left_margin, right_margin;
  	unsigned int total_active_pixels, ideal_duty_cycle;
  	unsigned int hblank, total_pixels, pixel_freq;