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

Commit 7b4f3990 authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915: Avoid circular locking from intel_fbdev_fini()



lockdep spots that the fb_info->lock takes the dev->struct_mutex during
init (due to the device probing) and so we can not hold
dev->struct_mutex when unregistering the framebuffer. Simply reverse the
order of initialisation during cleanup and so do the intel_fbdev_fini()
before the intel_modeset_cleanup.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 2c6be944
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -2106,6 +2106,7 @@ int i915_driver_unload(struct drm_device *dev)
	acpi_video_unregister();
	acpi_video_unregister();


	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
		intel_fbdev_fini(dev);
		intel_modeset_cleanup(dev);
		intel_modeset_cleanup(dev);


		/*
		/*
+0 −2
Original line number Original line Diff line number Diff line
@@ -6130,8 +6130,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
	drm_kms_helper_poll_fini(dev);
	drm_kms_helper_poll_fini(dev);
	mutex_lock(&dev->struct_mutex);
	mutex_lock(&dev->struct_mutex);


	intel_fbdev_fini(dev);

	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
		/* Skip inactive CRTCs */
		/* Skip inactive CRTCs */
		if (!crtc->fb)
		if (!crtc->fb)
+3 −5
Original line number Original line Diff line number Diff line
@@ -206,7 +206,7 @@ static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
	.fb_probe = intel_fb_find_or_create_single,
	.fb_probe = intel_fb_find_or_create_single,
};
};


static int intel_fbdev_destroy(struct drm_device *dev,
static void intel_fbdev_destroy(struct drm_device *dev,
				struct intel_fbdev *ifbdev)
				struct intel_fbdev *ifbdev)
{
{
	struct fb_info *info;
	struct fb_info *info;
@@ -225,9 +225,7 @@ static int intel_fbdev_destroy(struct drm_device *dev,


	drm_framebuffer_cleanup(&ifb->base);
	drm_framebuffer_cleanup(&ifb->base);
	if (ifb->obj)
	if (ifb->obj)
		drm_gem_object_unreference(ifb->obj);
		drm_gem_object_unreference_unlocked(ifb->obj);

	return 0;
}
}


int intel_fbdev_init(struct drm_device *dev)
int intel_fbdev_init(struct drm_device *dev)