[Intel-gfx] [PATCH 05/11] drm: Check locking in drm_for_each_encoder/connector
Daniel Vetter
daniel.vetter at ffwll.ch
Tue Jun 23 13:45:56 PDT 2015
Because of DP MST encoders/connectors can now be hotplugged and we
must hold the right lock when walking the encoder/connector lists.
Enforce this by checking the locking in our shiny new list walking
macros.
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
include/drm/drm_crtc.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5994750f523a..a912ba06cf45 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1588,10 +1588,18 @@ static inline struct drm_property *drm_property_find(struct drm_device *dev,
list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
#define drm_for_each_connector(connector, dev) \
- list_for_each_entry(connector, &(dev)->mode_config.connector_list, head)
+ for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.mutex)), \
+ connector = list_first_entry(&(dev)->mode_config.connector_list, \
+ struct drm_connector, head); \
+ &connector->head != (&(dev)->mode_config.connector_list); \
+ connector = list_next_entry(connector, head))
#define drm_for_each_encoder(encoder, dev) \
- list_for_each_entry(encoder, &(dev)->mode_config.encoder_list, head)
+ for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.mutex)), \
+ encoder = list_first_entry(&(dev)->mode_config.encoder_list, \
+ struct drm_encoder, head); \
+ &encoder->head != (&(dev)->mode_config.encoder_list); \
+ encoder = list_next_entry(encoder, head))
#define drm_for_each_fb(fb, dev) \
list_for_each_entry(fb, &(dev)->mode_config.fb_list, head)
--
2.1.4
More information about the Intel-gfx
mailing list