diff options
author | Dave Airlie <airlied@redhat.com> | 2012-02-20 09:15:02 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-03-15 09:35:31 -0400 |
commit | 1828fe6c5f593b835197edd30a28d80635238ab3 (patch) | |
tree | 00f500f5553350622467c3778a69e7ae8143ed28 /drivers/gpu/drm/drm_sysfs.c | |
parent | ce880cb860f36694d2cdebfac9e6ae18176fe4c4 (diff) |
drm/sysfs: protect sysfs removal code against being run twice.
a step towards correct hot unplug for USB devices, we need to
remove the userspace facing bits at the unplug time for correct
udev operation.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_sysfs.c')
-rw-r--r-- | drivers/gpu/drm/drm_sysfs.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 62c3675045ac..5a7bd51fc3d8 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -454,6 +454,8 @@ void drm_sysfs_connector_remove(struct drm_connector *connector) | |||
454 | { | 454 | { |
455 | int i; | 455 | int i; |
456 | 456 | ||
457 | if (!connector->kdev.parent) | ||
458 | return; | ||
457 | DRM_DEBUG("removing \"%s\" from sysfs\n", | 459 | DRM_DEBUG("removing \"%s\" from sysfs\n", |
458 | drm_get_connector_name(connector)); | 460 | drm_get_connector_name(connector)); |
459 | 461 | ||
@@ -461,6 +463,7 @@ void drm_sysfs_connector_remove(struct drm_connector *connector) | |||
461 | device_remove_file(&connector->kdev, &connector_attrs[i]); | 463 | device_remove_file(&connector->kdev, &connector_attrs[i]); |
462 | sysfs_remove_bin_file(&connector->kdev.kobj, &edid_attr); | 464 | sysfs_remove_bin_file(&connector->kdev.kobj, &edid_attr); |
463 | device_unregister(&connector->kdev); | 465 | device_unregister(&connector->kdev); |
466 | connector->kdev.parent = NULL; | ||
464 | } | 467 | } |
465 | EXPORT_SYMBOL(drm_sysfs_connector_remove); | 468 | EXPORT_SYMBOL(drm_sysfs_connector_remove); |
466 | 469 | ||
@@ -533,7 +536,9 @@ err_out: | |||
533 | */ | 536 | */ |
534 | void drm_sysfs_device_remove(struct drm_minor *minor) | 537 | void drm_sysfs_device_remove(struct drm_minor *minor) |
535 | { | 538 | { |
536 | device_unregister(&minor->kdev); | 539 | if (minor->kdev.parent) |
540 | device_unregister(&minor->kdev); | ||
541 | minor->kdev.parent = NULL; | ||
537 | } | 542 | } |
538 | 543 | ||
539 | 544 | ||