drm: Convert all helpers to drm_connector_list_iter

Submitted by Daniel Vetter on Dec. 15, 2016, 3:58 p.m.

Details

Message ID 20161215155843.13408-1-daniel.vetter@ffwll.ch
State New
Headers show
Series "some stuff, and then connector_list locking" ( rev: 2 ) in DRI devel

Not browsing as part of any series.

Commit Message

Daniel Vetter Dec. 15, 2016, 3:58 p.m.
Mostly nothing special (except making sure that really all error paths
and friends call iter_put).

v2: Don't forget the raw connector_list walking in
drm_helper_move_panel_connectors_to_head. That one unfortunately can't
be converted to the iterator helpers, but since it's just some list
splicing best to just wrap the entire thing up in one critical
section.

v3: Bail out after iter_put (Harry).

Cc: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_atomic_helper.c  | 39 ++++++++++++++++++++--------
 drivers/gpu/drm/drm_crtc_helper.c    | 49 ++++++++++++++++++++++++++++--------
 drivers/gpu/drm/drm_fb_helper.c      | 12 ++++++---
 drivers/gpu/drm/drm_modeset_helper.c |  2 ++
 drivers/gpu/drm/drm_plane_helper.c   |  5 +++-
 drivers/gpu/drm/drm_probe_helper.c   | 18 ++++++++-----
 6 files changed, 92 insertions(+), 33 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 23767df72615..e2e15a9903a9 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -94,9 +94,10 @@  static int handle_conflicting_encoders(struct drm_atomic_state *state,
 {
 	struct drm_connector_state *conn_state;
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	struct drm_encoder *encoder;
 	unsigned encoder_mask = 0;
-	int i, ret;
+	int i, ret = 0;
 
 	/*
 	 * First loop, find all newly assigned encoders from the connectors
@@ -144,7 +145,8 @@  static int handle_conflicting_encoders(struct drm_atomic_state *state,
 	 * and the crtc is disabled if no encoder is left. This preserves
 	 * compatibility with the legacy set_config behavior.
 	 */
-	drm_for_each_connector(connector, state->dev) {
+	drm_connector_list_iter_get(state->dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		struct drm_crtc_state *crtc_state;
 
 		if (drm_atomic_get_existing_connector_state(state, connector))
@@ -160,12 +162,15 @@  static int handle_conflicting_encoders(struct drm_atomic_state *state,
 					 connector->state->crtc->base.id,
 					 connector->state->crtc->name,
 					 connector->base.id, connector->name);
-			return -EINVAL;
+			ret = -EINVAL;
+			goto out;
 		}
 
 		conn_state = drm_atomic_get_connector_state(state, connector);
-		if (IS_ERR(conn_state))
-			return PTR_ERR(conn_state);
+		if (IS_ERR(conn_state)) {
+			ret = PTR_ERR(conn_state);
+			goto out;
+		}
 
 		DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] in use on [CRTC:%d:%s], disabling [CONNECTOR:%d:%s]\n",
 				 encoder->base.id, encoder->name,
@@ -176,19 +181,21 @@  static int handle_conflicting_encoders(struct drm_atomic_state *state,
 
 		ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
 		if (ret)
-			return ret;
+			goto out;
 
 		if (!crtc_state->connector_mask) {
 			ret = drm_atomic_set_mode_prop_for_crtc(crtc_state,
 								NULL);
 			if (ret < 0)
-				return ret;
+				goto out;
 
 			crtc_state->active = false;
 		}
 	}
+out:
+	drm_connector_list_iter_put(&conn_iter);
 
-	return 0;
+	return ret;
 }
 
 static void
@@ -2442,6 +2449,7 @@  int drm_atomic_helper_disable_all(struct drm_device *dev,
 {
 	struct drm_atomic_state *state;
 	struct drm_connector *conn;
+	struct drm_connector_list_iter conn_iter;
 	int err;
 
 	state = drm_atomic_state_alloc(dev);
@@ -2450,7 +2458,8 @@  int drm_atomic_helper_disable_all(struct drm_device *dev,
 
 	state->acquire_ctx = ctx;
 
-	drm_for_each_connector(conn, dev) {
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(conn, &conn_iter) {
 		struct drm_crtc *crtc = conn->state->crtc;
 		struct drm_crtc_state *crtc_state;
 
@@ -2468,6 +2477,7 @@  int drm_atomic_helper_disable_all(struct drm_device *dev,
 
 	err = drm_atomic_commit(state);
 free:
+	drm_connector_list_iter_put(&conn_iter);
 	drm_atomic_state_put(state);
 	return err;
 }
@@ -2840,6 +2850,7 @@  int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
 	struct drm_crtc_state *crtc_state;
 	struct drm_crtc *crtc;
 	struct drm_connector *tmp_connector;
+	struct drm_connector_list_iter conn_iter;
 	int ret;
 	bool active = false;
 	int old_mode = connector->dpms;
@@ -2867,7 +2878,8 @@  int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
 
 	WARN_ON(!drm_modeset_is_locked(&config->connection_mutex));
 
-	drm_for_each_connector(tmp_connector, connector->dev) {
+	drm_connector_list_iter_get(connector->dev, &conn_iter);
+	drm_for_each_connector_iter(tmp_connector, &conn_iter) {
 		if (tmp_connector->state->crtc != crtc)
 			continue;
 
@@ -2876,6 +2888,7 @@  int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
 			break;
 		}
 	}
+	drm_connector_list_iter_put(&conn_iter);
 	crtc_state->active = active;
 
 	ret = drm_atomic_commit(state);
@@ -3253,6 +3266,7 @@  drm_atomic_helper_duplicate_state(struct drm_device *dev,
 {
 	struct drm_atomic_state *state;
 	struct drm_connector *conn;
+	struct drm_connector_list_iter conn_iter;
 	struct drm_plane *plane;
 	struct drm_crtc *crtc;
 	int err = 0;
@@ -3283,15 +3297,18 @@  drm_atomic_helper_duplicate_state(struct drm_device *dev,
 		}
 	}
 
-	drm_for_each_connector(conn, dev) {
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(conn, &conn_iter) {
 		struct drm_connector_state *conn_state;
 
 		conn_state = drm_atomic_get_connector_state(state, conn);
 		if (IS_ERR(conn_state)) {
 			err = PTR_ERR(conn_state);
+			drm_connector_list_iter_put(&conn_iter);
 			goto free;
 		}
 	}
+	drm_connector_list_iter_put(&conn_iter);
 
 	/* clear the acquire context so that it isn't accidentally reused */
 	state->acquire_ctx = NULL;
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 9d007f5f9732..ad154325a0fd 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -88,6 +88,7 @@ 
 bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
 {
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	struct drm_device *dev = encoder->dev;
 
 	/*
@@ -99,9 +100,15 @@  bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
 		WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
 	}
 
-	drm_for_each_connector(connector, dev)
-		if (connector->encoder == encoder)
+
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
+		if (connector->encoder == encoder) {
+			drm_connector_list_iter_put(&conn_iter);
 			return true;
+		}
+	}
+	drm_connector_list_iter_put(&conn_iter);
 	return false;
 }
 EXPORT_SYMBOL(drm_helper_encoder_in_use);
@@ -436,10 +443,13 @@  drm_crtc_helper_disable(struct drm_crtc *crtc)
 
 	/* Decouple all encoders and their attached connectors from this crtc */
 	drm_for_each_encoder(encoder, dev) {
+		struct drm_connector_list_iter conn_iter;
+
 		if (encoder->crtc != crtc)
 			continue;
 
-		drm_for_each_connector(connector, dev) {
+		drm_connector_list_iter_get(dev, &conn_iter);
+		drm_for_each_connector_iter(connector, &conn_iter) {
 			if (connector->encoder != encoder)
 				continue;
 
@@ -456,6 +466,7 @@  drm_crtc_helper_disable(struct drm_crtc *crtc)
 			/* we keep a reference while the encoder is bound */
 			drm_connector_unreference(connector);
 		}
+		drm_connector_list_iter_put(&conn_iter);
 	}
 
 	__drm_helper_disable_unused_functions(dev);
@@ -507,6 +518,7 @@  int drm_crtc_helper_set_config(struct drm_mode_set *set)
 	bool mode_changed = false; /* if true do a full mode set */
 	bool fb_changed = false; /* if true and !mode_changed just do a flip */
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	int count = 0, ro, fail = 0;
 	const struct drm_crtc_helper_funcs *crtc_funcs;
 	struct drm_mode_set save_set;
@@ -571,9 +583,10 @@  int drm_crtc_helper_set_config(struct drm_mode_set *set)
 	}
 
 	count = 0;
-	drm_for_each_connector(connector, dev) {
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter)
 		save_connector_encoders[count++] = connector->encoder;
-	}
+	drm_connector_list_iter_put(&conn_iter);
 
 	save_set.crtc = set->crtc;
 	save_set.mode = &set->crtc->mode;
@@ -615,7 +628,8 @@  int drm_crtc_helper_set_config(struct drm_mode_set *set)
 
 	/* a) traverse passed in connector list and get encoders for them */
 	count = 0;
-	drm_for_each_connector(connector, dev) {
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		const struct drm_connector_helper_funcs *connector_funcs =
 			connector->helper_private;
 		new_encoder = connector->encoder;
@@ -648,6 +662,7 @@  int drm_crtc_helper_set_config(struct drm_mode_set *set)
 			connector->encoder = new_encoder;
 		}
 	}
+	drm_connector_list_iter_put(&conn_iter);
 
 	if (fail) {
 		ret = -EINVAL;
@@ -655,7 +670,8 @@  int drm_crtc_helper_set_config(struct drm_mode_set *set)
 	}
 
 	count = 0;
-	drm_for_each_connector(connector, dev) {
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		if (!connector->encoder)
 			continue;
 
@@ -673,6 +689,7 @@  int drm_crtc_helper_set_config(struct drm_mode_set *set)
 		if (new_crtc &&
 		    !drm_encoder_crtc_ok(connector->encoder, new_crtc)) {
 			ret = -EINVAL;
+			drm_connector_list_iter_put(&conn_iter);
 			goto fail;
 		}
 		if (new_crtc != connector->encoder->crtc) {
@@ -689,6 +706,7 @@  int drm_crtc_helper_set_config(struct drm_mode_set *set)
 				      connector->base.id, connector->name);
 		}
 	}
+	drm_connector_list_iter_put(&conn_iter);
 
 	/* mode_set_base is not a required function */
 	if (fb_changed && !crtc_funcs->mode_set_base)
@@ -743,9 +761,10 @@  int drm_crtc_helper_set_config(struct drm_mode_set *set)
 	}
 
 	count = 0;
-	drm_for_each_connector(connector, dev) {
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter)
 		connector->encoder = save_connector_encoders[count++];
-	}
+	drm_connector_list_iter_put(&conn_iter);
 
 	/* after fail drop reference on all unbound connectors in set, let
 	 * bound connectors keep their reference
@@ -772,12 +791,16 @@  static int drm_helper_choose_encoder_dpms(struct drm_encoder *encoder)
 {
 	int dpms = DRM_MODE_DPMS_OFF;
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	struct drm_device *dev = encoder->dev;
 
-	drm_for_each_connector(connector, dev)
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter)
 		if (connector->encoder == encoder)
 			if (connector->dpms < dpms)
 				dpms = connector->dpms;
+	drm_connector_list_iter_put(&conn_iter);
+
 	return dpms;
 }
 
@@ -809,12 +832,16 @@  static int drm_helper_choose_crtc_dpms(struct drm_crtc *crtc)
 {
 	int dpms = DRM_MODE_DPMS_OFF;
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	struct drm_device *dev = crtc->dev;
 
-	drm_for_each_connector(connector, dev)
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter)
 		if (connector->encoder && connector->encoder->crtc == crtc)
 			if (connector->dpms < dpms)
 				dpms = connector->dpms;
+	drm_connector_list_iter_put(&conn_iter);
+
 	return dpms;
 }
 
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index bee5e4149a1c..145d55fef69e 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -120,20 +120,22 @@  int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
 {
 	struct drm_device *dev = fb_helper->dev;
 	struct drm_connector *connector;
-	int i, ret;
+	struct drm_connector_list_iter conn_iter;
+	int i, ret = 0;
 
 	if (!drm_fbdev_emulation)
 		return 0;
 
 	mutex_lock(&dev->mode_config.mutex);
-	drm_for_each_connector(connector, dev) {
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		ret = drm_fb_helper_add_one_connector(fb_helper, connector);
 
 		if (ret)
 			goto fail;
 	}
-	mutex_unlock(&dev->mode_config.mutex);
-	return 0;
+	goto out;
+
 fail:
 	drm_fb_helper_for_each_connector(fb_helper, i) {
 		struct drm_fb_helper_connector *fb_helper_connector =
@@ -145,6 +147,8 @@  int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
 		fb_helper->connector_info[i] = NULL;
 	}
 	fb_helper->connector_count = 0;
+out:
+	drm_connector_list_iter_put(&conn_iter);
 	mutex_unlock(&dev->mode_config.mutex);
 
 	return ret;
diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
index 5b051859b8d3..5d8fa791fff5 100644
--- a/drivers/gpu/drm/drm_modeset_helper.c
+++ b/drivers/gpu/drm/drm_modeset_helper.c
@@ -48,6 +48,7 @@  void drm_helper_move_panel_connectors_to_head(struct drm_device *dev)
 
 	INIT_LIST_HEAD(&panel_list);
 
+	spin_lock_irq(&dev->mode_config.connector_list_lock);
 	list_for_each_entry_safe(connector, tmp,
 				 &dev->mode_config.connector_list, head) {
 		if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS ||
@@ -57,6 +58,7 @@  void drm_helper_move_panel_connectors_to_head(struct drm_device *dev)
 	}
 
 	list_splice(&panel_list, &dev->mode_config.connector_list);
+	spin_unlock_irq(&dev->mode_config.connector_list_lock);
 }
 EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head);
 
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 7a7dddf604d7..bc9f97422cd1 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -74,6 +74,7 @@  static int get_connectors_for_crtc(struct drm_crtc *crtc,
 {
 	struct drm_device *dev = crtc->dev;
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	int count = 0;
 
 	/*
@@ -83,7 +84,8 @@  static int get_connectors_for_crtc(struct drm_crtc *crtc,
 	 */
 	WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
 
-	drm_for_each_connector(connector, dev) {
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		if (connector->encoder && connector->encoder->crtc == crtc) {
 			if (connector_list != NULL && count < num_connectors)
 				*(connector_list++) = connector;
@@ -91,6 +93,7 @@  static int get_connectors_for_crtc(struct drm_crtc *crtc,
 			count++;
 		}
 	}
+	drm_connector_list_iter_put(&conn_iter);
 
 	return count;
 }
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index ac953f037be7..7cff91e7497f 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -129,6 +129,7 @@  void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
 {
 	bool poll = false;
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	unsigned long delay = DRM_OUTPUT_POLL_PERIOD;
 
 	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
@@ -136,11 +137,13 @@  void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
 	if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll)
 		return;
 
-	drm_for_each_connector(connector, dev) {
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT |
 					 DRM_CONNECTOR_POLL_DISCONNECT))
 			poll = true;
 	}
+	drm_connector_list_iter_put(&conn_iter);
 
 	if (dev->mode_config.delayed_event) {
 		poll = true;
@@ -382,6 +385,7 @@  static void output_poll_execute(struct work_struct *work)
 	struct delayed_work *delayed_work = to_delayed_work(work);
 	struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work);
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	enum drm_connector_status old_status;
 	bool repoll = false, changed;
 
@@ -397,8 +401,8 @@  static void output_poll_execute(struct work_struct *work)
 		goto out;
 	}
 
-	drm_for_each_connector(connector, dev) {
-
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		/* Ignore forced connectors. */
 		if (connector->force)
 			continue;
@@ -451,6 +455,7 @@  static void output_poll_execute(struct work_struct *work)
 			changed = true;
 		}
 	}
+	drm_connector_list_iter_put(&conn_iter);
 
 	mutex_unlock(&dev->mode_config.mutex);
 
@@ -562,6 +567,7 @@  EXPORT_SYMBOL(drm_kms_helper_poll_fini);
 bool drm_helper_hpd_irq_event(struct drm_device *dev)
 {
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	enum drm_connector_status old_status;
 	bool changed = false;
 
@@ -569,8 +575,8 @@  bool drm_helper_hpd_irq_event(struct drm_device *dev)
 		return false;
 
 	mutex_lock(&dev->mode_config.mutex);
-	drm_for_each_connector(connector, dev) {
-
+	drm_connector_list_iter_get(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		/* Only handle HPD capable connectors. */
 		if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
 			continue;
@@ -586,7 +592,7 @@  bool drm_helper_hpd_irq_event(struct drm_device *dev)
 		if (old_status != connector->status)
 			changed = true;
 	}
-
+	drm_connector_list_iter_put(&conn_iter);
 	mutex_unlock(&dev->mode_config.mutex);
 
 	if (changed)

Comments

Reviewed-by: Harry Wentland: <harry.wentland@amd.com>

On 2016-12-15 10:58 AM, Daniel Vetter wrote:
> Mostly nothing special (except making sure that really all error paths
> and friends call iter_put).
>
> v2: Don't forget the raw connector_list walking in
> drm_helper_move_panel_connectors_to_head. That one unfortunately can't
> be converted to the iterator helpers, but since it's just some list
> splicing best to just wrap the entire thing up in one critical
> section.
>
> v3: Bail out after iter_put (Harry).
>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c  | 39 ++++++++++++++++++++--------
>  drivers/gpu/drm/drm_crtc_helper.c    | 49 ++++++++++++++++++++++++++++--------
>  drivers/gpu/drm/drm_fb_helper.c      | 12 ++++++---
>  drivers/gpu/drm/drm_modeset_helper.c |  2 ++
>  drivers/gpu/drm/drm_plane_helper.c   |  5 +++-
>  drivers/gpu/drm/drm_probe_helper.c   | 18 ++++++++-----
>  6 files changed, 92 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 23767df72615..e2e15a9903a9 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -94,9 +94,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>  {
>  	struct drm_connector_state *conn_state;
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	struct drm_encoder *encoder;
>  	unsigned encoder_mask = 0;
> -	int i, ret;
> +	int i, ret = 0;
>
>  	/*
>  	 * First loop, find all newly assigned encoders from the connectors
> @@ -144,7 +145,8 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>  	 * and the crtc is disabled if no encoder is left. This preserves
>  	 * compatibility with the legacy set_config behavior.
>  	 */
> -	drm_for_each_connector(connector, state->dev) {
> +	drm_connector_list_iter_get(state->dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		struct drm_crtc_state *crtc_state;
>
>  		if (drm_atomic_get_existing_connector_state(state, connector))
> @@ -160,12 +162,15 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>  					 connector->state->crtc->base.id,
>  					 connector->state->crtc->name,
>  					 connector->base.id, connector->name);
> -			return -EINVAL;
> +			ret = -EINVAL;
> +			goto out;
>  		}
>
>  		conn_state = drm_atomic_get_connector_state(state, connector);
> -		if (IS_ERR(conn_state))
> -			return PTR_ERR(conn_state);
> +		if (IS_ERR(conn_state)) {
> +			ret = PTR_ERR(conn_state);
> +			goto out;
> +		}
>
>  		DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] in use on [CRTC:%d:%s], disabling [CONNECTOR:%d:%s]\n",
>  				 encoder->base.id, encoder->name,
> @@ -176,19 +181,21 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>
>  		ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
>  		if (ret)
> -			return ret;
> +			goto out;
>
>  		if (!crtc_state->connector_mask) {
>  			ret = drm_atomic_set_mode_prop_for_crtc(crtc_state,
>  								NULL);
>  			if (ret < 0)
> -				return ret;
> +				goto out;
>
>  			crtc_state->active = false;
>  		}
>  	}
> +out:
> +	drm_connector_list_iter_put(&conn_iter);
>
> -	return 0;
> +	return ret;
>  }
>
>  static void
> @@ -2442,6 +2449,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  {
>  	struct drm_atomic_state *state;
>  	struct drm_connector *conn;
> +	struct drm_connector_list_iter conn_iter;
>  	int err;
>
>  	state = drm_atomic_state_alloc(dev);
> @@ -2450,7 +2458,8 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>
>  	state->acquire_ctx = ctx;
>
> -	drm_for_each_connector(conn, dev) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(conn, &conn_iter) {
>  		struct drm_crtc *crtc = conn->state->crtc;
>  		struct drm_crtc_state *crtc_state;
>
> @@ -2468,6 +2477,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>
>  	err = drm_atomic_commit(state);
>  free:
> +	drm_connector_list_iter_put(&conn_iter);
>  	drm_atomic_state_put(state);
>  	return err;
>  }
> @@ -2840,6 +2850,7 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_crtc *crtc;
>  	struct drm_connector *tmp_connector;
> +	struct drm_connector_list_iter conn_iter;
>  	int ret;
>  	bool active = false;
>  	int old_mode = connector->dpms;
> @@ -2867,7 +2878,8 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
>
>  	WARN_ON(!drm_modeset_is_locked(&config->connection_mutex));
>
> -	drm_for_each_connector(tmp_connector, connector->dev) {
> +	drm_connector_list_iter_get(connector->dev, &conn_iter);
> +	drm_for_each_connector_iter(tmp_connector, &conn_iter) {
>  		if (tmp_connector->state->crtc != crtc)
>  			continue;
>
> @@ -2876,6 +2888,7 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
>  			break;
>  		}
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>  	crtc_state->active = active;
>
>  	ret = drm_atomic_commit(state);
> @@ -3253,6 +3266,7 @@ drm_atomic_helper_duplicate_state(struct drm_device *dev,
>  {
>  	struct drm_atomic_state *state;
>  	struct drm_connector *conn;
> +	struct drm_connector_list_iter conn_iter;
>  	struct drm_plane *plane;
>  	struct drm_crtc *crtc;
>  	int err = 0;
> @@ -3283,15 +3297,18 @@ drm_atomic_helper_duplicate_state(struct drm_device *dev,
>  		}
>  	}
>
> -	drm_for_each_connector(conn, dev) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(conn, &conn_iter) {
>  		struct drm_connector_state *conn_state;
>
>  		conn_state = drm_atomic_get_connector_state(state, conn);
>  		if (IS_ERR(conn_state)) {
>  			err = PTR_ERR(conn_state);
> +			drm_connector_list_iter_put(&conn_iter);
>  			goto free;
>  		}
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>
>  	/* clear the acquire context so that it isn't accidentally reused */
>  	state->acquire_ctx = NULL;
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index 9d007f5f9732..ad154325a0fd 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -88,6 +88,7 @@
>  bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
>  {
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	struct drm_device *dev = encoder->dev;
>
>  	/*
> @@ -99,9 +100,15 @@ bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
>  		WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
>  	}
>
> -	drm_for_each_connector(connector, dev)
> -		if (connector->encoder == encoder)
> +
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
> +		if (connector->encoder == encoder) {
> +			drm_connector_list_iter_put(&conn_iter);
>  			return true;
> +		}
> +	}
> +	drm_connector_list_iter_put(&conn_iter);
>  	return false;
>  }
>  EXPORT_SYMBOL(drm_helper_encoder_in_use);
> @@ -436,10 +443,13 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
>
>  	/* Decouple all encoders and their attached connectors from this crtc */
>  	drm_for_each_encoder(encoder, dev) {
> +		struct drm_connector_list_iter conn_iter;
> +
>  		if (encoder->crtc != crtc)
>  			continue;
>
> -		drm_for_each_connector(connector, dev) {
> +		drm_connector_list_iter_get(dev, &conn_iter);
> +		drm_for_each_connector_iter(connector, &conn_iter) {
>  			if (connector->encoder != encoder)
>  				continue;
>
> @@ -456,6 +466,7 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
>  			/* we keep a reference while the encoder is bound */
>  			drm_connector_unreference(connector);
>  		}
> +		drm_connector_list_iter_put(&conn_iter);
>  	}
>
>  	__drm_helper_disable_unused_functions(dev);
> @@ -507,6 +518,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>  	bool mode_changed = false; /* if true do a full mode set */
>  	bool fb_changed = false; /* if true and !mode_changed just do a flip */
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	int count = 0, ro, fail = 0;
>  	const struct drm_crtc_helper_funcs *crtc_funcs;
>  	struct drm_mode_set save_set;
> @@ -571,9 +583,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>  	}
>
>  	count = 0;
> -	drm_for_each_connector(connector, dev) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter)
>  		save_connector_encoders[count++] = connector->encoder;
> -	}
> +	drm_connector_list_iter_put(&conn_iter);
>
>  	save_set.crtc = set->crtc;
>  	save_set.mode = &set->crtc->mode;
> @@ -615,7 +628,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>
>  	/* a) traverse passed in connector list and get encoders for them */
>  	count = 0;
> -	drm_for_each_connector(connector, dev) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		const struct drm_connector_helper_funcs *connector_funcs =
>  			connector->helper_private;
>  		new_encoder = connector->encoder;
> @@ -648,6 +662,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>  			connector->encoder = new_encoder;
>  		}
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>
>  	if (fail) {
>  		ret = -EINVAL;
> @@ -655,7 +670,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>  	}
>
>  	count = 0;
> -	drm_for_each_connector(connector, dev) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		if (!connector->encoder)
>  			continue;
>
> @@ -673,6 +689,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>  		if (new_crtc &&
>  		    !drm_encoder_crtc_ok(connector->encoder, new_crtc)) {
>  			ret = -EINVAL;
> +			drm_connector_list_iter_put(&conn_iter);
>  			goto fail;
>  		}
>  		if (new_crtc != connector->encoder->crtc) {
> @@ -689,6 +706,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>  				      connector->base.id, connector->name);
>  		}
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>
>  	/* mode_set_base is not a required function */
>  	if (fb_changed && !crtc_funcs->mode_set_base)
> @@ -743,9 +761,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>  	}
>
>  	count = 0;
> -	drm_for_each_connector(connector, dev) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter)
>  		connector->encoder = save_connector_encoders[count++];
> -	}
> +	drm_connector_list_iter_put(&conn_iter);
>
>  	/* after fail drop reference on all unbound connectors in set, let
>  	 * bound connectors keep their reference
> @@ -772,12 +791,16 @@ static int drm_helper_choose_encoder_dpms(struct drm_encoder *encoder)
>  {
>  	int dpms = DRM_MODE_DPMS_OFF;
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	struct drm_device *dev = encoder->dev;
>
> -	drm_for_each_connector(connector, dev)
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter)
>  		if (connector->encoder == encoder)
>  			if (connector->dpms < dpms)
>  				dpms = connector->dpms;
> +	drm_connector_list_iter_put(&conn_iter);
> +
>  	return dpms;
>  }
>
> @@ -809,12 +832,16 @@ static int drm_helper_choose_crtc_dpms(struct drm_crtc *crtc)
>  {
>  	int dpms = DRM_MODE_DPMS_OFF;
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	struct drm_device *dev = crtc->dev;
>
> -	drm_for_each_connector(connector, dev)
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter)
>  		if (connector->encoder && connector->encoder->crtc == crtc)
>  			if (connector->dpms < dpms)
>  				dpms = connector->dpms;
> +	drm_connector_list_iter_put(&conn_iter);
> +
>  	return dpms;
>  }
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index bee5e4149a1c..145d55fef69e 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -120,20 +120,22 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
>  {
>  	struct drm_device *dev = fb_helper->dev;
>  	struct drm_connector *connector;
> -	int i, ret;
> +	struct drm_connector_list_iter conn_iter;
> +	int i, ret = 0;
>
>  	if (!drm_fbdev_emulation)
>  		return 0;
>
>  	mutex_lock(&dev->mode_config.mutex);
> -	drm_for_each_connector(connector, dev) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		ret = drm_fb_helper_add_one_connector(fb_helper, connector);
>
>  		if (ret)
>  			goto fail;
>  	}
> -	mutex_unlock(&dev->mode_config.mutex);
> -	return 0;
> +	goto out;
> +
>  fail:
>  	drm_fb_helper_for_each_connector(fb_helper, i) {
>  		struct drm_fb_helper_connector *fb_helper_connector =
> @@ -145,6 +147,8 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
>  		fb_helper->connector_info[i] = NULL;
>  	}
>  	fb_helper->connector_count = 0;
> +out:
> +	drm_connector_list_iter_put(&conn_iter);
>  	mutex_unlock(&dev->mode_config.mutex);
>
>  	return ret;
> diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
> index 5b051859b8d3..5d8fa791fff5 100644
> --- a/drivers/gpu/drm/drm_modeset_helper.c
> +++ b/drivers/gpu/drm/drm_modeset_helper.c
> @@ -48,6 +48,7 @@ void drm_helper_move_panel_connectors_to_head(struct drm_device *dev)
>
>  	INIT_LIST_HEAD(&panel_list);
>
> +	spin_lock_irq(&dev->mode_config.connector_list_lock);
>  	list_for_each_entry_safe(connector, tmp,
>  				 &dev->mode_config.connector_list, head) {
>  		if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS ||
> @@ -57,6 +58,7 @@ void drm_helper_move_panel_connectors_to_head(struct drm_device *dev)
>  	}
>
>  	list_splice(&panel_list, &dev->mode_config.connector_list);
> +	spin_unlock_irq(&dev->mode_config.connector_list_lock);
>  }
>  EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head);
>
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index 7a7dddf604d7..bc9f97422cd1 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -74,6 +74,7 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
>  {
>  	struct drm_device *dev = crtc->dev;
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	int count = 0;
>
>  	/*
> @@ -83,7 +84,8 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
>  	 */
>  	WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
>
> -	drm_for_each_connector(connector, dev) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		if (connector->encoder && connector->encoder->crtc == crtc) {
>  			if (connector_list != NULL && count < num_connectors)
>  				*(connector_list++) = connector;
> @@ -91,6 +93,7 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
>  			count++;
>  		}
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>
>  	return count;
>  }
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index ac953f037be7..7cff91e7497f 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -129,6 +129,7 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
>  {
>  	bool poll = false;
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	unsigned long delay = DRM_OUTPUT_POLL_PERIOD;
>
>  	WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
> @@ -136,11 +137,13 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
>  	if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll)
>  		return;
>
> -	drm_for_each_connector(connector, dev) {
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT |
>  					 DRM_CONNECTOR_POLL_DISCONNECT))
>  			poll = true;
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>
>  	if (dev->mode_config.delayed_event) {
>  		poll = true;
> @@ -382,6 +385,7 @@ static void output_poll_execute(struct work_struct *work)
>  	struct delayed_work *delayed_work = to_delayed_work(work);
>  	struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work);
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	enum drm_connector_status old_status;
>  	bool repoll = false, changed;
>
> @@ -397,8 +401,8 @@ static void output_poll_execute(struct work_struct *work)
>  		goto out;
>  	}
>
> -	drm_for_each_connector(connector, dev) {
> -
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		/* Ignore forced connectors. */
>  		if (connector->force)
>  			continue;
> @@ -451,6 +455,7 @@ static void output_poll_execute(struct work_struct *work)
>  			changed = true;
>  		}
>  	}
> +	drm_connector_list_iter_put(&conn_iter);
>
>  	mutex_unlock(&dev->mode_config.mutex);
>
> @@ -562,6 +567,7 @@ EXPORT_SYMBOL(drm_kms_helper_poll_fini);
>  bool drm_helper_hpd_irq_event(struct drm_device *dev)
>  {
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	enum drm_connector_status old_status;
>  	bool changed = false;
>
> @@ -569,8 +575,8 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev)
>  		return false;
>
>  	mutex_lock(&dev->mode_config.mutex);
> -	drm_for_each_connector(connector, dev) {
> -
> +	drm_connector_list_iter_get(dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		/* Only handle HPD capable connectors. */
>  		if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
>  			continue;
> @@ -586,7 +592,7 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev)
>  		if (old_status != connector->status)
>  			changed = true;
>  	}
> -
> +	drm_connector_list_iter_put(&conn_iter);
>  	mutex_unlock(&dev->mode_config.mutex);
>
>  	if (changed)
>
Hi Daniel,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on next-20161215]
[cannot apply to v4.9]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-Convert-all-helpers-to-drm_connector_list_iter/20161216-061508
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-x005-201650 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_encoder_in_use':
   drivers/gpu/drm/drm_crtc_helper.c:91:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:104:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_get(dev, &conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:105:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
     drm_for_each_connector_iter(connector, &conn_iter) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:105:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_crtc_helper.c:91:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_disable':
   drivers/gpu/drm/drm_crtc_helper.c:446:34: error: storage size of 'conn_iter' isn't known
      struct drm_connector_list_iter conn_iter;
                                     ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:452:54: error: expected ';' before '{' token
      drm_for_each_connector_iter(connector, &conn_iter) {
                                                         ^
   drivers/gpu/drm/drm_crtc_helper.c:446:34: warning: unused variable 'conn_iter' [-Wunused-variable]
      struct drm_connector_list_iter conn_iter;
                                     ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_set_config':
   drivers/gpu/drm/drm_crtc_helper.c:521:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:588:3: error: expected ';' before 'save_connector_encoders'
      save_connector_encoders[count++] = connector->encoder;
      ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:589:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_put(&conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:633:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_crtc_helper.c:675:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_crtc_helper.c:767:3: error: expected ';' before 'connector'
      connector->encoder = save_connector_encoders[count++];
      ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:521:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:517:49: warning: unused variable 'new_encoder' [-Wunused-variable]
     struct drm_encoder **save_connector_encoders, *new_encoder, *encoder;
                                                    ^~~~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:516:41: warning: unused variable 'new_crtc' [-Wunused-variable]
     struct drm_crtc **save_encoder_crtcs, *new_crtc;
                                            ^~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_encoder_dpms':
   drivers/gpu/drm/drm_crtc_helper.c:795:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
>> drivers/gpu/drm/drm_crtc_helper.c:800:3: error: expected ';' before 'if'
      if (connector->encoder == encoder)
      ^~
   drivers/gpu/drm/drm_crtc_helper.c:795:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_crtc_dpms':
   drivers/gpu/drm/drm_crtc_helper.c:836:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:841:3: error: expected ';' before 'if'
      if (connector->encoder && connector->encoder->crtc == crtc)
      ^~
   drivers/gpu/drm/drm_crtc_helper.c:836:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   cc1: some warnings being treated as errors

vim +800 drivers/gpu/drm/drm_crtc_helper.c

c9fb15f60 Keith Packard 2009-05-30  794  	struct drm_connector *connector;
bb3781dd0 Daniel Vetter 2016-12-15  795  	struct drm_connector_list_iter conn_iter;
c9fb15f60 Keith Packard 2009-05-30  796  	struct drm_device *dev = encoder->dev;
c9fb15f60 Keith Packard 2009-05-30  797  
bb3781dd0 Daniel Vetter 2016-12-15  798  	drm_connector_list_iter_get(dev, &conn_iter);
bb3781dd0 Daniel Vetter 2016-12-15  799  	drm_for_each_connector_iter(connector, &conn_iter)
c9fb15f60 Keith Packard 2009-05-30 @800  		if (connector->encoder == encoder)
c9fb15f60 Keith Packard 2009-05-30  801  			if (connector->dpms < dpms)
c9fb15f60 Keith Packard 2009-05-30  802  				dpms = connector->dpms;
bb3781dd0 Daniel Vetter 2016-12-15  803  	drm_connector_list_iter_put(&conn_iter);

:::::: The code at line 800 was first introduced by commit
:::::: c9fb15f60eb517c958dec64dca9357bf62bf2201 drm: Hook up DPMS property handling in drm_crtc.c. Add drm_helper_connector_dpms.

:::::: TO: Keith Packard <keithp@keithp.com>
:::::: CC: Dave Airlie <airlied@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Hi Daniel,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on next-20161215]
[cannot apply to v4.9]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-Convert-all-helpers-to-drm_connector_list_iter/20161216-061508
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-x003-201650 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_encoder_in_use':
>> drivers/gpu/drm/drm_crtc_helper.c:91:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
>> drivers/gpu/drm/drm_crtc_helper.c:104:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_get(dev, &conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_crtc_helper.c:105:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
     drm_for_each_connector_iter(connector, &conn_iter) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_crtc_helper.c:105:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_crtc_helper.c:91:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_disable':
   drivers/gpu/drm/drm_crtc_helper.c:446:34: error: storage size of 'conn_iter' isn't known
      struct drm_connector_list_iter conn_iter;
                                     ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:452:54: error: expected ';' before '{' token
      drm_for_each_connector_iter(connector, &conn_iter) {
                                                         ^
   drivers/gpu/drm/drm_crtc_helper.c:446:34: warning: unused variable 'conn_iter' [-Wunused-variable]
      struct drm_connector_list_iter conn_iter;
                                     ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_set_config':
   drivers/gpu/drm/drm_crtc_helper.c:521:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
>> drivers/gpu/drm/drm_crtc_helper.c:588:3: error: expected ';' before 'save_connector_encoders'
      save_connector_encoders[count++] = connector->encoder;
      ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_crtc_helper.c:589:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_put(&conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:633:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_crtc_helper.c:675:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
>> drivers/gpu/drm/drm_crtc_helper.c:767:3: error: expected ';' before 'connector'
      connector->encoder = save_connector_encoders[count++];
      ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:521:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:517:49: warning: unused variable 'new_encoder' [-Wunused-variable]
     struct drm_encoder **save_connector_encoders, *new_encoder, *encoder;
                                                    ^~~~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:516:41: warning: unused variable 'new_crtc' [-Wunused-variable]
     struct drm_crtc **save_encoder_crtcs, *new_crtc;
                                            ^~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_encoder_dpms':
   drivers/gpu/drm/drm_crtc_helper.c:795:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from drivers/gpu/drm/drm_crtc_helper.c:32:
>> include/linux/compiler.h:149:2: error: expected ';' before 'if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:147:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
>> drivers/gpu/drm/drm_crtc_helper.c:800:3: note: in expansion of macro 'if'
      if (connector->encoder == encoder)
      ^~
   drivers/gpu/drm/drm_crtc_helper.c:795:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_crtc_dpms':
   drivers/gpu/drm/drm_crtc_helper.c:836:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from drivers/gpu/drm/drm_crtc_helper.c:32:
>> include/linux/compiler.h:149:2: error: expected ';' before 'if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:147:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
   drivers/gpu/drm/drm_crtc_helper.c:841:3: note: in expansion of macro 'if'
      if (connector->encoder && connector->encoder->crtc == crtc)
      ^~
   drivers/gpu/drm/drm_crtc_helper.c:836:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/drm_probe_helper.c: In function 'drm_kms_helper_poll_enable_locked':
>> drivers/gpu/drm/drm_probe_helper.c:132:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
>> drivers/gpu/drm/drm_probe_helper.c:140:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_get(dev, &conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_probe_helper.c:141:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
     drm_for_each_connector_iter(connector, &conn_iter) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_probe_helper.c:141:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_probe_helper.c:132:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_probe_helper.c: In function 'output_poll_execute':
   drivers/gpu/drm/drm_probe_helper.c:388:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_probe_helper.c:405:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_probe_helper.c:389:28: warning: unused variable 'old_status' [-Wunused-variable]
     enum drm_connector_status old_status;
                               ^~~~~~~~~~
   drivers/gpu/drm/drm_probe_helper.c:388:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_probe_helper.c: In function 'drm_helper_hpd_irq_event':
   drivers/gpu/drm/drm_probe_helper.c:570:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_probe_helper.c:579:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_probe_helper.c:571:28: warning: unused variable 'old_status' [-Wunused-variable]
     enum drm_connector_status old_status;
                               ^~~~~~~~~~
   drivers/gpu/drm/drm_probe_helper.c:570:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/drm_plane_helper.c: In function 'get_connectors_for_crtc':
>> drivers/gpu/drm/drm_plane_helper.c:77:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
>> drivers/gpu/drm/drm_plane_helper.c:87:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_get(dev, &conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_plane_helper.c:88:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
     drm_for_each_connector_iter(connector, &conn_iter) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_plane_helper.c:88:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_plane_helper.c:77:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/drm_atomic_helper.c: In function 'handle_conflicting_encoders':
>> drivers/gpu/drm/drm_atomic_helper.c:97:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
>> drivers/gpu/drm/drm_atomic_helper.c:148:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_get(state->dev, &conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_atomic_helper.c:149:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
     drm_for_each_connector_iter(connector, &conn_iter) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_atomic_helper.c:149:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
   drivers/gpu/drm/drm_atomic_helper.c:98:22: warning: unused variable 'encoder' [-Wunused-variable]
     struct drm_encoder *encoder;
                         ^~~~~~~
   drivers/gpu/drm/drm_atomic_helper.c:97:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_disable_all':
   drivers/gpu/drm/drm_atomic_helper.c:2452:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_atomic_helper.c:2462:48: error: expected ';' before '{' token
     drm_for_each_connector_iter(conn, &conn_iter) {
                                                   ^
>> drivers/gpu/drm/drm_atomic_helper.c:2480:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_put(&conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic_helper.c:2479:1: warning: label 'free' defined but not used [-Wunused-label]
    free:
    ^~~~
   drivers/gpu/drm/drm_atomic_helper.c:2452:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_connector_dpms':
   drivers/gpu/drm/drm_atomic_helper.c:2853:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_atomic_helper.c:2882:57: error: expected ';' before '{' token
     drm_for_each_connector_iter(tmp_connector, &conn_iter) {
                                                            ^
   drivers/gpu/drm/drm_atomic_helper.c:2853:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_duplicate_state':
   drivers/gpu/drm/drm_atomic_helper.c:3269:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   drivers/gpu/drm/drm_atomic_helper.c:3301:48: error: expected ';' before '{' token
     drm_for_each_connector_iter(conn, &conn_iter) {
                                                   ^
   drivers/gpu/drm/drm_atomic_helper.c:3269:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/drm_modeset_helper.c: In function 'drm_helper_move_panel_connectors_to_head':
>> drivers/gpu/drm/drm_modeset_helper.c:51:33: error: 'struct drm_mode_config' has no member named 'connector_list_lock'; did you mean 'connector_list'?
     spin_lock_irq(&dev->mode_config.connector_list_lock);
                                    ^
   drivers/gpu/drm/drm_modeset_helper.c:61:35: error: 'struct drm_mode_config' has no member named 'connector_list_lock'; did you mean 'connector_list'?
     spin_unlock_irq(&dev->mode_config.connector_list_lock);
                                      ^
--
   drivers/gpu/drm/drm_fb_helper.c: In function 'drm_fb_helper_single_add_all_connectors':
>> drivers/gpu/drm/drm_fb_helper.c:123:33: error: storage size of 'conn_iter' isn't known
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
>> drivers/gpu/drm/drm_fb_helper.c:130:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_get(dev, &conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_fb_helper.c:131:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
     drm_for_each_connector_iter(connector, &conn_iter) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_fb_helper.c:131:53: error: expected ';' before '{' token
     drm_for_each_connector_iter(connector, &conn_iter) {
                                                        ^
>> drivers/gpu/drm/drm_fb_helper.c:151:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
     drm_connector_list_iter_put(&conn_iter);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_fb_helper.c:150:1: warning: label 'out' defined but not used [-Wunused-label]
    out:
    ^~~
   drivers/gpu/drm/drm_fb_helper.c:139:1: warning: label 'fail' defined but not used [-Wunused-label]
    fail:
    ^~~~
   drivers/gpu/drm/drm_fb_helper.c:123:33: warning: unused variable 'conn_iter' [-Wunused-variable]
     struct drm_connector_list_iter conn_iter;
                                    ^~~~~~~~~
   cc1: some warnings being treated as errors

vim +91 drivers/gpu/drm/drm_crtc_helper.c

    26	 *      Keith Packard
    27	 *	Eric Anholt <eric@anholt.net>
    28	 *      Dave Airlie <airlied@linux.ie>
    29	 *      Jesse Barnes <jesse.barnes@intel.com>
    30	 */
    31	
  > 32	#include <linux/kernel.h>
    33	#include <linux/export.h>
    34	#include <linux/moduleparam.h>
    35	
    36	#include <drm/drmP.h>
    37	#include <drm/drm_atomic.h>
    38	#include <drm/drm_crtc.h>
    39	#include <drm/drm_fourcc.h>
    40	#include <drm/drm_crtc_helper.h>
    41	#include <drm/drm_fb_helper.h>
    42	#include <drm/drm_plane_helper.h>
    43	#include <drm/drm_atomic_helper.h>
    44	#include <drm/drm_edid.h>
    45	
    46	/**
    47	 * DOC: overview
    48	 *
    49	 * The CRTC modeset helper library provides a default set_config implementation
    50	 * in drm_crtc_helper_set_config(). Plus a few other convenience functions using
    51	 * the same callbacks which drivers can use to e.g. restore the modeset
    52	 * configuration on resume with drm_helper_resume_force_mode().
    53	 *
    54	 * Note that this helper library doesn't track the current power state of CRTCs
    55	 * and encoders. It can call callbacks like ->dpms() even though the hardware is
    56	 * already in the desired state. This deficiency has been fixed in the atomic
    57	 * helpers.
    58	 *
    59	 * The driver callbacks are mostly compatible with the atomic modeset helpers,
    60	 * except for the handling of the primary plane: Atomic helpers require that the
    61	 * primary plane is implemented as a real standalone plane and not directly tied
    62	 * to the CRTC state. For easier transition this library provides functions to
    63	 * implement the old semantics required by the CRTC helpers using the new plane
    64	 * and atomic helper callbacks.
    65	 *
    66	 * Drivers are strongly urged to convert to the atomic helpers (by way of first
    67	 * converting to the plane helpers). New drivers must not use these functions
    68	 * but need to implement the atomic interface instead, potentially using the
    69	 * atomic helpers for that.
    70	 *
    71	 * These legacy modeset helpers use the same function table structures as
    72	 * all other modesetting helpers. See the documentation for struct
    73	 * &drm_crtc_helper_funcs, struct &drm_encoder_helper_funcs and struct
    74	 * &drm_connector_helper_funcs.
    75	 */
    76	
    77	/**
    78	 * drm_helper_encoder_in_use - check if a given encoder is in use
    79	 * @encoder: encoder to check
    80	 *
    81	 * Checks whether @encoder is with the current mode setting output configuration
    82	 * in use by any connector. This doesn't mean that it is actually enabled since
    83	 * the DPMS state is tracked separately.
    84	 *
    85	 * Returns:
    86	 * True if @encoder is used, false otherwise.
    87	 */
    88	bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
    89	{
    90		struct drm_connector *connector;
  > 91		struct drm_connector_list_iter conn_iter;
    92		struct drm_device *dev = encoder->dev;
    93	
    94		/*
    95		 * We can expect this mutex to be locked if we are not panicking.
    96		 * Locking is currently fubar in the panic handler.
    97		 */
    98		if (!oops_in_progress) {
    99			WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
   100			WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
   101		}
   102	
   103	
 > 104		drm_connector_list_iter_get(dev, &conn_iter);
 > 105		drm_for_each_connector_iter(connector, &conn_iter) {
   106			if (connector->encoder == encoder) {
   107				drm_connector_list_iter_put(&conn_iter);
   108				return true;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Hi Kbuild folks

So yeah this doesn't apply because it's just 1 patch resent out of a
big patch series, in-reply-to the patch it replaces. So applying this
alone and telling me (and all the mailing lists) that it doesn't apply
isn't all that useful.

And it shouldn't be too hard to detect this, since the fdo patchwork
instance does catch most of these partial resends successfully and
correctly, and will retest the entire patch series.
-Daniel


On Thu, Dec 15, 2016 at 11:59 PM, kbuild test robot <lkp@intel.com> wrote:
> Hi Daniel,
>
> [auto build test ERROR on drm/drm-next]
> [also build test ERROR on next-20161215]
> [cannot apply to v4.9]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-Convert-all-helpers-to-drm_connector_list_iter/20161216-061508
> base:   git://people.freedesktop.org/~airlied/linux.git drm-next
> config: i386-randconfig-x003-201650 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386
>
> All error/warnings (new ones prefixed by >>):
>
>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_encoder_in_use':
>>> drivers/gpu/drm/drm_crtc_helper.c:91:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>>> drivers/gpu/drm/drm_crtc_helper.c:104:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>      drm_connector_list_iter_get(dev, &conn_iter);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_crtc_helper.c:105:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>      drm_for_each_connector_iter(connector, &conn_iter) {
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_crtc_helper.c:105:53: error: expected ';' before '{' token
>      drm_for_each_connector_iter(connector, &conn_iter) {
>                                                         ^
>    drivers/gpu/drm/drm_crtc_helper.c:91:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_disable':
>    drivers/gpu/drm/drm_crtc_helper.c:446:34: error: storage size of 'conn_iter' isn't known
>       struct drm_connector_list_iter conn_iter;
>                                      ^~~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c:452:54: error: expected ';' before '{' token
>       drm_for_each_connector_iter(connector, &conn_iter) {
>                                                          ^
>    drivers/gpu/drm/drm_crtc_helper.c:446:34: warning: unused variable 'conn_iter' [-Wunused-variable]
>       struct drm_connector_list_iter conn_iter;
>                                      ^~~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_set_config':
>    drivers/gpu/drm/drm_crtc_helper.c:521:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>>> drivers/gpu/drm/drm_crtc_helper.c:588:3: error: expected ';' before 'save_connector_encoders'
>       save_connector_encoders[count++] = connector->encoder;
>       ^~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_crtc_helper.c:589:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
>      drm_connector_list_iter_put(&conn_iter);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c:633:53: error: expected ';' before '{' token
>      drm_for_each_connector_iter(connector, &conn_iter) {
>                                                         ^
>    drivers/gpu/drm/drm_crtc_helper.c:675:53: error: expected ';' before '{' token
>      drm_for_each_connector_iter(connector, &conn_iter) {
>                                                         ^
>>> drivers/gpu/drm/drm_crtc_helper.c:767:3: error: expected ';' before 'connector'
>       connector->encoder = save_connector_encoders[count++];
>       ^~~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c:521:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c:517:49: warning: unused variable 'new_encoder' [-Wunused-variable]
>      struct drm_encoder **save_connector_encoders, *new_encoder, *encoder;
>                                                     ^~~~~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c:516:41: warning: unused variable 'new_crtc' [-Wunused-variable]
>      struct drm_crtc **save_encoder_crtcs, *new_crtc;
>                                             ^~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_encoder_dpms':
>    drivers/gpu/drm/drm_crtc_helper.c:795:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    In file included from include/linux/linkage.h:4:0,
>                     from include/linux/kernel.h:6,
>                     from drivers/gpu/drm/drm_crtc_helper.c:32:
>>> include/linux/compiler.h:149:2: error: expected ';' before 'if'
>      if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
>      ^
>    include/linux/compiler.h:147:23: note: in expansion of macro '__trace_if'
>     #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
>                           ^~~~~~~~~~
>>> drivers/gpu/drm/drm_crtc_helper.c:800:3: note: in expansion of macro 'if'
>       if (connector->encoder == encoder)
>       ^~
>    drivers/gpu/drm/drm_crtc_helper.c:795:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_crtc_dpms':
>    drivers/gpu/drm/drm_crtc_helper.c:836:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    In file included from include/linux/linkage.h:4:0,
>                     from include/linux/kernel.h:6,
>                     from drivers/gpu/drm/drm_crtc_helper.c:32:
>>> include/linux/compiler.h:149:2: error: expected ';' before 'if'
>      if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
>      ^
>    include/linux/compiler.h:147:23: note: in expansion of macro '__trace_if'
>     #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
>                           ^~~~~~~~~~
>    drivers/gpu/drm/drm_crtc_helper.c:841:3: note: in expansion of macro 'if'
>       if (connector->encoder && connector->encoder->crtc == crtc)
>       ^~
>    drivers/gpu/drm/drm_crtc_helper.c:836:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    drivers/gpu/drm/drm_probe_helper.c: In function 'drm_kms_helper_poll_enable_locked':
>>> drivers/gpu/drm/drm_probe_helper.c:132:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>>> drivers/gpu/drm/drm_probe_helper.c:140:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>      drm_connector_list_iter_get(dev, &conn_iter);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_probe_helper.c:141:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>      drm_for_each_connector_iter(connector, &conn_iter) {
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_probe_helper.c:141:53: error: expected ';' before '{' token
>      drm_for_each_connector_iter(connector, &conn_iter) {
>                                                         ^
>    drivers/gpu/drm/drm_probe_helper.c:132:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_probe_helper.c: In function 'output_poll_execute':
>    drivers/gpu/drm/drm_probe_helper.c:388:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_probe_helper.c:405:53: error: expected ';' before '{' token
>      drm_for_each_connector_iter(connector, &conn_iter) {
>                                                         ^
>    drivers/gpu/drm/drm_probe_helper.c:389:28: warning: unused variable 'old_status' [-Wunused-variable]
>      enum drm_connector_status old_status;
>                                ^~~~~~~~~~
>    drivers/gpu/drm/drm_probe_helper.c:388:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_probe_helper.c: In function 'drm_helper_hpd_irq_event':
>    drivers/gpu/drm/drm_probe_helper.c:570:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_probe_helper.c:579:53: error: expected ';' before '{' token
>      drm_for_each_connector_iter(connector, &conn_iter) {
>                                                         ^
>    drivers/gpu/drm/drm_probe_helper.c:571:28: warning: unused variable 'old_status' [-Wunused-variable]
>      enum drm_connector_status old_status;
>                                ^~~~~~~~~~
>    drivers/gpu/drm/drm_probe_helper.c:570:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    drivers/gpu/drm/drm_plane_helper.c: In function 'get_connectors_for_crtc':
>>> drivers/gpu/drm/drm_plane_helper.c:77:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>>> drivers/gpu/drm/drm_plane_helper.c:87:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>      drm_connector_list_iter_get(dev, &conn_iter);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_plane_helper.c:88:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>      drm_for_each_connector_iter(connector, &conn_iter) {
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_plane_helper.c:88:53: error: expected ';' before '{' token
>      drm_for_each_connector_iter(connector, &conn_iter) {
>                                                         ^
>    drivers/gpu/drm/drm_plane_helper.c:77:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    drivers/gpu/drm/drm_atomic_helper.c: In function 'handle_conflicting_encoders':
>>> drivers/gpu/drm/drm_atomic_helper.c:97:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>>> drivers/gpu/drm/drm_atomic_helper.c:148:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>      drm_connector_list_iter_get(state->dev, &conn_iter);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_atomic_helper.c:149:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>      drm_for_each_connector_iter(connector, &conn_iter) {
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_atomic_helper.c:149:53: error: expected ';' before '{' token
>      drm_for_each_connector_iter(connector, &conn_iter) {
>                                                         ^
>    drivers/gpu/drm/drm_atomic_helper.c:98:22: warning: unused variable 'encoder' [-Wunused-variable]
>      struct drm_encoder *encoder;
>                          ^~~~~~~
>    drivers/gpu/drm/drm_atomic_helper.c:97:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_disable_all':
>    drivers/gpu/drm/drm_atomic_helper.c:2452:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_atomic_helper.c:2462:48: error: expected ';' before '{' token
>      drm_for_each_connector_iter(conn, &conn_iter) {
>                                                    ^
>>> drivers/gpu/drm/drm_atomic_helper.c:2480:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
>      drm_connector_list_iter_put(&conn_iter);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/gpu/drm/drm_atomic_helper.c:2479:1: warning: label 'free' defined but not used [-Wunused-label]
>     free:
>     ^~~~
>    drivers/gpu/drm/drm_atomic_helper.c:2452:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_connector_dpms':
>    drivers/gpu/drm/drm_atomic_helper.c:2853:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_atomic_helper.c:2882:57: error: expected ';' before '{' token
>      drm_for_each_connector_iter(tmp_connector, &conn_iter) {
>                                                             ^
>    drivers/gpu/drm/drm_atomic_helper.c:2853:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_duplicate_state':
>    drivers/gpu/drm/drm_atomic_helper.c:3269:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    drivers/gpu/drm/drm_atomic_helper.c:3301:48: error: expected ';' before '{' token
>      drm_for_each_connector_iter(conn, &conn_iter) {
>                                                    ^
>    drivers/gpu/drm/drm_atomic_helper.c:3269:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    drivers/gpu/drm/drm_modeset_helper.c: In function 'drm_helper_move_panel_connectors_to_head':
>>> drivers/gpu/drm/drm_modeset_helper.c:51:33: error: 'struct drm_mode_config' has no member named 'connector_list_lock'; did you mean 'connector_list'?
>      spin_lock_irq(&dev->mode_config.connector_list_lock);
>                                     ^
>    drivers/gpu/drm/drm_modeset_helper.c:61:35: error: 'struct drm_mode_config' has no member named 'connector_list_lock'; did you mean 'connector_list'?
>      spin_unlock_irq(&dev->mode_config.connector_list_lock);
>                                       ^
> --
>    drivers/gpu/drm/drm_fb_helper.c: In function 'drm_fb_helper_single_add_all_connectors':
>>> drivers/gpu/drm/drm_fb_helper.c:123:33: error: storage size of 'conn_iter' isn't known
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>>> drivers/gpu/drm/drm_fb_helper.c:130:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>      drm_connector_list_iter_get(dev, &conn_iter);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_fb_helper.c:131:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>      drm_for_each_connector_iter(connector, &conn_iter) {
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/drm_fb_helper.c:131:53: error: expected ';' before '{' token
>      drm_for_each_connector_iter(connector, &conn_iter) {
>                                                         ^
>>> drivers/gpu/drm/drm_fb_helper.c:151:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
>      drm_connector_list_iter_put(&conn_iter);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/gpu/drm/drm_fb_helper.c:150:1: warning: label 'out' defined but not used [-Wunused-label]
>     out:
>     ^~~
>    drivers/gpu/drm/drm_fb_helper.c:139:1: warning: label 'fail' defined but not used [-Wunused-label]
>     fail:
>     ^~~~
>    drivers/gpu/drm/drm_fb_helper.c:123:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>      struct drm_connector_list_iter conn_iter;
>                                     ^~~~~~~~~
>    cc1: some warnings being treated as errors
>
> vim +91 drivers/gpu/drm/drm_crtc_helper.c
>
>     26   *      Keith Packard
>     27   *      Eric Anholt <eric@anholt.net>
>     28   *      Dave Airlie <airlied@linux.ie>
>     29   *      Jesse Barnes <jesse.barnes@intel.com>
>     30   */
>     31
>   > 32  #include <linux/kernel.h>
>     33  #include <linux/export.h>
>     34  #include <linux/moduleparam.h>
>     35
>     36  #include <drm/drmP.h>
>     37  #include <drm/drm_atomic.h>
>     38  #include <drm/drm_crtc.h>
>     39  #include <drm/drm_fourcc.h>
>     40  #include <drm/drm_crtc_helper.h>
>     41  #include <drm/drm_fb_helper.h>
>     42  #include <drm/drm_plane_helper.h>
>     43  #include <drm/drm_atomic_helper.h>
>     44  #include <drm/drm_edid.h>
>     45
>     46  /**
>     47   * DOC: overview
>     48   *
>     49   * The CRTC modeset helper library provides a default set_config implementation
>     50   * in drm_crtc_helper_set_config(). Plus a few other convenience functions using
>     51   * the same callbacks which drivers can use to e.g. restore the modeset
>     52   * configuration on resume with drm_helper_resume_force_mode().
>     53   *
>     54   * Note that this helper library doesn't track the current power state of CRTCs
>     55   * and encoders. It can call callbacks like ->dpms() even though the hardware is
>     56   * already in the desired state. This deficiency has been fixed in the atomic
>     57   * helpers.
>     58   *
>     59   * The driver callbacks are mostly compatible with the atomic modeset helpers,
>     60   * except for the handling of the primary plane: Atomic helpers require that the
>     61   * primary plane is implemented as a real standalone plane and not directly tied
>     62   * to the CRTC state. For easier transition this library provides functions to
>     63   * implement the old semantics required by the CRTC helpers using the new plane
>     64   * and atomic helper callbacks.
>     65   *
>     66   * Drivers are strongly urged to convert to the atomic helpers (by way of first
>     67   * converting to the plane helpers). New drivers must not use these functions
>     68   * but need to implement the atomic interface instead, potentially using the
>     69   * atomic helpers for that.
>     70   *
>     71   * These legacy modeset helpers use the same function table structures as
>     72   * all other modesetting helpers. See the documentation for struct
>     73   * &drm_crtc_helper_funcs, struct &drm_encoder_helper_funcs and struct
>     74   * &drm_connector_helper_funcs.
>     75   */
>     76
>     77  /**
>     78   * drm_helper_encoder_in_use - check if a given encoder is in use
>     79   * @encoder: encoder to check
>     80   *
>     81   * Checks whether @encoder is with the current mode setting output configuration
>     82   * in use by any connector. This doesn't mean that it is actually enabled since
>     83   * the DPMS state is tracked separately.
>     84   *
>     85   * Returns:
>     86   * True if @encoder is used, false otherwise.
>     87   */
>     88  bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
>     89  {
>     90          struct drm_connector *connector;
>   > 91          struct drm_connector_list_iter conn_iter;
>     92          struct drm_device *dev = encoder->dev;
>     93
>     94          /*
>     95           * We can expect this mutex to be locked if we are not panicking.
>     96           * Locking is currently fubar in the panic handler.
>     97           */
>     98          if (!oops_in_progress) {
>     99                  WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
>    100                  WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
>    101          }
>    102
>    103
>  > 104          drm_connector_list_iter_get(dev, &conn_iter);
>  > 105          drm_for_each_connector_iter(connector, &conn_iter) {
>    106                  if (connector->encoder == encoder) {
>    107                          drm_connector_list_iter_put(&conn_iter);
>    108                          return true;
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Hi Daniel,

On Fri, Dec 16, 2016 at 08:29:43AM +0100, Daniel Vetter wrote:
>Hi Kbuild folks
>
>So yeah this doesn't apply because it's just 1 patch resent out of a
>big patch series, in-reply-to the patch it replaces. So applying this
>alone and telling me (and all the mailing lists) that it doesn't apply
>isn't all that useful.
>
>And it shouldn't be too hard to detect this, since the fdo patchwork
>instance does catch most of these partial resends successfully and
>correctly, and will retest the entire patch series.

Good point! CC Xiaolong. This scenario seems happen frequent enough in
LKML to worth the efforts to add auto detect logic for.

Thanks,
Fengguang

>On Thu, Dec 15, 2016 at 11:59 PM, kbuild test robot <lkp@intel.com> wrote:
>> Hi Daniel,
>>
>> [auto build test ERROR on drm/drm-next]
>> [also build test ERROR on next-20161215]
>> [cannot apply to v4.9]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>
>> url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-Convert-all-helpers-to-drm_connector_list_iter/20161216-061508
>> base:   git://people.freedesktop.org/~airlied/linux.git drm-next
>> config: i386-randconfig-x003-201650 (attached as .config)
>> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
>> reproduce:
>>         # save the attached .config to linux build tree
>>         make ARCH=i386
>>
>> All error/warnings (new ones prefixed by >>):
>>
>>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_encoder_in_use':
>>>> drivers/gpu/drm/drm_crtc_helper.c:91:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>>> drivers/gpu/drm/drm_crtc_helper.c:104:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>      drm_connector_list_iter_get(dev, &conn_iter);
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_crtc_helper.c:105:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_crtc_helper.c:105:53: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                         ^
>>    drivers/gpu/drm/drm_crtc_helper.c:91:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_disable':
>>    drivers/gpu/drm/drm_crtc_helper.c:446:34: error: storage size of 'conn_iter' isn't known
>>       struct drm_connector_list_iter conn_iter;
>>                                      ^~~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c:452:54: error: expected ';' before '{' token
>>       drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                          ^
>>    drivers/gpu/drm/drm_crtc_helper.c:446:34: warning: unused variable 'conn_iter' [-Wunused-variable]
>>       struct drm_connector_list_iter conn_iter;
>>                                      ^~~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_set_config':
>>    drivers/gpu/drm/drm_crtc_helper.c:521:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>>> drivers/gpu/drm/drm_crtc_helper.c:588:3: error: expected ';' before 'save_connector_encoders'
>>       save_connector_encoders[count++] = connector->encoder;
>>       ^~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_crtc_helper.c:589:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
>>      drm_connector_list_iter_put(&conn_iter);
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c:633:53: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                         ^
>>    drivers/gpu/drm/drm_crtc_helper.c:675:53: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                         ^
>>>> drivers/gpu/drm/drm_crtc_helper.c:767:3: error: expected ';' before 'connector'
>>       connector->encoder = save_connector_encoders[count++];
>>       ^~~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c:521:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c:517:49: warning: unused variable 'new_encoder' [-Wunused-variable]
>>      struct drm_encoder **save_connector_encoders, *new_encoder, *encoder;
>>                                                     ^~~~~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c:516:41: warning: unused variable 'new_crtc' [-Wunused-variable]
>>      struct drm_crtc **save_encoder_crtcs, *new_crtc;
>>                                             ^~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_encoder_dpms':
>>    drivers/gpu/drm/drm_crtc_helper.c:795:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    In file included from include/linux/linkage.h:4:0,
>>                     from include/linux/kernel.h:6,
>>                     from drivers/gpu/drm/drm_crtc_helper.c:32:
>>>> include/linux/compiler.h:149:2: error: expected ';' before 'if'
>>      if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
>>      ^
>>    include/linux/compiler.h:147:23: note: in expansion of macro '__trace_if'
>>     #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
>>                           ^~~~~~~~~~
>>>> drivers/gpu/drm/drm_crtc_helper.c:800:3: note: in expansion of macro 'if'
>>       if (connector->encoder == encoder)
>>       ^~
>>    drivers/gpu/drm/drm_crtc_helper.c:795:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_crtc_dpms':
>>    drivers/gpu/drm/drm_crtc_helper.c:836:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    In file included from include/linux/linkage.h:4:0,
>>                     from include/linux/kernel.h:6,
>>                     from drivers/gpu/drm/drm_crtc_helper.c:32:
>>>> include/linux/compiler.h:149:2: error: expected ';' before 'if'
>>      if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
>>      ^
>>    include/linux/compiler.h:147:23: note: in expansion of macro '__trace_if'
>>     #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
>>                           ^~~~~~~~~~
>>    drivers/gpu/drm/drm_crtc_helper.c:841:3: note: in expansion of macro 'if'
>>       if (connector->encoder && connector->encoder->crtc == crtc)
>>       ^~
>>    drivers/gpu/drm/drm_crtc_helper.c:836:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    cc1: some warnings being treated as errors
>> --
>>    drivers/gpu/drm/drm_probe_helper.c: In function 'drm_kms_helper_poll_enable_locked':
>>>> drivers/gpu/drm/drm_probe_helper.c:132:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>>> drivers/gpu/drm/drm_probe_helper.c:140:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>      drm_connector_list_iter_get(dev, &conn_iter);
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_probe_helper.c:141:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_probe_helper.c:141:53: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                         ^
>>    drivers/gpu/drm/drm_probe_helper.c:132:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_probe_helper.c: In function 'output_poll_execute':
>>    drivers/gpu/drm/drm_probe_helper.c:388:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_probe_helper.c:405:53: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                         ^
>>    drivers/gpu/drm/drm_probe_helper.c:389:28: warning: unused variable 'old_status' [-Wunused-variable]
>>      enum drm_connector_status old_status;
>>                                ^~~~~~~~~~
>>    drivers/gpu/drm/drm_probe_helper.c:388:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_probe_helper.c: In function 'drm_helper_hpd_irq_event':
>>    drivers/gpu/drm/drm_probe_helper.c:570:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_probe_helper.c:579:53: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                         ^
>>    drivers/gpu/drm/drm_probe_helper.c:571:28: warning: unused variable 'old_status' [-Wunused-variable]
>>      enum drm_connector_status old_status;
>>                                ^~~~~~~~~~
>>    drivers/gpu/drm/drm_probe_helper.c:570:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    cc1: some warnings being treated as errors
>> --
>>    drivers/gpu/drm/drm_plane_helper.c: In function 'get_connectors_for_crtc':
>>>> drivers/gpu/drm/drm_plane_helper.c:77:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>>> drivers/gpu/drm/drm_plane_helper.c:87:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>      drm_connector_list_iter_get(dev, &conn_iter);
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_plane_helper.c:88:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_plane_helper.c:88:53: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                         ^
>>    drivers/gpu/drm/drm_plane_helper.c:77:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    cc1: some warnings being treated as errors
>> --
>>    drivers/gpu/drm/drm_atomic_helper.c: In function 'handle_conflicting_encoders':
>>>> drivers/gpu/drm/drm_atomic_helper.c:97:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>>> drivers/gpu/drm/drm_atomic_helper.c:148:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>      drm_connector_list_iter_get(state->dev, &conn_iter);
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_atomic_helper.c:149:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_atomic_helper.c:149:53: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                         ^
>>    drivers/gpu/drm/drm_atomic_helper.c:98:22: warning: unused variable 'encoder' [-Wunused-variable]
>>      struct drm_encoder *encoder;
>>                          ^~~~~~~
>>    drivers/gpu/drm/drm_atomic_helper.c:97:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_disable_all':
>>    drivers/gpu/drm/drm_atomic_helper.c:2452:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_atomic_helper.c:2462:48: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(conn, &conn_iter) {
>>                                                    ^
>>>> drivers/gpu/drm/drm_atomic_helper.c:2480:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
>>      drm_connector_list_iter_put(&conn_iter);
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>    drivers/gpu/drm/drm_atomic_helper.c:2479:1: warning: label 'free' defined but not used [-Wunused-label]
>>     free:
>>     ^~~~
>>    drivers/gpu/drm/drm_atomic_helper.c:2452:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_connector_dpms':
>>    drivers/gpu/drm/drm_atomic_helper.c:2853:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_atomic_helper.c:2882:57: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(tmp_connector, &conn_iter) {
>>                                                             ^
>>    drivers/gpu/drm/drm_atomic_helper.c:2853:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_duplicate_state':
>>    drivers/gpu/drm/drm_atomic_helper.c:3269:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    drivers/gpu/drm/drm_atomic_helper.c:3301:48: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(conn, &conn_iter) {
>>                                                    ^
>>    drivers/gpu/drm/drm_atomic_helper.c:3269:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    cc1: some warnings being treated as errors
>> --
>>    drivers/gpu/drm/drm_modeset_helper.c: In function 'drm_helper_move_panel_connectors_to_head':
>>>> drivers/gpu/drm/drm_modeset_helper.c:51:33: error: 'struct drm_mode_config' has no member named 'connector_list_lock'; did you mean 'connector_list'?
>>      spin_lock_irq(&dev->mode_config.connector_list_lock);
>>                                     ^
>>    drivers/gpu/drm/drm_modeset_helper.c:61:35: error: 'struct drm_mode_config' has no member named 'connector_list_lock'; did you mean 'connector_list'?
>>      spin_unlock_irq(&dev->mode_config.connector_list_lock);
>>                                       ^
>> --
>>    drivers/gpu/drm/drm_fb_helper.c: In function 'drm_fb_helper_single_add_all_connectors':
>>>> drivers/gpu/drm/drm_fb_helper.c:123:33: error: storage size of 'conn_iter' isn't known
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>>> drivers/gpu/drm/drm_fb_helper.c:130:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>      drm_connector_list_iter_get(dev, &conn_iter);
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_fb_helper.c:131:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> drivers/gpu/drm/drm_fb_helper.c:131:53: error: expected ';' before '{' token
>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>                                                         ^
>>>> drivers/gpu/drm/drm_fb_helper.c:151:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
>>      drm_connector_list_iter_put(&conn_iter);
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>    drivers/gpu/drm/drm_fb_helper.c:150:1: warning: label 'out' defined but not used [-Wunused-label]
>>     out:
>>     ^~~
>>    drivers/gpu/drm/drm_fb_helper.c:139:1: warning: label 'fail' defined but not used [-Wunused-label]
>>     fail:
>>     ^~~~
>>    drivers/gpu/drm/drm_fb_helper.c:123:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>      struct drm_connector_list_iter conn_iter;
>>                                     ^~~~~~~~~
>>    cc1: some warnings being treated as errors
>>
>> vim +91 drivers/gpu/drm/drm_crtc_helper.c
>>
>>     26   *      Keith Packard
>>     27   *      Eric Anholt <eric@anholt.net>
>>     28   *      Dave Airlie <airlied@linux.ie>
>>     29   *      Jesse Barnes <jesse.barnes@intel.com>
>>     30   */
>>     31
>>   > 32  #include <linux/kernel.h>
>>     33  #include <linux/export.h>
>>     34  #include <linux/moduleparam.h>
>>     35
>>     36  #include <drm/drmP.h>
>>     37  #include <drm/drm_atomic.h>
>>     38  #include <drm/drm_crtc.h>
>>     39  #include <drm/drm_fourcc.h>
>>     40  #include <drm/drm_crtc_helper.h>
>>     41  #include <drm/drm_fb_helper.h>
>>     42  #include <drm/drm_plane_helper.h>
>>     43  #include <drm/drm_atomic_helper.h>
>>     44  #include <drm/drm_edid.h>
>>     45
>>     46  /**
>>     47   * DOC: overview
>>     48   *
>>     49   * The CRTC modeset helper library provides a default set_config implementation
>>     50   * in drm_crtc_helper_set_config(). Plus a few other convenience functions using
>>     51   * the same callbacks which drivers can use to e.g. restore the modeset
>>     52   * configuration on resume with drm_helper_resume_force_mode().
>>     53   *
>>     54   * Note that this helper library doesn't track the current power state of CRTCs
>>     55   * and encoders. It can call callbacks like ->dpms() even though the hardware is
>>     56   * already in the desired state. This deficiency has been fixed in the atomic
>>     57   * helpers.
>>     58   *
>>     59   * The driver callbacks are mostly compatible with the atomic modeset helpers,
>>     60   * except for the handling of the primary plane: Atomic helpers require that the
>>     61   * primary plane is implemented as a real standalone plane and not directly tied
>>     62   * to the CRTC state. For easier transition this library provides functions to
>>     63   * implement the old semantics required by the CRTC helpers using the new plane
>>     64   * and atomic helper callbacks.
>>     65   *
>>     66   * Drivers are strongly urged to convert to the atomic helpers (by way of first
>>     67   * converting to the plane helpers). New drivers must not use these functions
>>     68   * but need to implement the atomic interface instead, potentially using the
>>     69   * atomic helpers for that.
>>     70   *
>>     71   * These legacy modeset helpers use the same function table structures as
>>     72   * all other modesetting helpers. See the documentation for struct
>>     73   * &drm_crtc_helper_funcs, struct &drm_encoder_helper_funcs and struct
>>     74   * &drm_connector_helper_funcs.
>>     75   */
>>     76
>>     77  /**
>>     78   * drm_helper_encoder_in_use - check if a given encoder is in use
>>     79   * @encoder: encoder to check
>>     80   *
>>     81   * Checks whether @encoder is with the current mode setting output configuration
>>     82   * in use by any connector. This doesn't mean that it is actually enabled since
>>     83   * the DPMS state is tracked separately.
>>     84   *
>>     85   * Returns:
>>     86   * True if @encoder is used, false otherwise.
>>     87   */
>>     88  bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
>>     89  {
>>     90          struct drm_connector *connector;
>>   > 91          struct drm_connector_list_iter conn_iter;
>>     92          struct drm_device *dev = encoder->dev;
>>     93
>>     94          /*
>>     95           * We can expect this mutex to be locked if we are not panicking.
>>     96           * Locking is currently fubar in the panic handler.
>>     97           */
>>     98          if (!oops_in_progress) {
>>     99                  WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
>>    100                  WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
>>    101          }
>>    102
>>    103
>>  > 104          drm_connector_list_iter_get(dev, &conn_iter);
>>  > 105          drm_for_each_connector_iter(connector, &conn_iter) {
>>    106                  if (connector->encoder == encoder) {
>>    107                          drm_connector_list_iter_put(&conn_iter);
>>    108                          return true;
>>
>> ---
>> 0-DAY kernel test infrastructure                Open Source Technology Center
>> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>
>
>
>-- 
>Daniel Vetter
>Software Engineer, Intel Corporation
>+41 (0) 79 365 57 48 - http://blog.ffwll.ch
>_______________________________________________
>kbuild-all mailing list
>kbuild-all@lists.01.org
>https://lists.01.org/mailman/listinfo/kbuild-all
On Thu, Dec 15, 2016 at 10:58 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Mostly nothing special (except making sure that really all error paths
> and friends call iter_put).
>
> v2: Don't forget the raw connector_list walking in
> drm_helper_move_panel_connectors_to_head. That one unfortunately can't
> be converted to the iterator helpers, but since it's just some list
> splicing best to just wrap the entire thing up in one critical
> section.
>
> v3: Bail out after iter_put (Harry).
>
> Cc: Harry Wentland <harry.wentland@amd.com>


Reviewed-by: Sean Paul <seanpaul@chromium.org>

> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c  | 39 ++++++++++++++++++++--------
>  drivers/gpu/drm/drm_crtc_helper.c    | 49 ++++++++++++++++++++++++++++--------
>  drivers/gpu/drm/drm_fb_helper.c      | 12 ++++++---
>  drivers/gpu/drm/drm_modeset_helper.c |  2 ++
>  drivers/gpu/drm/drm_plane_helper.c   |  5 +++-
>  drivers/gpu/drm/drm_probe_helper.c   | 18 ++++++++-----
>  6 files changed, 92 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 23767df72615..e2e15a9903a9 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -94,9 +94,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>  {
>         struct drm_connector_state *conn_state;
>         struct drm_connector *connector;
> +       struct drm_connector_list_iter conn_iter;
>         struct drm_encoder *encoder;
>         unsigned encoder_mask = 0;
> -       int i, ret;
> +       int i, ret = 0;
>
>         /*
>          * First loop, find all newly assigned encoders from the connectors
> @@ -144,7 +145,8 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>          * and the crtc is disabled if no encoder is left. This preserves
>          * compatibility with the legacy set_config behavior.
>          */
> -       drm_for_each_connector(connector, state->dev) {
> +       drm_connector_list_iter_get(state->dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter) {
>                 struct drm_crtc_state *crtc_state;
>
>                 if (drm_atomic_get_existing_connector_state(state, connector))
> @@ -160,12 +162,15 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>                                          connector->state->crtc->base.id,
>                                          connector->state->crtc->name,
>                                          connector->base.id, connector->name);
> -                       return -EINVAL;
> +                       ret = -EINVAL;
> +                       goto out;
>                 }
>
>                 conn_state = drm_atomic_get_connector_state(state, connector);
> -               if (IS_ERR(conn_state))
> -                       return PTR_ERR(conn_state);
> +               if (IS_ERR(conn_state)) {
> +                       ret = PTR_ERR(conn_state);
> +                       goto out;
> +               }
>
>                 DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] in use on [CRTC:%d:%s], disabling [CONNECTOR:%d:%s]\n",
>                                  encoder->base.id, encoder->name,
> @@ -176,19 +181,21 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>
>                 ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
>                 if (ret)
> -                       return ret;
> +                       goto out;
>
>                 if (!crtc_state->connector_mask) {
>                         ret = drm_atomic_set_mode_prop_for_crtc(crtc_state,
>                                                                 NULL);
>                         if (ret < 0)
> -                               return ret;
> +                               goto out;
>
>                         crtc_state->active = false;
>                 }
>         }
> +out:
> +       drm_connector_list_iter_put(&conn_iter);
>
> -       return 0;
> +       return ret;
>  }
>
>  static void
> @@ -2442,6 +2449,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>  {
>         struct drm_atomic_state *state;
>         struct drm_connector *conn;
> +       struct drm_connector_list_iter conn_iter;
>         int err;
>
>         state = drm_atomic_state_alloc(dev);
> @@ -2450,7 +2458,8 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>
>         state->acquire_ctx = ctx;
>
> -       drm_for_each_connector(conn, dev) {
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(conn, &conn_iter) {
>                 struct drm_crtc *crtc = conn->state->crtc;
>                 struct drm_crtc_state *crtc_state;
>
> @@ -2468,6 +2477,7 @@ int drm_atomic_helper_disable_all(struct drm_device *dev,
>
>         err = drm_atomic_commit(state);
>  free:
> +       drm_connector_list_iter_put(&conn_iter);
>         drm_atomic_state_put(state);
>         return err;
>  }
> @@ -2840,6 +2850,7 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
>         struct drm_crtc_state *crtc_state;
>         struct drm_crtc *crtc;
>         struct drm_connector *tmp_connector;
> +       struct drm_connector_list_iter conn_iter;
>         int ret;
>         bool active = false;
>         int old_mode = connector->dpms;
> @@ -2867,7 +2878,8 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
>
>         WARN_ON(!drm_modeset_is_locked(&config->connection_mutex));
>
> -       drm_for_each_connector(tmp_connector, connector->dev) {
> +       drm_connector_list_iter_get(connector->dev, &conn_iter);
> +       drm_for_each_connector_iter(tmp_connector, &conn_iter) {
>                 if (tmp_connector->state->crtc != crtc)
>                         continue;
>
> @@ -2876,6 +2888,7 @@ int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
>                         break;
>                 }
>         }
> +       drm_connector_list_iter_put(&conn_iter);
>         crtc_state->active = active;
>
>         ret = drm_atomic_commit(state);
> @@ -3253,6 +3266,7 @@ drm_atomic_helper_duplicate_state(struct drm_device *dev,
>  {
>         struct drm_atomic_state *state;
>         struct drm_connector *conn;
> +       struct drm_connector_list_iter conn_iter;
>         struct drm_plane *plane;
>         struct drm_crtc *crtc;
>         int err = 0;
> @@ -3283,15 +3297,18 @@ drm_atomic_helper_duplicate_state(struct drm_device *dev,
>                 }
>         }
>
> -       drm_for_each_connector(conn, dev) {
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(conn, &conn_iter) {
>                 struct drm_connector_state *conn_state;
>
>                 conn_state = drm_atomic_get_connector_state(state, conn);
>                 if (IS_ERR(conn_state)) {
>                         err = PTR_ERR(conn_state);
> +                       drm_connector_list_iter_put(&conn_iter);
>                         goto free;
>                 }
>         }
> +       drm_connector_list_iter_put(&conn_iter);
>
>         /* clear the acquire context so that it isn't accidentally reused */
>         state->acquire_ctx = NULL;
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index 9d007f5f9732..ad154325a0fd 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -88,6 +88,7 @@
>  bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
>  {
>         struct drm_connector *connector;
> +       struct drm_connector_list_iter conn_iter;
>         struct drm_device *dev = encoder->dev;
>
>         /*
> @@ -99,9 +100,15 @@ bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
>                 WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
>         }
>
> -       drm_for_each_connector(connector, dev)
> -               if (connector->encoder == encoder)
> +
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter) {
> +               if (connector->encoder == encoder) {
> +                       drm_connector_list_iter_put(&conn_iter);
>                         return true;
> +               }
> +       }
> +       drm_connector_list_iter_put(&conn_iter);
>         return false;
>  }
>  EXPORT_SYMBOL(drm_helper_encoder_in_use);
> @@ -436,10 +443,13 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
>
>         /* Decouple all encoders and their attached connectors from this crtc */
>         drm_for_each_encoder(encoder, dev) {
> +               struct drm_connector_list_iter conn_iter;
> +
>                 if (encoder->crtc != crtc)
>                         continue;
>
> -               drm_for_each_connector(connector, dev) {
> +               drm_connector_list_iter_get(dev, &conn_iter);
> +               drm_for_each_connector_iter(connector, &conn_iter) {
>                         if (connector->encoder != encoder)
>                                 continue;
>
> @@ -456,6 +466,7 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
>                         /* we keep a reference while the encoder is bound */
>                         drm_connector_unreference(connector);
>                 }
> +               drm_connector_list_iter_put(&conn_iter);
>         }
>
>         __drm_helper_disable_unused_functions(dev);
> @@ -507,6 +518,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>         bool mode_changed = false; /* if true do a full mode set */
>         bool fb_changed = false; /* if true and !mode_changed just do a flip */
>         struct drm_connector *connector;
> +       struct drm_connector_list_iter conn_iter;
>         int count = 0, ro, fail = 0;
>         const struct drm_crtc_helper_funcs *crtc_funcs;
>         struct drm_mode_set save_set;
> @@ -571,9 +583,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>         }
>
>         count = 0;
> -       drm_for_each_connector(connector, dev) {
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter)
>                 save_connector_encoders[count++] = connector->encoder;
> -       }
> +       drm_connector_list_iter_put(&conn_iter);
>
>         save_set.crtc = set->crtc;
>         save_set.mode = &set->crtc->mode;
> @@ -615,7 +628,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>
>         /* a) traverse passed in connector list and get encoders for them */
>         count = 0;
> -       drm_for_each_connector(connector, dev) {
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter) {
>                 const struct drm_connector_helper_funcs *connector_funcs =
>                         connector->helper_private;
>                 new_encoder = connector->encoder;
> @@ -648,6 +662,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>                         connector->encoder = new_encoder;
>                 }
>         }
> +       drm_connector_list_iter_put(&conn_iter);
>
>         if (fail) {
>                 ret = -EINVAL;
> @@ -655,7 +670,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>         }
>
>         count = 0;
> -       drm_for_each_connector(connector, dev) {
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter) {
>                 if (!connector->encoder)
>                         continue;
>
> @@ -673,6 +689,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>                 if (new_crtc &&
>                     !drm_encoder_crtc_ok(connector->encoder, new_crtc)) {
>                         ret = -EINVAL;
> +                       drm_connector_list_iter_put(&conn_iter);
>                         goto fail;
>                 }
>                 if (new_crtc != connector->encoder->crtc) {
> @@ -689,6 +706,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>                                       connector->base.id, connector->name);
>                 }
>         }
> +       drm_connector_list_iter_put(&conn_iter);
>
>         /* mode_set_base is not a required function */
>         if (fb_changed && !crtc_funcs->mode_set_base)
> @@ -743,9 +761,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
>         }
>
>         count = 0;
> -       drm_for_each_connector(connector, dev) {
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter)
>                 connector->encoder = save_connector_encoders[count++];
> -       }
> +       drm_connector_list_iter_put(&conn_iter);
>
>         /* after fail drop reference on all unbound connectors in set, let
>          * bound connectors keep their reference
> @@ -772,12 +791,16 @@ static int drm_helper_choose_encoder_dpms(struct drm_encoder *encoder)
>  {
>         int dpms = DRM_MODE_DPMS_OFF;
>         struct drm_connector *connector;
> +       struct drm_connector_list_iter conn_iter;
>         struct drm_device *dev = encoder->dev;
>
> -       drm_for_each_connector(connector, dev)
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter)
>                 if (connector->encoder == encoder)
>                         if (connector->dpms < dpms)
>                                 dpms = connector->dpms;
> +       drm_connector_list_iter_put(&conn_iter);
> +
>         return dpms;
>  }
>
> @@ -809,12 +832,16 @@ static int drm_helper_choose_crtc_dpms(struct drm_crtc *crtc)
>  {
>         int dpms = DRM_MODE_DPMS_OFF;
>         struct drm_connector *connector;
> +       struct drm_connector_list_iter conn_iter;
>         struct drm_device *dev = crtc->dev;
>
> -       drm_for_each_connector(connector, dev)
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter)
>                 if (connector->encoder && connector->encoder->crtc == crtc)
>                         if (connector->dpms < dpms)
>                                 dpms = connector->dpms;
> +       drm_connector_list_iter_put(&conn_iter);
> +
>         return dpms;
>  }
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index bee5e4149a1c..145d55fef69e 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -120,20 +120,22 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
>  {
>         struct drm_device *dev = fb_helper->dev;
>         struct drm_connector *connector;
> -       int i, ret;
> +       struct drm_connector_list_iter conn_iter;
> +       int i, ret = 0;
>
>         if (!drm_fbdev_emulation)
>                 return 0;
>
>         mutex_lock(&dev->mode_config.mutex);
> -       drm_for_each_connector(connector, dev) {
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter) {
>                 ret = drm_fb_helper_add_one_connector(fb_helper, connector);
>
>                 if (ret)
>                         goto fail;
>         }
> -       mutex_unlock(&dev->mode_config.mutex);
> -       return 0;
> +       goto out;
> +
>  fail:
>         drm_fb_helper_for_each_connector(fb_helper, i) {
>                 struct drm_fb_helper_connector *fb_helper_connector =
> @@ -145,6 +147,8 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
>                 fb_helper->connector_info[i] = NULL;
>         }
>         fb_helper->connector_count = 0;
> +out:
> +       drm_connector_list_iter_put(&conn_iter);
>         mutex_unlock(&dev->mode_config.mutex);
>
>         return ret;
> diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
> index 5b051859b8d3..5d8fa791fff5 100644
> --- a/drivers/gpu/drm/drm_modeset_helper.c
> +++ b/drivers/gpu/drm/drm_modeset_helper.c
> @@ -48,6 +48,7 @@ void drm_helper_move_panel_connectors_to_head(struct drm_device *dev)
>
>         INIT_LIST_HEAD(&panel_list);
>
> +       spin_lock_irq(&dev->mode_config.connector_list_lock);
>         list_for_each_entry_safe(connector, tmp,
>                                  &dev->mode_config.connector_list, head) {
>                 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS ||
> @@ -57,6 +58,7 @@ void drm_helper_move_panel_connectors_to_head(struct drm_device *dev)
>         }
>
>         list_splice(&panel_list, &dev->mode_config.connector_list);
> +       spin_unlock_irq(&dev->mode_config.connector_list_lock);
>  }
>  EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head);
>
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index 7a7dddf604d7..bc9f97422cd1 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -74,6 +74,7 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
>  {
>         struct drm_device *dev = crtc->dev;
>         struct drm_connector *connector;
> +       struct drm_connector_list_iter conn_iter;
>         int count = 0;
>
>         /*
> @@ -83,7 +84,8 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
>          */
>         WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
>
> -       drm_for_each_connector(connector, dev) {
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter) {
>                 if (connector->encoder && connector->encoder->crtc == crtc) {
>                         if (connector_list != NULL && count < num_connectors)
>                                 *(connector_list++) = connector;
> @@ -91,6 +93,7 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
>                         count++;
>                 }
>         }
> +       drm_connector_list_iter_put(&conn_iter);
>
>         return count;
>  }
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index ac953f037be7..7cff91e7497f 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -129,6 +129,7 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
>  {
>         bool poll = false;
>         struct drm_connector *connector;
> +       struct drm_connector_list_iter conn_iter;
>         unsigned long delay = DRM_OUTPUT_POLL_PERIOD;
>
>         WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
> @@ -136,11 +137,13 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
>         if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll)
>                 return;
>
> -       drm_for_each_connector(connector, dev) {
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter) {
>                 if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT |
>                                          DRM_CONNECTOR_POLL_DISCONNECT))
>                         poll = true;
>         }
> +       drm_connector_list_iter_put(&conn_iter);
>
>         if (dev->mode_config.delayed_event) {
>                 poll = true;
> @@ -382,6 +385,7 @@ static void output_poll_execute(struct work_struct *work)
>         struct delayed_work *delayed_work = to_delayed_work(work);
>         struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work);
>         struct drm_connector *connector;
> +       struct drm_connector_list_iter conn_iter;
>         enum drm_connector_status old_status;
>         bool repoll = false, changed;
>
> @@ -397,8 +401,8 @@ static void output_poll_execute(struct work_struct *work)
>                 goto out;
>         }
>
> -       drm_for_each_connector(connector, dev) {
> -
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter) {
>                 /* Ignore forced connectors. */
>                 if (connector->force)
>                         continue;
> @@ -451,6 +455,7 @@ static void output_poll_execute(struct work_struct *work)
>                         changed = true;
>                 }
>         }
> +       drm_connector_list_iter_put(&conn_iter);
>
>         mutex_unlock(&dev->mode_config.mutex);
>
> @@ -562,6 +567,7 @@ EXPORT_SYMBOL(drm_kms_helper_poll_fini);
>  bool drm_helper_hpd_irq_event(struct drm_device *dev)
>  {
>         struct drm_connector *connector;
> +       struct drm_connector_list_iter conn_iter;
>         enum drm_connector_status old_status;
>         bool changed = false;
>
> @@ -569,8 +575,8 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev)
>                 return false;
>
>         mutex_lock(&dev->mode_config.mutex);
> -       drm_for_each_connector(connector, dev) {
> -
> +       drm_connector_list_iter_get(dev, &conn_iter);
> +       drm_for_each_connector_iter(connector, &conn_iter) {
>                 /* Only handle HPD capable connectors. */
>                 if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
>                         continue;
> @@ -586,7 +592,7 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev)
>                 if (old_status != connector->status)
>                         changed = true;
>         }
> -
> +       drm_connector_list_iter_put(&conn_iter);
>         mutex_unlock(&dev->mode_config.mutex);
>
>         if (changed)
> --
> 2.11.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On 12/16, Fengguang Wu wrote:
>Hi Daniel,
>
>On Fri, Dec 16, 2016 at 08:29:43AM +0100, Daniel Vetter wrote:
>>Hi Kbuild folks
>>
>>So yeah this doesn't apply because it's just 1 patch resent out of a
>>big patch series, in-reply-to the patch it replaces. So applying this
>>alone and telling me (and all the mailing lists) that it doesn't apply
>>isn't all that useful.
>>
>>And it shouldn't be too hard to detect this, since the fdo patchwork
>>instance does catch most of these partial resends successfully and
>>correctly, and will retest the entire patch series.
>
>Good point! CC Xiaolong. This scenario seems happen frequent enough in
>LKML to worth the efforts to add auto detect logic for.

Got it, I'll add auto detect logic to handle it.

Thanks,
Xiaolong

>
>Thanks,
>Fengguang
>
>>On Thu, Dec 15, 2016 at 11:59 PM, kbuild test robot <lkp@intel.com> wrote:
>>>Hi Daniel,
>>>
>>>[auto build test ERROR on drm/drm-next]
>>>[also build test ERROR on next-20161215]
>>>[cannot apply to v4.9]
>>>[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>>
>>>url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-Convert-all-helpers-to-drm_connector_list_iter/20161216-061508
>>>base:   git://people.freedesktop.org/~airlied/linux.git drm-next
>>>config: i386-randconfig-x003-201650 (attached as .config)
>>>compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
>>>reproduce:
>>>        # save the attached .config to linux build tree
>>>        make ARCH=i386
>>>
>>>All error/warnings (new ones prefixed by >>):
>>>
>>>   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_encoder_in_use':
>>>>>drivers/gpu/drm/drm_crtc_helper.c:91:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>>>drivers/gpu/drm/drm_crtc_helper.c:104:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>>     drm_connector_list_iter_get(dev, &conn_iter);
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_crtc_helper.c:105:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_crtc_helper.c:105:53: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                        ^
>>>   drivers/gpu/drm/drm_crtc_helper.c:91:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_disable':
>>>   drivers/gpu/drm/drm_crtc_helper.c:446:34: error: storage size of 'conn_iter' isn't known
>>>      struct drm_connector_list_iter conn_iter;
>>>                                     ^~~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c:452:54: error: expected ';' before '{' token
>>>      drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                         ^
>>>   drivers/gpu/drm/drm_crtc_helper.c:446:34: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>      struct drm_connector_list_iter conn_iter;
>>>                                     ^~~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_crtc_helper_set_config':
>>>   drivers/gpu/drm/drm_crtc_helper.c:521:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>>>drivers/gpu/drm/drm_crtc_helper.c:588:3: error: expected ';' before 'save_connector_encoders'
>>>      save_connector_encoders[count++] = connector->encoder;
>>>      ^~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_crtc_helper.c:589:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
>>>     drm_connector_list_iter_put(&conn_iter);
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c:633:53: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                        ^
>>>   drivers/gpu/drm/drm_crtc_helper.c:675:53: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                        ^
>>>>>drivers/gpu/drm/drm_crtc_helper.c:767:3: error: expected ';' before 'connector'
>>>      connector->encoder = save_connector_encoders[count++];
>>>      ^~~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c:521:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c:517:49: warning: unused variable 'new_encoder' [-Wunused-variable]
>>>     struct drm_encoder **save_connector_encoders, *new_encoder, *encoder;
>>>                                                    ^~~~~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c:516:41: warning: unused variable 'new_crtc' [-Wunused-variable]
>>>     struct drm_crtc **save_encoder_crtcs, *new_crtc;
>>>                                            ^~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_encoder_dpms':
>>>   drivers/gpu/drm/drm_crtc_helper.c:795:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   In file included from include/linux/linkage.h:4:0,
>>>                    from include/linux/kernel.h:6,
>>>                    from drivers/gpu/drm/drm_crtc_helper.c:32:
>>>>>include/linux/compiler.h:149:2: error: expected ';' before 'if'
>>>     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
>>>     ^
>>>   include/linux/compiler.h:147:23: note: in expansion of macro '__trace_if'
>>>    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
>>>                          ^~~~~~~~~~
>>>>>drivers/gpu/drm/drm_crtc_helper.c:800:3: note: in expansion of macro 'if'
>>>      if (connector->encoder == encoder)
>>>      ^~
>>>   drivers/gpu/drm/drm_crtc_helper.c:795:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c: In function 'drm_helper_choose_crtc_dpms':
>>>   drivers/gpu/drm/drm_crtc_helper.c:836:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   In file included from include/linux/linkage.h:4:0,
>>>                    from include/linux/kernel.h:6,
>>>                    from drivers/gpu/drm/drm_crtc_helper.c:32:
>>>>>include/linux/compiler.h:149:2: error: expected ';' before 'if'
>>>     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
>>>     ^
>>>   include/linux/compiler.h:147:23: note: in expansion of macro '__trace_if'
>>>    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
>>>                          ^~~~~~~~~~
>>>   drivers/gpu/drm/drm_crtc_helper.c:841:3: note: in expansion of macro 'if'
>>>      if (connector->encoder && connector->encoder->crtc == crtc)
>>>      ^~
>>>   drivers/gpu/drm/drm_crtc_helper.c:836:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   cc1: some warnings being treated as errors
>>>--
>>>   drivers/gpu/drm/drm_probe_helper.c: In function 'drm_kms_helper_poll_enable_locked':
>>>>>drivers/gpu/drm/drm_probe_helper.c:132:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>>>drivers/gpu/drm/drm_probe_helper.c:140:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>>     drm_connector_list_iter_get(dev, &conn_iter);
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_probe_helper.c:141:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_probe_helper.c:141:53: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                        ^
>>>   drivers/gpu/drm/drm_probe_helper.c:132:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_probe_helper.c: In function 'output_poll_execute':
>>>   drivers/gpu/drm/drm_probe_helper.c:388:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_probe_helper.c:405:53: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                        ^
>>>   drivers/gpu/drm/drm_probe_helper.c:389:28: warning: unused variable 'old_status' [-Wunused-variable]
>>>     enum drm_connector_status old_status;
>>>                               ^~~~~~~~~~
>>>   drivers/gpu/drm/drm_probe_helper.c:388:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_probe_helper.c: In function 'drm_helper_hpd_irq_event':
>>>   drivers/gpu/drm/drm_probe_helper.c:570:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_probe_helper.c:579:53: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                        ^
>>>   drivers/gpu/drm/drm_probe_helper.c:571:28: warning: unused variable 'old_status' [-Wunused-variable]
>>>     enum drm_connector_status old_status;
>>>                               ^~~~~~~~~~
>>>   drivers/gpu/drm/drm_probe_helper.c:570:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   cc1: some warnings being treated as errors
>>>--
>>>   drivers/gpu/drm/drm_plane_helper.c: In function 'get_connectors_for_crtc':
>>>>>drivers/gpu/drm/drm_plane_helper.c:77:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>>>drivers/gpu/drm/drm_plane_helper.c:87:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>>     drm_connector_list_iter_get(dev, &conn_iter);
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_plane_helper.c:88:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_plane_helper.c:88:53: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                        ^
>>>   drivers/gpu/drm/drm_plane_helper.c:77:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   cc1: some warnings being treated as errors
>>>--
>>>   drivers/gpu/drm/drm_atomic_helper.c: In function 'handle_conflicting_encoders':
>>>>>drivers/gpu/drm/drm_atomic_helper.c:97:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>>>drivers/gpu/drm/drm_atomic_helper.c:148:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>>     drm_connector_list_iter_get(state->dev, &conn_iter);
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_atomic_helper.c:149:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_atomic_helper.c:149:53: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                        ^
>>>   drivers/gpu/drm/drm_atomic_helper.c:98:22: warning: unused variable 'encoder' [-Wunused-variable]
>>>     struct drm_encoder *encoder;
>>>                         ^~~~~~~
>>>   drivers/gpu/drm/drm_atomic_helper.c:97:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_disable_all':
>>>   drivers/gpu/drm/drm_atomic_helper.c:2452:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_atomic_helper.c:2462:48: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(conn, &conn_iter) {
>>>                                                   ^
>>>>>drivers/gpu/drm/drm_atomic_helper.c:2480:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
>>>     drm_connector_list_iter_put(&conn_iter);
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>   drivers/gpu/drm/drm_atomic_helper.c:2479:1: warning: label 'free' defined but not used [-Wunused-label]
>>>    free:
>>>    ^~~~
>>>   drivers/gpu/drm/drm_atomic_helper.c:2452:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_connector_dpms':
>>>   drivers/gpu/drm/drm_atomic_helper.c:2853:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_atomic_helper.c:2882:57: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(tmp_connector, &conn_iter) {
>>>                                                            ^
>>>   drivers/gpu/drm/drm_atomic_helper.c:2853:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_atomic_helper.c: In function 'drm_atomic_helper_duplicate_state':
>>>   drivers/gpu/drm/drm_atomic_helper.c:3269:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   drivers/gpu/drm/drm_atomic_helper.c:3301:48: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(conn, &conn_iter) {
>>>                                                   ^
>>>   drivers/gpu/drm/drm_atomic_helper.c:3269:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   cc1: some warnings being treated as errors
>>>--
>>>   drivers/gpu/drm/drm_modeset_helper.c: In function 'drm_helper_move_panel_connectors_to_head':
>>>>>drivers/gpu/drm/drm_modeset_helper.c:51:33: error: 'struct drm_mode_config' has no member named 'connector_list_lock'; did you mean 'connector_list'?
>>>     spin_lock_irq(&dev->mode_config.connector_list_lock);
>>>                                    ^
>>>   drivers/gpu/drm/drm_modeset_helper.c:61:35: error: 'struct drm_mode_config' has no member named 'connector_list_lock'; did you mean 'connector_list'?
>>>     spin_unlock_irq(&dev->mode_config.connector_list_lock);
>>>                                      ^
>>>--
>>>   drivers/gpu/drm/drm_fb_helper.c: In function 'drm_fb_helper_single_add_all_connectors':
>>>>>drivers/gpu/drm/drm_fb_helper.c:123:33: error: storage size of 'conn_iter' isn't known
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>>>drivers/gpu/drm/drm_fb_helper.c:130:2: error: implicit declaration of function 'drm_connector_list_iter_get' [-Werror=implicit-function-declaration]
>>>     drm_connector_list_iter_get(dev, &conn_iter);
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_fb_helper.c:131:2: error: implicit declaration of function 'drm_for_each_connector_iter' [-Werror=implicit-function-declaration]
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>drivers/gpu/drm/drm_fb_helper.c:131:53: error: expected ';' before '{' token
>>>     drm_for_each_connector_iter(connector, &conn_iter) {
>>>                                                        ^
>>>>>drivers/gpu/drm/drm_fb_helper.c:151:2: error: implicit declaration of function 'drm_connector_list_iter_put' [-Werror=implicit-function-declaration]
>>>     drm_connector_list_iter_put(&conn_iter);
>>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>   drivers/gpu/drm/drm_fb_helper.c:150:1: warning: label 'out' defined but not used [-Wunused-label]
>>>    out:
>>>    ^~~
>>>   drivers/gpu/drm/drm_fb_helper.c:139:1: warning: label 'fail' defined but not used [-Wunused-label]
>>>    fail:
>>>    ^~~~
>>>   drivers/gpu/drm/drm_fb_helper.c:123:33: warning: unused variable 'conn_iter' [-Wunused-variable]
>>>     struct drm_connector_list_iter conn_iter;
>>>                                    ^~~~~~~~~
>>>   cc1: some warnings being treated as errors
>>>
>>>vim +91 drivers/gpu/drm/drm_crtc_helper.c
>>>
>>>    26   *      Keith Packard
>>>    27   *      Eric Anholt <eric@anholt.net>
>>>    28   *      Dave Airlie <airlied@linux.ie>
>>>    29   *      Jesse Barnes <jesse.barnes@intel.com>
>>>    30   */
>>>    31
>>>  > 32  #include <linux/kernel.h>
>>>    33  #include <linux/export.h>
>>>    34  #include <linux/moduleparam.h>
>>>    35
>>>    36  #include <drm/drmP.h>
>>>    37  #include <drm/drm_atomic.h>
>>>    38  #include <drm/drm_crtc.h>
>>>    39  #include <drm/drm_fourcc.h>
>>>    40  #include <drm/drm_crtc_helper.h>
>>>    41  #include <drm/drm_fb_helper.h>
>>>    42  #include <drm/drm_plane_helper.h>
>>>    43  #include <drm/drm_atomic_helper.h>
>>>    44  #include <drm/drm_edid.h>
>>>    45
>>>    46  /**
>>>    47   * DOC: overview
>>>    48   *
>>>    49   * The CRTC modeset helper library provides a default set_config implementation
>>>    50   * in drm_crtc_helper_set_config(). Plus a few other convenience functions using
>>>    51   * the same callbacks which drivers can use to e.g. restore the modeset
>>>    52   * configuration on resume with drm_helper_resume_force_mode().
>>>    53   *
>>>    54   * Note that this helper library doesn't track the current power state of CRTCs
>>>    55   * and encoders. It can call callbacks like ->dpms() even though the hardware is
>>>    56   * already in the desired state. This deficiency has been fixed in the atomic
>>>    57   * helpers.
>>>    58   *
>>>    59   * The driver callbacks are mostly compatible with the atomic modeset helpers,
>>>    60   * except for the handling of the primary plane: Atomic helpers require that the
>>>    61   * primary plane is implemented as a real standalone plane and not directly tied
>>>    62   * to the CRTC state. For easier transition this library provides functions to
>>>    63   * implement the old semantics required by the CRTC helpers using the new plane
>>>    64   * and atomic helper callbacks.
>>>    65   *
>>>    66   * Drivers are strongly urged to convert to the atomic helpers (by way of first
>>>    67   * converting to the plane helpers). New drivers must not use these functions
>>>    68   * but need to implement the atomic interface instead, potentially using the
>>>    69   * atomic helpers for that.
>>>    70   *
>>>    71   * These legacy modeset helpers use the same function table structures as
>>>    72   * all other modesetting helpers. See the documentation for struct
>>>    73   * &drm_crtc_helper_funcs, struct &drm_encoder_helper_funcs and struct
>>>    74   * &drm_connector_helper_funcs.
>>>    75   */
>>>    76
>>>    77  /**
>>>    78   * drm_helper_encoder_in_use - check if a given encoder is in use
>>>    79   * @encoder: encoder to check
>>>    80   *
>>>    81   * Checks whether @encoder is with the current mode setting output configuration
>>>    82   * in use by any connector. This doesn't mean that it is actually enabled since
>>>    83   * the DPMS state is tracked separately.
>>>    84   *
>>>    85   * Returns:
>>>    86   * True if @encoder is used, false otherwise.
>>>    87   */
>>>    88  bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
>>>    89  {
>>>    90          struct drm_connector *connector;
>>>  > 91          struct drm_connector_list_iter conn_iter;
>>>    92          struct drm_device *dev = encoder->dev;
>>>    93
>>>    94          /*
>>>    95           * We can expect this mutex to be locked if we are not panicking.
>>>    96           * Locking is currently fubar in the panic handler.
>>>    97           */
>>>    98          if (!oops_in_progress) {
>>>    99                  WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
>>>   100                  WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
>>>   101          }
>>>   102
>>>   103
>>> > 104          drm_connector_list_iter_get(dev, &conn_iter);
>>> > 105          drm_for_each_connector_iter(connector, &conn_iter) {
>>>   106                  if (connector->encoder == encoder) {
>>>   107                          drm_connector_list_iter_put(&conn_iter);
>>>   108                          return true;
>>>
>>>---
>>>0-DAY kernel test infrastructure                Open Source Technology Center
>>>https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>>
>>
>>
>>-- 
>>Daniel Vetter
>>Software Engineer, Intel Corporation
>>+41 (0) 79 365 57 48 - http://blog.ffwll.ch
>>_______________________________________________
>>kbuild-all mailing list
>>kbuild-all@lists.01.org
>>https://lists.01.org/mailman/listinfo/kbuild-all