drm: atomic helper: fix W=1 warnings

Submitted by Benjamin Gaignard on Sept. 9, 2019, 1:52 p.m.

Details

Message ID 20190909135205.10277-2-benjamin.gaignard@st.com
State New
Headers show
Series "drm: include: fix W=1 warnings in struct drm_dsc_config" ( rev: 2 ) in DRI devel

Not browsing as part of any series.

Commit Message

Benjamin Gaignard Sept. 9, 2019, 1:52 p.m.
Fix warnings with W=1.
Few for_each macro set variables that are never used later.
Prevent warning by marking these variables as __maybe_unused.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index aa16ea17ff9b..b69d17b0b9bd 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -262,7 +262,7 @@  steal_encoder(struct drm_atomic_state *state,
 	      struct drm_encoder *encoder)
 {
 	struct drm_crtc_state *crtc_state;
-	struct drm_connector *connector;
+	struct drm_connector __maybe_unused *connector;
 	struct drm_connector_state *old_connector_state, *new_connector_state;
 	int i;
 
@@ -412,7 +412,7 @@  mode_fixup(struct drm_atomic_state *state)
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *new_crtc_state;
-	struct drm_connector *connector;
+	struct drm_connector __maybe_unused *connector;
 	struct drm_connector_state *new_conn_state;
 	int i;
 	int ret;
@@ -608,7 +608,7 @@  drm_atomic_helper_check_modeset(struct drm_device *dev,
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
-	struct drm_connector *connector;
+	struct drm_connector __maybe_unused *connector;
 	struct drm_connector_state *old_connector_state, *new_connector_state;
 	int i, ret;
 	unsigned connectors_mask = 0;
@@ -984,7 +984,7 @@  crtc_needs_disable(struct drm_crtc_state *old_state,
 static void
 disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
 {
-	struct drm_connector *connector;
+	struct drm_connector __maybe_unused *connector;
 	struct drm_connector_state *old_conn_state, *new_conn_state;
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
@@ -1173,7 +1173,7 @@  crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *new_crtc_state;
-	struct drm_connector *connector;
+	struct drm_connector __maybe_unused *connector;
 	struct drm_connector_state *new_conn_state;
 	int i;
 
@@ -1294,7 +1294,7 @@  void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *old_crtc_state;
 	struct drm_crtc_state *new_crtc_state;
-	struct drm_connector *connector;
+	struct drm_connector __maybe_unused *connector;
 	struct drm_connector_state *new_conn_state;
 	int i;
 
@@ -1384,7 +1384,7 @@  int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
 				      struct drm_atomic_state *state,
 				      bool pre_swap)
 {
-	struct drm_plane *plane;
+	struct drm_plane __maybe_unused *plane;
 	struct drm_plane_state *new_plane_state;
 	int i, ret;
 
@@ -1431,7 +1431,7 @@  drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
 		struct drm_atomic_state *old_state)
 {
 	struct drm_crtc *crtc;
-	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
+	struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
 	int i, ret;
 	unsigned crtc_mask = 0;
 
@@ -1621,7 +1621,7 @@  static void commit_work(struct work_struct *work)
 int drm_atomic_helper_async_check(struct drm_device *dev,
 				   struct drm_atomic_state *state)
 {
-	struct drm_crtc *crtc;
+	struct drm_crtc __maybe_unused *crtc;
 	struct drm_crtc_state *crtc_state;
 	struct drm_plane *plane = NULL;
 	struct drm_plane_state *old_plane_state = NULL;
@@ -1982,9 +1982,9 @@  int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
-	struct drm_connector *conn;
+	struct drm_connector __maybe_unused *conn;
 	struct drm_connector_state *old_conn_state, *new_conn_state;
-	struct drm_plane *plane;
+	struct drm_plane __maybe_unused *plane;
 	struct drm_plane_state *old_plane_state, *new_plane_state;
 	struct drm_crtc_commit *commit;
 	int i, ret;
@@ -2214,7 +2214,7 @@  EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
  */
 void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
 {
-	struct drm_crtc *crtc;
+	struct drm_crtc __maybe_unused *crtc;
 	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
 	struct drm_crtc_commit *commit;
 	int i;
@@ -2300,7 +2300,7 @@  EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
 int drm_atomic_helper_prepare_planes(struct drm_device *dev,
 				     struct drm_atomic_state *state)
 {
-	struct drm_connector *connector;
+	struct drm_connector __maybe_unused *connector;
 	struct drm_connector_state *new_conn_state;
 	struct drm_plane *plane;
 	struct drm_plane_state *new_plane_state;
@@ -2953,9 +2953,9 @@  int drm_atomic_helper_disable_all(struct drm_device *dev,
 {
 	struct drm_atomic_state *state;
 	struct drm_connector_state *conn_state;
-	struct drm_connector *conn;
+	struct drm_connector __maybe_unused *conn;
 	struct drm_plane_state *plane_state;
-	struct drm_plane *plane;
+	struct drm_plane __maybe_unused *plane;
 	struct drm_crtc_state *crtc_state;
 	struct drm_crtc *crtc;
 	int ret, i;
@@ -3199,11 +3199,11 @@  int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
 {
 	int i, ret;
 	struct drm_plane *plane;
-	struct drm_plane_state *new_plane_state;
+	struct drm_plane_state __maybe_unused *new_plane_state;
 	struct drm_connector *connector;
-	struct drm_connector_state *new_conn_state;
+	struct drm_connector_state __maybe_unused *new_conn_state;
 	struct drm_crtc *crtc;
-	struct drm_crtc_state *new_crtc_state;
+	struct drm_crtc_state __maybe_unused *new_crtc_state;
 
 	state->acquire_ctx = ctx;
 

Comments

Le lun. 9 sept. 2019 à 16:41, Benjamin Gaignard
<benjamin.gaignard@st.com> a écrit :
>
> Fix warnings with W=1.
> Few for_each macro set variables that are never used later.
> Prevent warning by marking these variables as __maybe_unused.
>

A little up on this one because it may exist others ways to fix these warnings.
Get feedback on this path could give the direction for similar ones in drm.

Thanks,
Benjamin

> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index aa16ea17ff9b..b69d17b0b9bd 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
>               struct drm_encoder *encoder)
>  {
>         struct drm_crtc_state *crtc_state;
> -       struct drm_connector *connector;
> +       struct drm_connector __maybe_unused *connector;
>         struct drm_connector_state *old_connector_state, *new_connector_state;
>         int i;
>
> @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state)
>  {
>         struct drm_crtc *crtc;
>         struct drm_crtc_state *new_crtc_state;
> -       struct drm_connector *connector;
> +       struct drm_connector __maybe_unused *connector;
>         struct drm_connector_state *new_conn_state;
>         int i;
>         int ret;
> @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
>  {
>         struct drm_crtc *crtc;
>         struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> -       struct drm_connector *connector;
> +       struct drm_connector __maybe_unused *connector;
>         struct drm_connector_state *old_connector_state, *new_connector_state;
>         int i, ret;
>         unsigned connectors_mask = 0;
> @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
>  static void
>  disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
>  {
> -       struct drm_connector *connector;
> +       struct drm_connector __maybe_unused *connector;
>         struct drm_connector_state *old_conn_state, *new_conn_state;
>         struct drm_crtc *crtc;
>         struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
>  {
>         struct drm_crtc *crtc;
>         struct drm_crtc_state *new_crtc_state;
> -       struct drm_connector *connector;
> +       struct drm_connector __maybe_unused *connector;
>         struct drm_connector_state *new_conn_state;
>         int i;
>
> @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
>         struct drm_crtc *crtc;
>         struct drm_crtc_state *old_crtc_state;
>         struct drm_crtc_state *new_crtc_state;
> -       struct drm_connector *connector;
> +       struct drm_connector __maybe_unused *connector;
>         struct drm_connector_state *new_conn_state;
>         int i;
>
> @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
>                                       struct drm_atomic_state *state,
>                                       bool pre_swap)
>  {
> -       struct drm_plane *plane;
> +       struct drm_plane __maybe_unused *plane;
>         struct drm_plane_state *new_plane_state;
>         int i, ret;
>
> @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
>                 struct drm_atomic_state *old_state)
>  {
>         struct drm_crtc *crtc;
> -       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> +       struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
>         int i, ret;
>         unsigned crtc_mask = 0;
>
> @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work)
>  int drm_atomic_helper_async_check(struct drm_device *dev,
>                                    struct drm_atomic_state *state)
>  {
> -       struct drm_crtc *crtc;
> +       struct drm_crtc __maybe_unused *crtc;
>         struct drm_crtc_state *crtc_state;
>         struct drm_plane *plane = NULL;
>         struct drm_plane_state *old_plane_state = NULL;
> @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
>  {
>         struct drm_crtc *crtc;
>         struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> -       struct drm_connector *conn;
> +       struct drm_connector __maybe_unused *conn;
>         struct drm_connector_state *old_conn_state, *new_conn_state;
> -       struct drm_plane *plane;
> +       struct drm_plane __maybe_unused *plane;
>         struct drm_plane_state *old_plane_state, *new_plane_state;
>         struct drm_crtc_commit *commit;
>         int i, ret;
> @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
>   */
>  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
>  {
> -       struct drm_crtc *crtc;
> +       struct drm_crtc __maybe_unused *crtc;
>         struct drm_crtc_state *old_crtc_state, *new_crtc_state;
>         struct drm_crtc_commit *commit;
>         int i;
> @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
>  int drm_atomic_helper_prepare_planes(struct drm_device *dev,
>                                      struct drm_atomic_state *state)
>  {
> -       struct drm_connector *connector;
> +       struct drm_connector __maybe_unused *connector;
>         struct drm_connector_state *new_conn_state;
>         struct drm_plane *plane;
>         struct drm_plane_state *new_plane_state;
> @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  {
>         struct drm_atomic_state *state;
>         struct drm_connector_state *conn_state;
> -       struct drm_connector *conn;
> +       struct drm_connector __maybe_unused *conn;
>         struct drm_plane_state *plane_state;
> -       struct drm_plane *plane;
> +       struct drm_plane __maybe_unused *plane;
>         struct drm_crtc_state *crtc_state;
>         struct drm_crtc *crtc;
>         int ret, i;
> @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
>  {
>         int i, ret;
>         struct drm_plane *plane;
> -       struct drm_plane_state *new_plane_state;
> +       struct drm_plane_state __maybe_unused *new_plane_state;
>         struct drm_connector *connector;
> -       struct drm_connector_state *new_conn_state;
> +       struct drm_connector_state __maybe_unused *new_conn_state;
>         struct drm_crtc *crtc;
> -       struct drm_crtc_state *new_crtc_state;
> +       struct drm_crtc_state __maybe_unused *new_crtc_state;
>
>         state->acquire_ctx = ctx;
>
> --
> 2.15.0
>
Le lun. 16 sept. 2019 à 15:19, Benjamin Gaignard
<benjamin.gaignard@linaro.org> a écrit :
>
> Le lun. 9 sept. 2019 à 16:41, Benjamin Gaignard
> <benjamin.gaignard@st.com> a écrit :
> >
> > Fix warnings with W=1.
> > Few for_each macro set variables that are never used later.
> > Prevent warning by marking these variables as __maybe_unused.
> >
>

Gentle Ping

benjamin

> A little up on this one because it may exist others ways to fix these warnings.
> Get feedback on this path could give the direction for similar ones in drm.
>
> Thanks,
> Benjamin
>
> > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
> >  1 file changed, 18 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index aa16ea17ff9b..b69d17b0b9bd 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
> >               struct drm_encoder *encoder)
> >  {
> >         struct drm_crtc_state *crtc_state;
> > -       struct drm_connector *connector;
> > +       struct drm_connector __maybe_unused *connector;
> >         struct drm_connector_state *old_connector_state, *new_connector_state;
> >         int i;
> >
> > @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state)
> >  {
> >         struct drm_crtc *crtc;
> >         struct drm_crtc_state *new_crtc_state;
> > -       struct drm_connector *connector;
> > +       struct drm_connector __maybe_unused *connector;
> >         struct drm_connector_state *new_conn_state;
> >         int i;
> >         int ret;
> > @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
> >  {
> >         struct drm_crtc *crtc;
> >         struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > -       struct drm_connector *connector;
> > +       struct drm_connector __maybe_unused *connector;
> >         struct drm_connector_state *old_connector_state, *new_connector_state;
> >         int i, ret;
> >         unsigned connectors_mask = 0;
> > @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
> >  static void
> >  disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> >  {
> > -       struct drm_connector *connector;
> > +       struct drm_connector __maybe_unused *connector;
> >         struct drm_connector_state *old_conn_state, *new_conn_state;
> >         struct drm_crtc *crtc;
> >         struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
> >  {
> >         struct drm_crtc *crtc;
> >         struct drm_crtc_state *new_crtc_state;
> > -       struct drm_connector *connector;
> > +       struct drm_connector __maybe_unused *connector;
> >         struct drm_connector_state *new_conn_state;
> >         int i;
> >
> > @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> >         struct drm_crtc *crtc;
> >         struct drm_crtc_state *old_crtc_state;
> >         struct drm_crtc_state *new_crtc_state;
> > -       struct drm_connector *connector;
> > +       struct drm_connector __maybe_unused *connector;
> >         struct drm_connector_state *new_conn_state;
> >         int i;
> >
> > @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
> >                                       struct drm_atomic_state *state,
> >                                       bool pre_swap)
> >  {
> > -       struct drm_plane *plane;
> > +       struct drm_plane __maybe_unused *plane;
> >         struct drm_plane_state *new_plane_state;
> >         int i, ret;
> >
> > @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
> >                 struct drm_atomic_state *old_state)
> >  {
> >         struct drm_crtc *crtc;
> > -       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > +       struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
> >         int i, ret;
> >         unsigned crtc_mask = 0;
> >
> > @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work)
> >  int drm_atomic_helper_async_check(struct drm_device *dev,
> >                                    struct drm_atomic_state *state)
> >  {
> > -       struct drm_crtc *crtc;
> > +       struct drm_crtc __maybe_unused *crtc;
> >         struct drm_crtc_state *crtc_state;
> >         struct drm_plane *plane = NULL;
> >         struct drm_plane_state *old_plane_state = NULL;
> > @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
> >  {
> >         struct drm_crtc *crtc;
> >         struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > -       struct drm_connector *conn;
> > +       struct drm_connector __maybe_unused *conn;
> >         struct drm_connector_state *old_conn_state, *new_conn_state;
> > -       struct drm_plane *plane;
> > +       struct drm_plane __maybe_unused *plane;
> >         struct drm_plane_state *old_plane_state, *new_plane_state;
> >         struct drm_crtc_commit *commit;
> >         int i, ret;
> > @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> >   */
> >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> >  {
> > -       struct drm_crtc *crtc;
> > +       struct drm_crtc __maybe_unused *crtc;
> >         struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> >         struct drm_crtc_commit *commit;
> >         int i;
> > @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
> >  int drm_atomic_helper_prepare_planes(struct drm_device *dev,
> >                                      struct drm_atomic_state *state)
> >  {
> > -       struct drm_connector *connector;
> > +       struct drm_connector __maybe_unused *connector;
> >         struct drm_connector_state *new_conn_state;
> >         struct drm_plane *plane;
> >         struct drm_plane_state *new_plane_state;
> > @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> >  {
> >         struct drm_atomic_state *state;
> >         struct drm_connector_state *conn_state;
> > -       struct drm_connector *conn;
> > +       struct drm_connector __maybe_unused *conn;
> >         struct drm_plane_state *plane_state;
> > -       struct drm_plane *plane;
> > +       struct drm_plane __maybe_unused *plane;
> >         struct drm_crtc_state *crtc_state;
> >         struct drm_crtc *crtc;
> >         int ret, i;
> > @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
> >  {
> >         int i, ret;
> >         struct drm_plane *plane;
> > -       struct drm_plane_state *new_plane_state;
> > +       struct drm_plane_state __maybe_unused *new_plane_state;
> >         struct drm_connector *connector;
> > -       struct drm_connector_state *new_conn_state;
> > +       struct drm_connector_state __maybe_unused *new_conn_state;
> >         struct drm_crtc *crtc;
> > -       struct drm_crtc_state *new_crtc_state;
> > +       struct drm_crtc_state __maybe_unused *new_crtc_state;
> >
> >         state->acquire_ctx = ctx;
> >
> > --
> > 2.15.0
> >
On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:
> Fix warnings with W=1.
> Few for_each macro set variables that are never used later.
> Prevent warning by marking these variables as __maybe_unused.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index aa16ea17ff9b..b69d17b0b9bd 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
>  	      struct drm_encoder *encoder)
>  {
>  	struct drm_crtc_state *crtc_state;
> -	struct drm_connector *connector;
> +	struct drm_connector __maybe_unused *connector;

Rather ugly. IMO would be nicer if we could hide something inside
the iterator macros to suppress the warning.

>  	struct drm_connector_state *old_connector_state, *new_connector_state;
>  	int i;
>  
> @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state)
>  {
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *new_crtc_state;
> -	struct drm_connector *connector;
> +	struct drm_connector __maybe_unused *connector;
>  	struct drm_connector_state *new_conn_state;
>  	int i;
>  	int ret;
> @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
>  {
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> -	struct drm_connector *connector;
> +	struct drm_connector __maybe_unused *connector;
>  	struct drm_connector_state *old_connector_state, *new_connector_state;
>  	int i, ret;
>  	unsigned connectors_mask = 0;
> @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
>  static void
>  disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
>  {
> -	struct drm_connector *connector;
> +	struct drm_connector __maybe_unused *connector;
>  	struct drm_connector_state *old_conn_state, *new_conn_state;
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
>  {
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *new_crtc_state;
> -	struct drm_connector *connector;
> +	struct drm_connector __maybe_unused *connector;
>  	struct drm_connector_state *new_conn_state;
>  	int i;
>  
> @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *old_crtc_state;
>  	struct drm_crtc_state *new_crtc_state;
> -	struct drm_connector *connector;
> +	struct drm_connector __maybe_unused *connector;
>  	struct drm_connector_state *new_conn_state;
>  	int i;
>  
> @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
>  				      struct drm_atomic_state *state,
>  				      bool pre_swap)
>  {
> -	struct drm_plane *plane;
> +	struct drm_plane __maybe_unused *plane;
>  	struct drm_plane_state *new_plane_state;
>  	int i, ret;
>  
> @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
>  		struct drm_atomic_state *old_state)
>  {
>  	struct drm_crtc *crtc;
> -	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> +	struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
>  	int i, ret;
>  	unsigned crtc_mask = 0;
>  
> @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work)
>  int drm_atomic_helper_async_check(struct drm_device *dev,
>  				   struct drm_atomic_state *state)
>  {
> -	struct drm_crtc *crtc;
> +	struct drm_crtc __maybe_unused *crtc;
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_plane *plane = NULL;
>  	struct drm_plane_state *old_plane_state = NULL;
> @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
>  {
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> -	struct drm_connector *conn;
> +	struct drm_connector __maybe_unused *conn;
>  	struct drm_connector_state *old_conn_state, *new_conn_state;
> -	struct drm_plane *plane;
> +	struct drm_plane __maybe_unused *plane;
>  	struct drm_plane_state *old_plane_state, *new_plane_state;
>  	struct drm_crtc_commit *commit;
>  	int i, ret;
> @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
>   */
>  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
>  {
> -	struct drm_crtc *crtc;
> +	struct drm_crtc __maybe_unused *crtc;
>  	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
>  	struct drm_crtc_commit *commit;
>  	int i;
> @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
>  int drm_atomic_helper_prepare_planes(struct drm_device *dev,
>  				     struct drm_atomic_state *state)
>  {
> -	struct drm_connector *connector;
> +	struct drm_connector __maybe_unused *connector;
>  	struct drm_connector_state *new_conn_state;
>  	struct drm_plane *plane;
>  	struct drm_plane_state *new_plane_state;
> @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  {
>  	struct drm_atomic_state *state;
>  	struct drm_connector_state *conn_state;
> -	struct drm_connector *conn;
> +	struct drm_connector __maybe_unused *conn;
>  	struct drm_plane_state *plane_state;
> -	struct drm_plane *plane;
> +	struct drm_plane __maybe_unused *plane;
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_crtc *crtc;
>  	int ret, i;
> @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
>  {
>  	int i, ret;
>  	struct drm_plane *plane;
> -	struct drm_plane_state *new_plane_state;
> +	struct drm_plane_state __maybe_unused *new_plane_state;
>  	struct drm_connector *connector;
> -	struct drm_connector_state *new_conn_state;
> +	struct drm_connector_state __maybe_unused *new_conn_state;
>  	struct drm_crtc *crtc;
> -	struct drm_crtc_state *new_crtc_state;
> +	struct drm_crtc_state __maybe_unused *new_crtc_state;
>  
>  	state->acquire_ctx = ctx;
>  
> -- 
> 2.15.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Le jeu. 3 oct. 2019 à 16:27, Ville Syrjälä
<ville.syrjala@linux.intel.com> a écrit :
>
> On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:
> > Fix warnings with W=1.
> > Few for_each macro set variables that are never used later.
> > Prevent warning by marking these variables as __maybe_unused.
> >
> > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
> >  1 file changed, 18 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index aa16ea17ff9b..b69d17b0b9bd 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
> >             struct drm_encoder *encoder)
> >  {
> >       struct drm_crtc_state *crtc_state;
> > -     struct drm_connector *connector;
> > +     struct drm_connector __maybe_unused *connector;
>
> Rather ugly. IMO would be nicer if we could hide something inside
> the iterator macros to suppress the warning.

Ok but how ?
connector is assigned in the macros but not used later and we can't
set "__maybe_unused"
in the macro.
Does another keyword exist for that ?

>
> >       struct drm_connector_state *old_connector_state, *new_connector_state;
> >       int i;
> >
> > @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state)
> >  {
> >       struct drm_crtc *crtc;
> >       struct drm_crtc_state *new_crtc_state;
> > -     struct drm_connector *connector;
> > +     struct drm_connector __maybe_unused *connector;
> >       struct drm_connector_state *new_conn_state;
> >       int i;
> >       int ret;
> > @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
> >  {
> >       struct drm_crtc *crtc;
> >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > -     struct drm_connector *connector;
> > +     struct drm_connector __maybe_unused *connector;
> >       struct drm_connector_state *old_connector_state, *new_connector_state;
> >       int i, ret;
> >       unsigned connectors_mask = 0;
> > @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
> >  static void
> >  disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> >  {
> > -     struct drm_connector *connector;
> > +     struct drm_connector __maybe_unused *connector;
> >       struct drm_connector_state *old_conn_state, *new_conn_state;
> >       struct drm_crtc *crtc;
> >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
> >  {
> >       struct drm_crtc *crtc;
> >       struct drm_crtc_state *new_crtc_state;
> > -     struct drm_connector *connector;
> > +     struct drm_connector __maybe_unused *connector;
> >       struct drm_connector_state *new_conn_state;
> >       int i;
> >
> > @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> >       struct drm_crtc *crtc;
> >       struct drm_crtc_state *old_crtc_state;
> >       struct drm_crtc_state *new_crtc_state;
> > -     struct drm_connector *connector;
> > +     struct drm_connector __maybe_unused *connector;
> >       struct drm_connector_state *new_conn_state;
> >       int i;
> >
> > @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
> >                                     struct drm_atomic_state *state,
> >                                     bool pre_swap)
> >  {
> > -     struct drm_plane *plane;
> > +     struct drm_plane __maybe_unused *plane;
> >       struct drm_plane_state *new_plane_state;
> >       int i, ret;
> >
> > @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
> >               struct drm_atomic_state *old_state)
> >  {
> >       struct drm_crtc *crtc;
> > -     struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > +     struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
> >       int i, ret;
> >       unsigned crtc_mask = 0;
> >
> > @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work)
> >  int drm_atomic_helper_async_check(struct drm_device *dev,
> >                                  struct drm_atomic_state *state)
> >  {
> > -     struct drm_crtc *crtc;
> > +     struct drm_crtc __maybe_unused *crtc;
> >       struct drm_crtc_state *crtc_state;
> >       struct drm_plane *plane = NULL;
> >       struct drm_plane_state *old_plane_state = NULL;
> > @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
> >  {
> >       struct drm_crtc *crtc;
> >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > -     struct drm_connector *conn;
> > +     struct drm_connector __maybe_unused *conn;
> >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > -     struct drm_plane *plane;
> > +     struct drm_plane __maybe_unused *plane;
> >       struct drm_plane_state *old_plane_state, *new_plane_state;
> >       struct drm_crtc_commit *commit;
> >       int i, ret;
> > @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> >   */
> >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> >  {
> > -     struct drm_crtc *crtc;
> > +     struct drm_crtc __maybe_unused *crtc;
> >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> >       struct drm_crtc_commit *commit;
> >       int i;
> > @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
> >  int drm_atomic_helper_prepare_planes(struct drm_device *dev,
> >                                    struct drm_atomic_state *state)
> >  {
> > -     struct drm_connector *connector;
> > +     struct drm_connector __maybe_unused *connector;
> >       struct drm_connector_state *new_conn_state;
> >       struct drm_plane *plane;
> >       struct drm_plane_state *new_plane_state;
> > @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> >  {
> >       struct drm_atomic_state *state;
> >       struct drm_connector_state *conn_state;
> > -     struct drm_connector *conn;
> > +     struct drm_connector __maybe_unused *conn;
> >       struct drm_plane_state *plane_state;
> > -     struct drm_plane *plane;
> > +     struct drm_plane __maybe_unused *plane;
> >       struct drm_crtc_state *crtc_state;
> >       struct drm_crtc *crtc;
> >       int ret, i;
> > @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
> >  {
> >       int i, ret;
> >       struct drm_plane *plane;
> > -     struct drm_plane_state *new_plane_state;
> > +     struct drm_plane_state __maybe_unused *new_plane_state;
> >       struct drm_connector *connector;
> > -     struct drm_connector_state *new_conn_state;
> > +     struct drm_connector_state __maybe_unused *new_conn_state;
> >       struct drm_crtc *crtc;
> > -     struct drm_crtc_state *new_crtc_state;
> > +     struct drm_crtc_state __maybe_unused *new_crtc_state;
> >
> >       state->acquire_ctx = ctx;
> >
> > --
> > 2.15.0
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Ville Syrjälä
> Intel
On Thu, Oct 03, 2019 at 04:46:54PM +0200, Benjamin Gaignard wrote:
> Le jeu. 3 oct. 2019 à 16:27, Ville Syrjälä
> <ville.syrjala@linux.intel.com> a écrit :
> >
> > On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:
> > > Fix warnings with W=1.
> > > Few for_each macro set variables that are never used later.
> > > Prevent warning by marking these variables as __maybe_unused.
> > >
> > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> > > ---
> > >  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
> > >  1 file changed, 18 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > > index aa16ea17ff9b..b69d17b0b9bd 100644
> > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
> > >             struct drm_encoder *encoder)
> > >  {
> > >       struct drm_crtc_state *crtc_state;
> > > -     struct drm_connector *connector;
> > > +     struct drm_connector __maybe_unused *connector;
> >
> > Rather ugly. IMO would be nicer if we could hide something inside
> > the iterator macros to suppress the warning.
> 
> Ok but how ?
> connector is assigned in the macros but not used later and we can't
> set "__maybe_unused"
> in the macro.
> Does another keyword exist for that ?

Stick a (void)(connector) into the macro?

Another (arguably cleaner) idea would be to remove the connector/crtc/plane
argument from the iterators entirely since it's redundant, and instead just
extract it from the appropriate new/old state as needed.

We could then also add a for_each_connector_in_state()/etc. which omit
s the state arguments and just has the connector argument, for cases where
you don't care about the states when iterating.

> 
> >
> > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > >       int i;
> > >
> > > @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state)
> > >  {
> > >       struct drm_crtc *crtc;
> > >       struct drm_crtc_state *new_crtc_state;
> > > -     struct drm_connector *connector;
> > > +     struct drm_connector __maybe_unused *connector;
> > >       struct drm_connector_state *new_conn_state;
> > >       int i;
> > >       int ret;
> > > @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
> > >  {
> > >       struct drm_crtc *crtc;
> > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > -     struct drm_connector *connector;
> > > +     struct drm_connector __maybe_unused *connector;
> > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > >       int i, ret;
> > >       unsigned connectors_mask = 0;
> > > @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
> > >  static void
> > >  disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> > >  {
> > > -     struct drm_connector *connector;
> > > +     struct drm_connector __maybe_unused *connector;
> > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > >       struct drm_crtc *crtc;
> > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
> > >  {
> > >       struct drm_crtc *crtc;
> > >       struct drm_crtc_state *new_crtc_state;
> > > -     struct drm_connector *connector;
> > > +     struct drm_connector __maybe_unused *connector;
> > >       struct drm_connector_state *new_conn_state;
> > >       int i;
> > >
> > > @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> > >       struct drm_crtc *crtc;
> > >       struct drm_crtc_state *old_crtc_state;
> > >       struct drm_crtc_state *new_crtc_state;
> > > -     struct drm_connector *connector;
> > > +     struct drm_connector __maybe_unused *connector;
> > >       struct drm_connector_state *new_conn_state;
> > >       int i;
> > >
> > > @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
> > >                                     struct drm_atomic_state *state,
> > >                                     bool pre_swap)
> > >  {
> > > -     struct drm_plane *plane;
> > > +     struct drm_plane __maybe_unused *plane;
> > >       struct drm_plane_state *new_plane_state;
> > >       int i, ret;
> > >
> > > @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
> > >               struct drm_atomic_state *old_state)
> > >  {
> > >       struct drm_crtc *crtc;
> > > -     struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > +     struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
> > >       int i, ret;
> > >       unsigned crtc_mask = 0;
> > >
> > > @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work)
> > >  int drm_atomic_helper_async_check(struct drm_device *dev,
> > >                                  struct drm_atomic_state *state)
> > >  {
> > > -     struct drm_crtc *crtc;
> > > +     struct drm_crtc __maybe_unused *crtc;
> > >       struct drm_crtc_state *crtc_state;
> > >       struct drm_plane *plane = NULL;
> > >       struct drm_plane_state *old_plane_state = NULL;
> > > @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
> > >  {
> > >       struct drm_crtc *crtc;
> > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > -     struct drm_connector *conn;
> > > +     struct drm_connector __maybe_unused *conn;
> > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > > -     struct drm_plane *plane;
> > > +     struct drm_plane __maybe_unused *plane;
> > >       struct drm_plane_state *old_plane_state, *new_plane_state;
> > >       struct drm_crtc_commit *commit;
> > >       int i, ret;
> > > @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> > >   */
> > >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> > >  {
> > > -     struct drm_crtc *crtc;
> > > +     struct drm_crtc __maybe_unused *crtc;
> > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > >       struct drm_crtc_commit *commit;
> > >       int i;
> > > @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
> > >  int drm_atomic_helper_prepare_planes(struct drm_device *dev,
> > >                                    struct drm_atomic_state *state)
> > >  {
> > > -     struct drm_connector *connector;
> > > +     struct drm_connector __maybe_unused *connector;
> > >       struct drm_connector_state *new_conn_state;
> > >       struct drm_plane *plane;
> > >       struct drm_plane_state *new_plane_state;
> > > @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> > >  {
> > >       struct drm_atomic_state *state;
> > >       struct drm_connector_state *conn_state;
> > > -     struct drm_connector *conn;
> > > +     struct drm_connector __maybe_unused *conn;
> > >       struct drm_plane_state *plane_state;
> > > -     struct drm_plane *plane;
> > > +     struct drm_plane __maybe_unused *plane;
> > >       struct drm_crtc_state *crtc_state;
> > >       struct drm_crtc *crtc;
> > >       int ret, i;
> > > @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
> > >  {
> > >       int i, ret;
> > >       struct drm_plane *plane;
> > > -     struct drm_plane_state *new_plane_state;
> > > +     struct drm_plane_state __maybe_unused *new_plane_state;
> > >       struct drm_connector *connector;
> > > -     struct drm_connector_state *new_conn_state;
> > > +     struct drm_connector_state __maybe_unused *new_conn_state;
> > >       struct drm_crtc *crtc;
> > > -     struct drm_crtc_state *new_crtc_state;
> > > +     struct drm_crtc_state __maybe_unused *new_crtc_state;
> > >
> > >       state->acquire_ctx = ctx;
> > >
> > > --
> > > 2.15.0
> > >
> > > _______________________________________________
> > > dri-devel mailing list
> > > dri-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> > --
> > Ville Syrjälä
> > Intel
Le jeu. 3 oct. 2019 à 17:05, Ville Syrjälä
<ville.syrjala@linux.intel.com> a écrit :
>
> On Thu, Oct 03, 2019 at 04:46:54PM +0200, Benjamin Gaignard wrote:
> > Le jeu. 3 oct. 2019 à 16:27, Ville Syrjälä
> > <ville.syrjala@linux.intel.com> a écrit :
> > >
> > > On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:
> > > > Fix warnings with W=1.
> > > > Few for_each macro set variables that are never used later.
> > > > Prevent warning by marking these variables as __maybe_unused.
> > > >
> > > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> > > > ---
> > > >  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
> > > >  1 file changed, 18 insertions(+), 18 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > > > index aa16ea17ff9b..b69d17b0b9bd 100644
> > > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > > @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
> > > >             struct drm_encoder *encoder)
> > > >  {
> > > >       struct drm_crtc_state *crtc_state;
> > > > -     struct drm_connector *connector;
> > > > +     struct drm_connector __maybe_unused *connector;
> > >
> > > Rather ugly. IMO would be nicer if we could hide something inside
> > > the iterator macros to suppress the warning.
> >
> > Ok but how ?
> > connector is assigned in the macros but not used later and we can't
> > set "__maybe_unused"
> > in the macro.
> > Does another keyword exist for that ?
>
> Stick a (void)(connector) into the macro?

That could work but it will look strange inside the macro.

>
> Another (arguably cleaner) idea would be to remove the connector/crtc/plane
> argument from the iterators entirely since it's redundant, and instead just
> extract it from the appropriate new/old state as needed.
>
> We could then also add a for_each_connector_in_state()/etc. which omit
> s the state arguments and just has the connector argument, for cases where
> you don't care about the states when iterating.

That may lead to get a macro for each possible combination of used variables.

>
> >
> > >
> > > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > > >       int i;
> > > >
> > > > @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state)
> > > >  {
> > > >       struct drm_crtc *crtc;
> > > >       struct drm_crtc_state *new_crtc_state;
> > > > -     struct drm_connector *connector;
> > > > +     struct drm_connector __maybe_unused *connector;
> > > >       struct drm_connector_state *new_conn_state;
> > > >       int i;
> > > >       int ret;
> > > > @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
> > > >  {
> > > >       struct drm_crtc *crtc;
> > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > -     struct drm_connector *connector;
> > > > +     struct drm_connector __maybe_unused *connector;
> > > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > > >       int i, ret;
> > > >       unsigned connectors_mask = 0;
> > > > @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
> > > >  static void
> > > >  disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> > > >  {
> > > > -     struct drm_connector *connector;
> > > > +     struct drm_connector __maybe_unused *connector;
> > > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > > >       struct drm_crtc *crtc;
> > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
> > > >  {
> > > >       struct drm_crtc *crtc;
> > > >       struct drm_crtc_state *new_crtc_state;
> > > > -     struct drm_connector *connector;
> > > > +     struct drm_connector __maybe_unused *connector;
> > > >       struct drm_connector_state *new_conn_state;
> > > >       int i;
> > > >
> > > > @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> > > >       struct drm_crtc *crtc;
> > > >       struct drm_crtc_state *old_crtc_state;
> > > >       struct drm_crtc_state *new_crtc_state;
> > > > -     struct drm_connector *connector;
> > > > +     struct drm_connector __maybe_unused *connector;
> > > >       struct drm_connector_state *new_conn_state;
> > > >       int i;
> > > >
> > > > @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
> > > >                                     struct drm_atomic_state *state,
> > > >                                     bool pre_swap)
> > > >  {
> > > > -     struct drm_plane *plane;
> > > > +     struct drm_plane __maybe_unused *plane;
> > > >       struct drm_plane_state *new_plane_state;
> > > >       int i, ret;
> > > >
> > > > @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
> > > >               struct drm_atomic_state *old_state)
> > > >  {
> > > >       struct drm_crtc *crtc;
> > > > -     struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > +     struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
> > > >       int i, ret;
> > > >       unsigned crtc_mask = 0;
> > > >
> > > > @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work)
> > > >  int drm_atomic_helper_async_check(struct drm_device *dev,
> > > >                                  struct drm_atomic_state *state)
> > > >  {
> > > > -     struct drm_crtc *crtc;
> > > > +     struct drm_crtc __maybe_unused *crtc;
> > > >       struct drm_crtc_state *crtc_state;
> > > >       struct drm_plane *plane = NULL;
> > > >       struct drm_plane_state *old_plane_state = NULL;
> > > > @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
> > > >  {
> > > >       struct drm_crtc *crtc;
> > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > -     struct drm_connector *conn;
> > > > +     struct drm_connector __maybe_unused *conn;
> > > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > > > -     struct drm_plane *plane;
> > > > +     struct drm_plane __maybe_unused *plane;
> > > >       struct drm_plane_state *old_plane_state, *new_plane_state;
> > > >       struct drm_crtc_commit *commit;
> > > >       int i, ret;
> > > > @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> > > >   */
> > > >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> > > >  {
> > > > -     struct drm_crtc *crtc;
> > > > +     struct drm_crtc __maybe_unused *crtc;
> > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > >       struct drm_crtc_commit *commit;
> > > >       int i;
> > > > @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
> > > >  int drm_atomic_helper_prepare_planes(struct drm_device *dev,
> > > >                                    struct drm_atomic_state *state)
> > > >  {
> > > > -     struct drm_connector *connector;
> > > > +     struct drm_connector __maybe_unused *connector;
> > > >       struct drm_connector_state *new_conn_state;
> > > >       struct drm_plane *plane;
> > > >       struct drm_plane_state *new_plane_state;
> > > > @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> > > >  {
> > > >       struct drm_atomic_state *state;
> > > >       struct drm_connector_state *conn_state;
> > > > -     struct drm_connector *conn;
> > > > +     struct drm_connector __maybe_unused *conn;
> > > >       struct drm_plane_state *plane_state;
> > > > -     struct drm_plane *plane;
> > > > +     struct drm_plane __maybe_unused *plane;
> > > >       struct drm_crtc_state *crtc_state;
> > > >       struct drm_crtc *crtc;
> > > >       int ret, i;
> > > > @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
> > > >  {
> > > >       int i, ret;
> > > >       struct drm_plane *plane;
> > > > -     struct drm_plane_state *new_plane_state;
> > > > +     struct drm_plane_state __maybe_unused *new_plane_state;
> > > >       struct drm_connector *connector;
> > > > -     struct drm_connector_state *new_conn_state;
> > > > +     struct drm_connector_state __maybe_unused *new_conn_state;
> > > >       struct drm_crtc *crtc;
> > > > -     struct drm_crtc_state *new_crtc_state;
> > > > +     struct drm_crtc_state __maybe_unused *new_crtc_state;
> > > >
> > > >       state->acquire_ctx = ctx;
> > > >
> > > > --
> > > > 2.15.0
> > > >
> > > > _______________________________________________
> > > > dri-devel mailing list
> > > > dri-devel@lists.freedesktop.org
> > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > >
> > > --
> > > Ville Syrjälä
> > > Intel
>
> --
> Ville Syrjälä
> Intel
On Thu, Oct 03, 2019 at 05:37:15PM +0200, Benjamin Gaignard wrote:
> Le jeu. 3 oct. 2019 à 17:05, Ville Syrjälä
> <ville.syrjala@linux.intel.com> a écrit :
> >
> > On Thu, Oct 03, 2019 at 04:46:54PM +0200, Benjamin Gaignard wrote:
> > > Le jeu. 3 oct. 2019 à 16:27, Ville Syrjälä
> > > <ville.syrjala@linux.intel.com> a écrit :
> > > >
> > > > On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:
> > > > > Fix warnings with W=1.
> > > > > Few for_each macro set variables that are never used later.
> > > > > Prevent warning by marking these variables as __maybe_unused.
> > > > >
> > > > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> > > > > ---
> > > > >  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
> > > > >  1 file changed, 18 insertions(+), 18 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > > > > index aa16ea17ff9b..b69d17b0b9bd 100644
> > > > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > > > @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
> > > > >             struct drm_encoder *encoder)
> > > > >  {
> > > > >       struct drm_crtc_state *crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > >
> > > > Rather ugly. IMO would be nicer if we could hide something inside
> > > > the iterator macros to suppress the warning.
> > >
> > > Ok but how ?
> > > connector is assigned in the macros but not used later and we can't
> > > set "__maybe_unused"
> > > in the macro.
> > > Does another keyword exist for that ?
> >
> > Stick a (void)(connector) into the macro?
> 
> That could work but it will look strange inside the macro.
> 
> >
> > Another (arguably cleaner) idea would be to remove the connector/crtc/plane
> > argument from the iterators entirely since it's redundant, and instead just
> > extract it from the appropriate new/old state as needed.
> >
> > We could then also add a for_each_connector_in_state()/etc. which omit
> > s the state arguments and just has the connector argument, for cases where
> > you don't care about the states when iterating.
> 
> That may lead to get a macro for each possible combination of used variables.

We already have new/old/oldnew, so would "just" add one more.

> 
> >
> > >
> > > >
> > > > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > > > >       int i;
> > > > >
> > > > > @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state)
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *new_crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *new_conn_state;
> > > > >       int i;
> > > > >       int ret;
> > > > > @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > > > >       int i, ret;
> > > > >       unsigned connectors_mask = 0;
> > > > > @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
> > > > >  static void
> > > > >  disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> > > > >  {
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *new_crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *new_conn_state;
> > > > >       int i;
> > > > >
> > > > > @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state;
> > > > >       struct drm_crtc_state *new_crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *new_conn_state;
> > > > >       int i;
> > > > >
> > > > > @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
> > > > >                                     struct drm_atomic_state *state,
> > > > >                                     bool pre_swap)
> > > > >  {
> > > > > -     struct drm_plane *plane;
> > > > > +     struct drm_plane __maybe_unused *plane;
> > > > >       struct drm_plane_state *new_plane_state;
> > > > >       int i, ret;
> > > > >
> > > > > @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
> > > > >               struct drm_atomic_state *old_state)
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > > -     struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > +     struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
> > > > >       int i, ret;
> > > > >       unsigned crtc_mask = 0;
> > > > >
> > > > > @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work)
> > > > >  int drm_atomic_helper_async_check(struct drm_device *dev,
> > > > >                                  struct drm_atomic_state *state)
> > > > >  {
> > > > > -     struct drm_crtc *crtc;
> > > > > +     struct drm_crtc __maybe_unused *crtc;
> > > > >       struct drm_crtc_state *crtc_state;
> > > > >       struct drm_plane *plane = NULL;
> > > > >       struct drm_plane_state *old_plane_state = NULL;
> > > > > @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > -     struct drm_connector *conn;
> > > > > +     struct drm_connector __maybe_unused *conn;
> > > > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > > > > -     struct drm_plane *plane;
> > > > > +     struct drm_plane __maybe_unused *plane;
> > > > >       struct drm_plane_state *old_plane_state, *new_plane_state;
> > > > >       struct drm_crtc_commit *commit;
> > > > >       int i, ret;
> > > > > @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> > > > >   */
> > > > >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> > > > >  {
> > > > > -     struct drm_crtc *crtc;
> > > > > +     struct drm_crtc __maybe_unused *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > >       struct drm_crtc_commit *commit;
> > > > >       int i;
> > > > > @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
> > > > >  int drm_atomic_helper_prepare_planes(struct drm_device *dev,
> > > > >                                    struct drm_atomic_state *state)
> > > > >  {
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *new_conn_state;
> > > > >       struct drm_plane *plane;
> > > > >       struct drm_plane_state *new_plane_state;
> > > > > @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> > > > >  {
> > > > >       struct drm_atomic_state *state;
> > > > >       struct drm_connector_state *conn_state;
> > > > > -     struct drm_connector *conn;
> > > > > +     struct drm_connector __maybe_unused *conn;
> > > > >       struct drm_plane_state *plane_state;
> > > > > -     struct drm_plane *plane;
> > > > > +     struct drm_plane __maybe_unused *plane;
> > > > >       struct drm_crtc_state *crtc_state;
> > > > >       struct drm_crtc *crtc;
> > > > >       int ret, i;
> > > > > @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
> > > > >  {
> > > > >       int i, ret;
> > > > >       struct drm_plane *plane;
> > > > > -     struct drm_plane_state *new_plane_state;
> > > > > +     struct drm_plane_state __maybe_unused *new_plane_state;
> > > > >       struct drm_connector *connector;
> > > > > -     struct drm_connector_state *new_conn_state;
> > > > > +     struct drm_connector_state __maybe_unused *new_conn_state;
> > > > >       struct drm_crtc *crtc;
> > > > > -     struct drm_crtc_state *new_crtc_state;
> > > > > +     struct drm_crtc_state __maybe_unused *new_crtc_state;
> > > > >
> > > > >       state->acquire_ctx = ctx;
> > > > >
> > > > > --
> > > > > 2.15.0
> > > > >
> > > > > _______________________________________________
> > > > > dri-devel mailing list
> > > > > dri-devel@lists.freedesktop.org
> > > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > > >
> > > > --
> > > > Ville Syrjälä
> > > > Intel
> >
> > --
> > Ville Syrjälä
> > Intel
Le jeu. 3 oct. 2019 à 17:46, Ville Syrjälä
<ville.syrjala@linux.intel.com> a écrit :
>
> On Thu, Oct 03, 2019 at 05:37:15PM +0200, Benjamin Gaignard wrote:
> > Le jeu. 3 oct. 2019 à 17:05, Ville Syrjälä
> > <ville.syrjala@linux.intel.com> a écrit :
> > >
> > > On Thu, Oct 03, 2019 at 04:46:54PM +0200, Benjamin Gaignard wrote:
> > > > Le jeu. 3 oct. 2019 à 16:27, Ville Syrjälä
> > > > <ville.syrjala@linux.intel.com> a écrit :
> > > > >
> > > > > On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:
> > > > > > Fix warnings with W=1.
> > > > > > Few for_each macro set variables that are never used later.
> > > > > > Prevent warning by marking these variables as __maybe_unused.
> > > > > >
> > > > > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> > > > > > ---
> > > > > >  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
> > > > > >  1 file changed, 18 insertions(+), 18 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > > > > > index aa16ea17ff9b..b69d17b0b9bd 100644
> > > > > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > > > > @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
> > > > > >             struct drm_encoder *encoder)
> > > > > >  {
> > > > > >       struct drm_crtc_state *crtc_state;
> > > > > > -     struct drm_connector *connector;
> > > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >
> > > > > Rather ugly. IMO would be nicer if we could hide something inside
> > > > > the iterator macros to suppress the warning.
> > > >
> > > > Ok but how ?
> > > > connector is assigned in the macros but not used later and we can't
> > > > set "__maybe_unused"
> > > > in the macro.
> > > > Does another keyword exist for that ?
> > >
> > > Stick a (void)(connector) into the macro?
> >
> > That could work but it will look strange inside the macro.
> >
> > >
> > > Another (arguably cleaner) idea would be to remove the connector/crtc/plane
> > > argument from the iterators entirely since it's redundant, and instead just
> > > extract it from the appropriate new/old state as needed.
> > >
> > > We could then also add a for_each_connector_in_state()/etc. which omit
> > > s the state arguments and just has the connector argument, for cases where
> > > you don't care about the states when iterating.
> >
> > That may lead to get a macro for each possible combination of used variables.
>
> We already have new/old/oldnew, so would "just" add one more.

Not just one, it will be one each new/old/oldnew macro to be able to distinguish
when connector is used or not.
And it will be the same for the for_each macros...

>
> >
> > >
> > > >
> > > > >
> > > > > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > > > > >       int i;
> > > > > >
> > > > > > @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state)
> > > > > >  {
> > > > > >       struct drm_crtc *crtc;
> > > > > >       struct drm_crtc_state *new_crtc_state;
> > > > > > -     struct drm_connector *connector;
> > > > > > +     struct drm_connector __maybe_unused *connector;
> > > > > >       struct drm_connector_state *new_conn_state;
> > > > > >       int i;
> > > > > >       int ret;
> > > > > > @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
> > > > > >  {
> > > > > >       struct drm_crtc *crtc;
> > > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > > -     struct drm_connector *connector;
> > > > > > +     struct drm_connector __maybe_unused *connector;
> > > > > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > > > > >       int i, ret;
> > > > > >       unsigned connectors_mask = 0;
> > > > > > @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
> > > > > >  static void
> > > > > >  disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> > > > > >  {
> > > > > > -     struct drm_connector *connector;
> > > > > > +     struct drm_connector __maybe_unused *connector;
> > > > > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > > > > >       struct drm_crtc *crtc;
> > > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > > @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
> > > > > >  {
> > > > > >       struct drm_crtc *crtc;
> > > > > >       struct drm_crtc_state *new_crtc_state;
> > > > > > -     struct drm_connector *connector;
> > > > > > +     struct drm_connector __maybe_unused *connector;
> > > > > >       struct drm_connector_state *new_conn_state;
> > > > > >       int i;
> > > > > >
> > > > > > @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> > > > > >       struct drm_crtc *crtc;
> > > > > >       struct drm_crtc_state *old_crtc_state;
> > > > > >       struct drm_crtc_state *new_crtc_state;
> > > > > > -     struct drm_connector *connector;
> > > > > > +     struct drm_connector __maybe_unused *connector;
> > > > > >       struct drm_connector_state *new_conn_state;
> > > > > >       int i;
> > > > > >
> > > > > > @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
> > > > > >                                     struct drm_atomic_state *state,
> > > > > >                                     bool pre_swap)
> > > > > >  {
> > > > > > -     struct drm_plane *plane;
> > > > > > +     struct drm_plane __maybe_unused *plane;
> > > > > >       struct drm_plane_state *new_plane_state;
> > > > > >       int i, ret;
> > > > > >
> > > > > > @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
> > > > > >               struct drm_atomic_state *old_state)
> > > > > >  {
> > > > > >       struct drm_crtc *crtc;
> > > > > > -     struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > > +     struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
> > > > > >       int i, ret;
> > > > > >       unsigned crtc_mask = 0;
> > > > > >
> > > > > > @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work)
> > > > > >  int drm_atomic_helper_async_check(struct drm_device *dev,
> > > > > >                                  struct drm_atomic_state *state)
> > > > > >  {
> > > > > > -     struct drm_crtc *crtc;
> > > > > > +     struct drm_crtc __maybe_unused *crtc;
> > > > > >       struct drm_crtc_state *crtc_state;
> > > > > >       struct drm_plane *plane = NULL;
> > > > > >       struct drm_plane_state *old_plane_state = NULL;
> > > > > > @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
> > > > > >  {
> > > > > >       struct drm_crtc *crtc;
> > > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > > -     struct drm_connector *conn;
> > > > > > +     struct drm_connector __maybe_unused *conn;
> > > > > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > > > > > -     struct drm_plane *plane;
> > > > > > +     struct drm_plane __maybe_unused *plane;
> > > > > >       struct drm_plane_state *old_plane_state, *new_plane_state;
> > > > > >       struct drm_crtc_commit *commit;
> > > > > >       int i, ret;
> > > > > > @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> > > > > >   */
> > > > > >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> > > > > >  {
> > > > > > -     struct drm_crtc *crtc;
> > > > > > +     struct drm_crtc __maybe_unused *crtc;
> > > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > >       struct drm_crtc_commit *commit;
> > > > > >       int i;
> > > > > > @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
> > > > > >  int drm_atomic_helper_prepare_planes(struct drm_device *dev,
> > > > > >                                    struct drm_atomic_state *state)
> > > > > >  {
> > > > > > -     struct drm_connector *connector;
> > > > > > +     struct drm_connector __maybe_unused *connector;
> > > > > >       struct drm_connector_state *new_conn_state;
> > > > > >       struct drm_plane *plane;
> > > > > >       struct drm_plane_state *new_plane_state;
> > > > > > @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> > > > > >  {
> > > > > >       struct drm_atomic_state *state;
> > > > > >       struct drm_connector_state *conn_state;
> > > > > > -     struct drm_connector *conn;
> > > > > > +     struct drm_connector __maybe_unused *conn;
> > > > > >       struct drm_plane_state *plane_state;
> > > > > > -     struct drm_plane *plane;
> > > > > > +     struct drm_plane __maybe_unused *plane;
> > > > > >       struct drm_crtc_state *crtc_state;
> > > > > >       struct drm_crtc *crtc;
> > > > > >       int ret, i;
> > > > > > @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
> > > > > >  {
> > > > > >       int i, ret;
> > > > > >       struct drm_plane *plane;
> > > > > > -     struct drm_plane_state *new_plane_state;
> > > > > > +     struct drm_plane_state __maybe_unused *new_plane_state;
> > > > > >       struct drm_connector *connector;
> > > > > > -     struct drm_connector_state *new_conn_state;
> > > > > > +     struct drm_connector_state __maybe_unused *new_conn_state;
> > > > > >       struct drm_crtc *crtc;
> > > > > > -     struct drm_crtc_state *new_crtc_state;
> > > > > > +     struct drm_crtc_state __maybe_unused *new_crtc_state;
> > > > > >
> > > > > >       state->acquire_ctx = ctx;
> > > > > >
> > > > > > --
> > > > > > 2.15.0
> > > > > >
> > > > > > _______________________________________________
> > > > > > dri-devel mailing list
> > > > > > dri-devel@lists.freedesktop.org
> > > > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > > > >
> > > > > --
> > > > > Ville Syrjälä
> > > > > Intel
> > >
> > > --
> > > Ville Syrjälä
> > > Intel
>
> --
> Ville Syrjälä
> Intel
On Fri, Oct 04, 2019 at 12:48:02PM +0200, Benjamin Gaignard wrote:
> Le jeu. 3 oct. 2019 à 17:46, Ville Syrjälä
> <ville.syrjala@linux.intel.com> a écrit :
> >
> > On Thu, Oct 03, 2019 at 05:37:15PM +0200, Benjamin Gaignard wrote:
> > > Le jeu. 3 oct. 2019 à 17:05, Ville Syrjälä
> > > <ville.syrjala@linux.intel.com> a écrit :
> > > >
> > > > On Thu, Oct 03, 2019 at 04:46:54PM +0200, Benjamin Gaignard wrote:
> > > > > Le jeu. 3 oct. 2019 à 16:27, Ville Syrjälä
> > > > > <ville.syrjala@linux.intel.com> a écrit :
> > > > > >
> > > > > > On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:
> > > > > > > Fix warnings with W=1.
> > > > > > > Few for_each macro set variables that are never used later.
> > > > > > > Prevent warning by marking these variables as __maybe_unused.
> > > > > > >
> > > > > > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> > > > > > > ---
> > > > > > >  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
> > > > > > >  1 file changed, 18 insertions(+), 18 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > > > > > > index aa16ea17ff9b..b69d17b0b9bd 100644
> > > > > > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > > > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > > > > > @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
> > > > > > >             struct drm_encoder *encoder)
> > > > > > >  {
> > > > > > >       struct drm_crtc_state *crtc_state;
> > > > > > > -     struct drm_connector *connector;
> > > > > > > +     struct drm_connector __maybe_unused *connector;
> > > > > >
> > > > > > Rather ugly. IMO would be nicer if we could hide something inside
> > > > > > the iterator macros to suppress the warning.
> > > > >
> > > > > Ok but how ?
> > > > > connector is assigned in the macros but not used later and we can't
> > > > > set "__maybe_unused"
> > > > > in the macro.
> > > > > Does another keyword exist for that ?
> > > >
> > > > Stick a (void)(connector) into the macro?
> > >
> > > That could work but it will look strange inside the macro.
> > >
> > > >
> > > > Another (arguably cleaner) idea would be to remove the connector/crtc/plane
> > > > argument from the iterators entirely since it's redundant, and instead just
> > > > extract it from the appropriate new/old state as needed.
> > > >
> > > > We could then also add a for_each_connector_in_state()/etc. which omit
> > > > s the state arguments and just has the connector argument, for cases where
> > > > you don't care about the states when iterating.
> > >
> > > That may lead to get a macro for each possible combination of used variables.
> >
> > We already have new/old/oldnew, so would "just" add one more.
> 
> Not just one, it will be one each new/old/oldnew macro to be able to distinguish
> when connector is used or not.

What I'm suggesting is this:
for_each_connector_in_state(state, connector, i)
for_each_old_connector_in_state(state, old_conn_state, i)
for_each_new_connector_in_state(state, new_conn_state, i)
for_each_oldnew_connector_in_state(state, old_conn_state, new_conn_state, i)

So only four in total for each object type, instead of the current
three.
On 10/4/19 2:27 PM, Ville Syrjälä wrote:
> On Fri, Oct 04, 2019 at 12:48:02PM +0200, Benjamin Gaignard wrote:

>> Le jeu. 3 oct. 2019 à 17:46, Ville Syrjälä

>> <ville.syrjala@linux.intel.com> a écrit :

>>> On Thu, Oct 03, 2019 at 05:37:15PM +0200, Benjamin Gaignard wrote:

>>>> Le jeu. 3 oct. 2019 à 17:05, Ville Syrjälä

>>>> <ville.syrjala@linux.intel.com> a écrit :

>>>>> On Thu, Oct 03, 2019 at 04:46:54PM +0200, Benjamin Gaignard wrote:

>>>>>> Le jeu. 3 oct. 2019 à 16:27, Ville Syrjälä

>>>>>> <ville.syrjala@linux.intel.com> a écrit :

>>>>>>> On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:

>>>>>>>> Fix warnings with W=1.

>>>>>>>> Few for_each macro set variables that are never used later.

>>>>>>>> Prevent warning by marking these variables as __maybe_unused.

>>>>>>>>

>>>>>>>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>

>>>>>>>> ---

>>>>>>>>   drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------

>>>>>>>>   1 file changed, 18 insertions(+), 18 deletions(-)

>>>>>>>>

>>>>>>>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c

>>>>>>>> index aa16ea17ff9b..b69d17b0b9bd 100644

>>>>>>>> --- a/drivers/gpu/drm/drm_atomic_helper.c

>>>>>>>> +++ b/drivers/gpu/drm/drm_atomic_helper.c

>>>>>>>> @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,

>>>>>>>>              struct drm_encoder *encoder)

>>>>>>>>   {

>>>>>>>>        struct drm_crtc_state *crtc_state;

>>>>>>>> -     struct drm_connector *connector;

>>>>>>>> +     struct drm_connector __maybe_unused *connector;

>>>>>>> Rather ugly. IMO would be nicer if we could hide something inside

>>>>>>> the iterator macros to suppress the warning.

>>>>>> Ok but how ?

>>>>>> connector is assigned in the macros but not used later and we can't

>>>>>> set "__maybe_unused"

>>>>>> in the macro.

>>>>>> Does another keyword exist for that ?

>>>>> Stick a (void)(connector) into the macro?

>>>> That could work but it will look strange inside the macro.

>>>>

>>>>> Another (arguably cleaner) idea would be to remove the connector/crtc/plane

>>>>> argument from the iterators entirely since it's redundant, and instead just

>>>>> extract it from the appropriate new/old state as needed.

>>>>>

>>>>> We could then also add a for_each_connector_in_state()/etc. which omit

>>>>> s the state arguments and just has the connector argument, for cases where

>>>>> you don't care about the states when iterating.

>>>> That may lead to get a macro for each possible combination of used variables.

>>> We already have new/old/oldnew, so would "just" add one more.

>> Not just one, it will be one each new/old/oldnew macro to be able to distinguish

>> when connector is used or not.

> What I'm suggesting is this:

> for_each_connector_in_state(state, connector, i)

> for_each_old_connector_in_state(state, old_conn_state, i)

> for_each_new_connector_in_state(state, new_conn_state, i)

> for_each_oldnew_connector_in_state(state, old_conn_state, new_conn_state, i)

>

> So only four in total for each object type, instead of the current

> three.


You are missing these cases: old and connector, new and connector,

old and new and connector are needed together.

>
On Fri, Oct 04, 2019 at 12:36:56PM +0000, Benjamin GAIGNARD wrote:
> 
> On 10/4/19 2:27 PM, Ville Syrjälä wrote:
> > On Fri, Oct 04, 2019 at 12:48:02PM +0200, Benjamin Gaignard wrote:
> >> Le jeu. 3 oct. 2019 à 17:46, Ville Syrjälä
> >> <ville.syrjala@linux.intel.com> a écrit :
> >>> On Thu, Oct 03, 2019 at 05:37:15PM +0200, Benjamin Gaignard wrote:
> >>>> Le jeu. 3 oct. 2019 à 17:05, Ville Syrjälä
> >>>> <ville.syrjala@linux.intel.com> a écrit :
> >>>>> On Thu, Oct 03, 2019 at 04:46:54PM +0200, Benjamin Gaignard wrote:
> >>>>>> Le jeu. 3 oct. 2019 à 16:27, Ville Syrjälä
> >>>>>> <ville.syrjala@linux.intel.com> a écrit :
> >>>>>>> On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:
> >>>>>>>> Fix warnings with W=1.
> >>>>>>>> Few for_each macro set variables that are never used later.
> >>>>>>>> Prevent warning by marking these variables as __maybe_unused.
> >>>>>>>>
> >>>>>>>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> >>>>>>>> ---
> >>>>>>>>   drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
> >>>>>>>>   1 file changed, 18 insertions(+), 18 deletions(-)
> >>>>>>>>
> >>>>>>>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> >>>>>>>> index aa16ea17ff9b..b69d17b0b9bd 100644
> >>>>>>>> --- a/drivers/gpu/drm/drm_atomic_helper.c
> >>>>>>>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> >>>>>>>> @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
> >>>>>>>>              struct drm_encoder *encoder)
> >>>>>>>>   {
> >>>>>>>>        struct drm_crtc_state *crtc_state;
> >>>>>>>> -     struct drm_connector *connector;
> >>>>>>>> +     struct drm_connector __maybe_unused *connector;
> >>>>>>> Rather ugly. IMO would be nicer if we could hide something inside
> >>>>>>> the iterator macros to suppress the warning.
> >>>>>> Ok but how ?
> >>>>>> connector is assigned in the macros but not used later and we can't
> >>>>>> set "__maybe_unused"
> >>>>>> in the macro.
> >>>>>> Does another keyword exist for that ?
> >>>>> Stick a (void)(connector) into the macro?
> >>>> That could work but it will look strange inside the macro.
> >>>>
> >>>>> Another (arguably cleaner) idea would be to remove the connector/crtc/plane
> >>>>> argument from the iterators entirely since it's redundant, and instead just
> >>>>> extract it from the appropriate new/old state as needed.
> >>>>>
> >>>>> We could then also add a for_each_connector_in_state()/etc. which omit
> >>>>> s the state arguments and just has the connector argument, for cases where
> >>>>> you don't care about the states when iterating.
> >>>> That may lead to get a macro for each possible combination of used variables.
> >>> We already have new/old/oldnew, so would "just" add one more.
> >> Not just one, it will be one each new/old/oldnew macro to be able to distinguish
> >> when connector is used or not.
> > What I'm suggesting is this:
> > for_each_connector_in_state(state, connector, i)
> > for_each_old_connector_in_state(state, old_conn_state, i)
> > for_each_new_connector_in_state(state, new_conn_state, i)
> > for_each_oldnew_connector_in_state(state, old_conn_state, new_conn_state, i)
> >
> > So only four in total for each object type, instead of the current
> > three.
> 
> You are missing these cases: old and connector, new and connector,
> 
> old and new and connector are needed together.

No, that's redundant. You can always get the connector from
old/new_conn_state->connector if you need it.
On Thu, Oct 03, 2019 at 05:37:15PM +0200, Benjamin Gaignard wrote:
> Le jeu. 3 oct. 2019 à 17:05, Ville Syrjälä
> <ville.syrjala@linux.intel.com> a écrit :
> >
> > On Thu, Oct 03, 2019 at 04:46:54PM +0200, Benjamin Gaignard wrote:
> > > Le jeu. 3 oct. 2019 à 16:27, Ville Syrjälä
> > > <ville.syrjala@linux.intel.com> a écrit :
> > > >
> > > > On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote:
> > > > > Fix warnings with W=1.
> > > > > Few for_each macro set variables that are never used later.
> > > > > Prevent warning by marking these variables as __maybe_unused.
> > > > >
> > > > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> > > > > ---
> > > > >  drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------
> > > > >  1 file changed, 18 insertions(+), 18 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > > > > index aa16ea17ff9b..b69d17b0b9bd 100644
> > > > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > > > @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state,
> > > > >             struct drm_encoder *encoder)
> > > > >  {
> > > > >       struct drm_crtc_state *crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > >
> > > > Rather ugly. IMO would be nicer if we could hide something inside
> > > > the iterator macros to suppress the warning.
> > >
> > > Ok but how ?
> > > connector is assigned in the macros but not used later and we can't
> > > set "__maybe_unused"
> > > in the macro.
> > > Does another keyword exist for that ?
> >
> > Stick a (void)(connector) into the macro?
> 
> That could work but it will look strange inside the macro.

If this works I think it's fine, maybe together with a FIXME or so ... At
least as an interim solution. Much better than sprinkling all the
maybe_unused annotations around like in this patch.
-Daniel
> 
> >
> > Another (arguably cleaner) idea would be to remove the connector/crtc/plane
> > argument from the iterators entirely since it's redundant, and instead just
> > extract it from the appropriate new/old state as needed.
> >
> > We could then also add a for_each_connector_in_state()/etc. which omit
> > s the state arguments and just has the connector argument, for cases where
> > you don't care about the states when iterating.
> 
> That may lead to get a macro for each possible combination of used variables.
> 
> >
> > >
> > > >
> > > > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > > > >       int i;
> > > > >
> > > > > @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state)
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *new_crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *new_conn_state;
> > > > >       int i;
> > > > >       int ret;
> > > > > @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *old_connector_state, *new_connector_state;
> > > > >       int i, ret;
> > > > >       unsigned connectors_mask = 0;
> > > > > @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state,
> > > > >  static void
> > > > >  disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
> > > > >  {
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *new_crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *new_conn_state;
> > > > >       int i;
> > > > >
> > > > > @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state;
> > > > >       struct drm_crtc_state *new_crtc_state;
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *new_conn_state;
> > > > >       int i;
> > > > >
> > > > > @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,
> > > > >                                     struct drm_atomic_state *state,
> > > > >                                     bool pre_swap)
> > > > >  {
> > > > > -     struct drm_plane *plane;
> > > > > +     struct drm_plane __maybe_unused *plane;
> > > > >       struct drm_plane_state *new_plane_state;
> > > > >       int i, ret;
> > > > >
> > > > > @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
> > > > >               struct drm_atomic_state *old_state)
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > > -     struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > +     struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state;
> > > > >       int i, ret;
> > > > >       unsigned crtc_mask = 0;
> > > > >
> > > > > @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work)
> > > > >  int drm_atomic_helper_async_check(struct drm_device *dev,
> > > > >                                  struct drm_atomic_state *state)
> > > > >  {
> > > > > -     struct drm_crtc *crtc;
> > > > > +     struct drm_crtc __maybe_unused *crtc;
> > > > >       struct drm_crtc_state *crtc_state;
> > > > >       struct drm_plane *plane = NULL;
> > > > >       struct drm_plane_state *old_plane_state = NULL;
> > > > > @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
> > > > >  {
> > > > >       struct drm_crtc *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > > -     struct drm_connector *conn;
> > > > > +     struct drm_connector __maybe_unused *conn;
> > > > >       struct drm_connector_state *old_conn_state, *new_conn_state;
> > > > > -     struct drm_plane *plane;
> > > > > +     struct drm_plane __maybe_unused *plane;
> > > > >       struct drm_plane_state *old_plane_state, *new_plane_state;
> > > > >       struct drm_crtc_commit *commit;
> > > > >       int i, ret;
> > > > > @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> > > > >   */
> > > > >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> > > > >  {
> > > > > -     struct drm_crtc *crtc;
> > > > > +     struct drm_crtc __maybe_unused *crtc;
> > > > >       struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > >       struct drm_crtc_commit *commit;
> > > > >       int i;
> > > > > @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done);
> > > > >  int drm_atomic_helper_prepare_planes(struct drm_device *dev,
> > > > >                                    struct drm_atomic_state *state)
> > > > >  {
> > > > > -     struct drm_connector *connector;
> > > > > +     struct drm_connector __maybe_unused *connector;
> > > > >       struct drm_connector_state *new_conn_state;
> > > > >       struct drm_plane *plane;
> > > > >       struct drm_plane_state *new_plane_state;
> > > > > @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
> > > > >  {
> > > > >       struct drm_atomic_state *state;
> > > > >       struct drm_connector_state *conn_state;
> > > > > -     struct drm_connector *conn;
> > > > > +     struct drm_connector __maybe_unused *conn;
> > > > >       struct drm_plane_state *plane_state;
> > > > > -     struct drm_plane *plane;
> > > > > +     struct drm_plane __maybe_unused *plane;
> > > > >       struct drm_crtc_state *crtc_state;
> > > > >       struct drm_crtc *crtc;
> > > > >       int ret, i;
> > > > > @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
> > > > >  {
> > > > >       int i, ret;
> > > > >       struct drm_plane *plane;
> > > > > -     struct drm_plane_state *new_plane_state;
> > > > > +     struct drm_plane_state __maybe_unused *new_plane_state;
> > > > >       struct drm_connector *connector;
> > > > > -     struct drm_connector_state *new_conn_state;
> > > > > +     struct drm_connector_state __maybe_unused *new_conn_state;
> > > > >       struct drm_crtc *crtc;
> > > > > -     struct drm_crtc_state *new_crtc_state;
> > > > > +     struct drm_crtc_state __maybe_unused *new_crtc_state;
> > > > >
> > > > >       state->acquire_ctx = ctx;
> > > > >
> > > > > --
> > > > > 2.15.0
> > > > >
> > > > > _______________________________________________
> > > > > dri-devel mailing list
> > > > > dri-devel@lists.freedesktop.org
> > > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > > >
> > > > --
> > > > Ville Syrjälä
> > > > Intel
> >
> > --
> > Ville Syrjälä
> > Intel