Skip to content

Commit

Permalink
drm/nouveau/drm/nouveau: Don't forget to cancel hpd_work on suspend/u…
Browse files Browse the repository at this point in the history
…nload

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.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Lyude Paul authored and Ben Skeggs committed Sep 6, 2018
1 parent 79e765a commit 2f7ca78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions drivers/gpu/drm/nouveau/nouveau_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,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);
Expand All @@ -467,6 +467,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);
}
Expand Down Expand Up @@ -635,11 +638,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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/nouveau/nouveau_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/nouveau/nouveau_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,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);
Expand Down

0 comments on commit 2f7ca78

Please sign in to comment.