From: Dave Airlie Date: Mon, 20 Feb 2012 14:16:40 +0000 (+0000) Subject: drm/modeset: add helper to unplug all connectors from sysfs X-Git-Tag: v3.4-rc1~141^2~42 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=cbc7e22151d99ed1dd7649d268ad3d81b9e6255a;p=sfrench%2Fcifs-2.6.git 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 --- diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d2d9dc52ac89..79902835d057 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -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; diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 9595c2c9adc7..3401761d6391 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -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,