Skip to contentSkip to conversation

drm/nouveau: Don't forget to cancel hpd_work on suspend/unload

PATCH New Lyude Paul 1 participant 1 message Aug 7, 2018

Subsystems (4)
lore
Share & tools
lore

Lyude Paul

author maintainer
#0 lore raw

PATCH 1/1 drm/nouveau: Don't forget to cancel hpd_work on suspend/unload

Currently, there's nothing in nouveau that actually cancels this work struct. So, cancel it on suspend/unload. Otherwise, if we're unlucky enough hpd_work might try to keep running up until the system is suspended.

---
 drivers/gpu/drm/nouveau/nouveau_display.c | 9 ++++++---
 drivers/gpu/drm/nouveau/nouveau_display.h | 2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c     | 2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nouveau_display.c +6 -3
index ec7861457b84..1ba3f152cfcb 100644
@@ -425,7 +425,7 @@ nouveau_display_init(struct drm_device *dev)
 }
 
 void
-nouveau_display_fini(struct drm_device *dev, bool suspend)
+nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime)
 {
 	struct nouveau_display *disp = nouveau_display(dev);
 	struct nouveau_drm *drm = nouveau_drm(dev);
@@ -450,6 +450,9 @@ nouveau_display_fini(struct drm_device *dev, bool suspend)
 	}
 	drm_connector_list_iter_end(&conn_iter);
 
+	if (!runtime)
+		cancel_work_sync(&drm->hpd_work);
+
 	drm_kms_helper_poll_disable(dev);
 	disp->fini(dev);
 }
@@ -618,11 +621,11 @@ nouveau_display_suspend(struct drm_device *dev, bool runtime)
 			}
 		}
 
-		nouveau_display_fini(dev, true);
+		nouveau_display_fini(dev, true, runtime);
 		return 0;
 	}
 
-	nouveau_display_fini(dev, true);
+	nouveau_display_fini(dev, true, runtime);
 
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
 		struct nouveau_framebuffer *nouveau_fb;
drivers/gpu/drm/nouveau/nouveau_display.h +1 -1
index 54aa7c3fa42d..ff92b54ce448 100644
@@ -62,7 +62,7 @@ nouveau_display(struct drm_device *dev)
 int  nouveau_display_create(struct drm_device *dev);
 void nouveau_display_destroy(struct drm_device *dev);
 int  nouveau_display_init(struct drm_device *dev);
-void nouveau_display_fini(struct drm_device *dev, bool suspend);
+void nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime);
 int  nouveau_display_suspend(struct drm_device *dev, bool runtime);
 void nouveau_display_resume(struct drm_device *dev, bool runtime);
 int  nouveau_display_vblank_enable(struct drm_device *, unsigned int);
drivers/gpu/drm/nouveau/nouveau_drm.c +1 -1
index f5d3158f0378..20d4ab647cf7 100644
@@ -629,7 +629,7 @@ nouveau_drm_unload(struct drm_device *dev)
 	nouveau_debugfs_fini(drm);
 
 	if (dev->mode_config.num_crtc)
-		nouveau_display_fini(dev, false);
+		nouveau_display_fini(dev, false, false);
 	nouveau_display_destroy(dev);
 
 	nouveau_bios_takedown(dev);
Signature · 6 lines
2.17.1

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau