drm/modeset: add helper to unplug all connectors from sysfs
authorDave Airlie <airlied@redhat.com>
Mon, 20 Feb 2012 14:16:40 +0000 (14:16 +0000)
committerDave Airlie <airlied@redhat.com>
Thu, 15 Mar 2012 13:35:32 +0000 (13:35 +0000)
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>
drivers/gpu/drm/drm_crtc.c
include/drm/drm_crtc.h

index d2d9dc52ac892464d19317d4d1aa1cf6bba2595b..79902835d05738fcc8a608608b499b401afab029 100644 (file)
@@ -540,10 +540,21 @@ void drm_connector_cleanup(struct drm_connector *connector)
 }
 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,
-                    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;
 
index 9595c2c9adc77c3fb30b51611508294d53c1f6dd..3401761d6391cbc4f3cc4a6df28b2e8b31cb7c73 100644 (file)
@@ -826,6 +826,8 @@ extern int drm_connector_init(struct drm_device *dev,
                              int connector_type);
 
 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,
                            struct drm_encoder *encoder,