Commit 6833fb1e authored by Lyude Paul's avatar Lyude Paul Committed by Ben Skeggs

drm/nouveau/drm/nouveau: Use pm_runtime_get_noresume() in connector_detect()

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: default avatarLyude Paul <lyude@redhat.com>
Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
Acked-by: default avatarDaniel Vetter <daniel@ffwll.ch>
Cc: stable@vger.kernel.org
Cc: Lukas Wunner <lukas@wunner.de>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 7fec8f53
...@@ -555,12 +555,16 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) ...@@ -555,12 +555,16 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
nv_connector->edid = NULL; nv_connector->edid = NULL;
} }
/* Outputs are only polled while runtime active, so acquiring a /* Outputs are only polled while runtime active, so resuming the
* runtime PM ref here is unnecessary (and would deadlock upon * device here is unnecessary (and would deadlock upon runtime suspend
* runtime suspend because it waits for polling to finish). * because it waits for polling to finish). We do however, want to
* prevent the autosuspend timer from elapsing during this operation
* if possible.
*/ */
if (!drm_kms_helper_is_poll_worker()) { if (drm_kms_helper_is_poll_worker()) {
ret = pm_runtime_get_sync(connector->dev->dev); pm_runtime_get_noresume(dev->dev);
} else {
ret = pm_runtime_get_sync(dev->dev);
if (ret < 0 && ret != -EACCES) if (ret < 0 && ret != -EACCES)
return conn_status; return conn_status;
} }
...@@ -638,10 +642,8 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) ...@@ -638,10 +642,8 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
out: out:
if (!drm_kms_helper_is_poll_worker()) { pm_runtime_mark_last_busy(dev->dev);
pm_runtime_mark_last_busy(connector->dev->dev); pm_runtime_put_autosuspend(dev->dev);
pm_runtime_put_autosuspend(connector->dev->dev);
}
return conn_status; return conn_status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment