瀏覽代碼

drm/modeset: add helper to unplug all connectors from sysfs

In order to get correct ordering at hot-unplug for userspace,
we need to tear down all the sysfs bits at the correct time.

This adds a helper to allow drivers to remove the sysfs nodes
for all connectors.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie 13 年之前
父節點
當前提交
cbc7e22151
共有 2 個文件被更改,包括 16 次插入3 次删除
  1. 14 3
      drivers/gpu/drm/drm_crtc.c
  2. 2 0
      include/drm/drm_crtc.h

+ 14 - 3
drivers/gpu/drm/drm_crtc.c

@@ -540,10 +540,21 @@ void drm_connector_cleanup(struct drm_connector *connector)
 }
 }
 EXPORT_SYMBOL(drm_connector_cleanup);
 EXPORT_SYMBOL(drm_connector_cleanup);
 
 
+void drm_connector_unplug_all(struct drm_device *dev)
+{
+	struct drm_connector *connector;
+
+	/* taking the mode config mutex ends up in a clash with sysfs */
+	list_for_each_entry(connector, &dev->mode_config.connector_list, head)
+		drm_sysfs_connector_remove(connector);
+
+}
+EXPORT_SYMBOL(drm_connector_unplug_all);
+
 int drm_encoder_init(struct drm_device *dev,
 int drm_encoder_init(struct drm_device *dev,
-		     struct drm_encoder *encoder,
-		     const struct drm_encoder_funcs *funcs,
-		     int encoder_type)
+		      struct drm_encoder *encoder,
+		      const struct drm_encoder_funcs *funcs,
+		      int encoder_type)
 {
 {
 	int ret;
 	int ret;
 
 

+ 2 - 0
include/drm/drm_crtc.h

@@ -826,6 +826,8 @@ extern int drm_connector_init(struct drm_device *dev,
 			      int connector_type);
 			      int connector_type);
 
 
 extern void drm_connector_cleanup(struct drm_connector *connector);
 extern void drm_connector_cleanup(struct drm_connector *connector);
+/* helper to unplug all connectors from sysfs for device */
+extern void drm_connector_unplug_all(struct drm_device *dev);
 
 
 extern int drm_encoder_init(struct drm_device *dev,
 extern int drm_encoder_init(struct drm_device *dev,
 			    struct drm_encoder *encoder,
 			    struct drm_encoder *encoder,