Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1828fe6c authored by Dave Airlie's avatar Dave Airlie
Browse files

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: default avatarDave Airlie <airlied@redhat.com>
parent ce880cb8
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -454,6 +454,8 @@ void drm_sysfs_connector_remove(struct drm_connector *connector)
{
{
	int i;
	int i;


	if (!connector->kdev.parent)
		return;
	DRM_DEBUG("removing \"%s\" from sysfs\n",
	DRM_DEBUG("removing \"%s\" from sysfs\n",
		  drm_get_connector_name(connector));
		  drm_get_connector_name(connector));


@@ -461,6 +463,7 @@ void drm_sysfs_connector_remove(struct drm_connector *connector)
		device_remove_file(&connector->kdev, &connector_attrs[i]);
		device_remove_file(&connector->kdev, &connector_attrs[i]);
	sysfs_remove_bin_file(&connector->kdev.kobj, &edid_attr);
	sysfs_remove_bin_file(&connector->kdev.kobj, &edid_attr);
	device_unregister(&connector->kdev);
	device_unregister(&connector->kdev);
	connector->kdev.parent = NULL;
}
}
EXPORT_SYMBOL(drm_sysfs_connector_remove);
EXPORT_SYMBOL(drm_sysfs_connector_remove);


@@ -533,7 +536,9 @@ int drm_sysfs_device_add(struct drm_minor *minor)
 */
 */
void drm_sysfs_device_remove(struct drm_minor *minor)
void drm_sysfs_device_remove(struct drm_minor *minor)
{
{
	if (minor->kdev.parent)
		device_unregister(&minor->kdev);
		device_unregister(&minor->kdev);
	minor->kdev.parent = NULL;
}
}