Skip to content

Commit 0f966da

Browse files
Lyudegregkh
authored andcommitted
drm/nouveau/drm/nouveau: Use pm_runtime_get_noresume() in connector_detect()
commit 6833fb1 upstream. It's true we can't resume the device from poll workers in nouveau_connector_detect(). We can however, prevent the autosuspend timer from elapsing immediately if it hasn't already without risking any sort of deadlock with the runtime suspend/resume operations. So do that instead of entirely avoiding grabbing a power reference. Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Acked-by: Daniel Vetter <daniel@ffwll.ch> Cc: stable@vger.kernel.org Cc: Lukas Wunner <lukas@wunner.de> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 409af02 commit 0f966da

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

drivers/gpu/drm/nouveau/nouveau_connector.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -570,12 +570,16 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
570570
nv_connector->edid = NULL;
571571
}
572572

573-
/* Outputs are only polled while runtime active, so acquiring a
574-
* runtime PM ref here is unnecessary (and would deadlock upon
575-
* runtime suspend because it waits for polling to finish).
573+
/* Outputs are only polled while runtime active, so resuming the
574+
* device here is unnecessary (and would deadlock upon runtime suspend
575+
* because it waits for polling to finish). We do however, want to
576+
* prevent the autosuspend timer from elapsing during this operation
577+
* if possible.
576578
*/
577-
if (!drm_kms_helper_is_poll_worker()) {
578-
ret = pm_runtime_get_sync(connector->dev->dev);
579+
if (drm_kms_helper_is_poll_worker()) {
580+
pm_runtime_get_noresume(dev->dev);
581+
} else {
582+
ret = pm_runtime_get_sync(dev->dev);
579583
if (ret < 0 && ret != -EACCES)
580584
return conn_status;
581585
}
@@ -653,10 +657,8 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
653657

654658
out:
655659

656-
if (!drm_kms_helper_is_poll_worker()) {
657-
pm_runtime_mark_last_busy(connector->dev->dev);
658-
pm_runtime_put_autosuspend(connector->dev->dev);
659-
}
660+
pm_runtime_mark_last_busy(dev->dev);
661+
pm_runtime_put_autosuspend(dev->dev);
660662

661663
return conn_status;
662664
}

0 commit comments

Comments
 (0)