disp: msm: use pm_runtime_resume_and_get instead of pm_runtime_get_sync

pm_runtime_get_sync increases the usage_count refcount immaterial of
success/failure of the call, leading to invalid refcount on failures.
Use pm_runtime_resume_and_get instead, which takes care of reducing the
refcount on failure cases before returning from the function.

Change-Id: Ib96050d5d7ecbd717e58b8a0dde2d03312444e15
Signed-off-by: Veera Sundaram Sankaran <quic_veeras@quicinc.com>
Этот коммит содержится в:
Veera Sundaram Sankaran
2021-12-14 11:26:15 -08:00
родитель e7c09f0092
Коммит 56862f8118
11 изменённых файлов: 75 добавлений и 46 удалений

Просмотреть файл

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
@@ -4226,9 +4226,12 @@ static int _sde_crtc_vblank_enable(
if (enable) {
int ret;
ret = pm_runtime_get_sync(crtc->dev->dev);
if (ret < 0)
ret = pm_runtime_resume_and_get(crtc->dev->dev);
if (ret < 0) {
SDE_ERROR("failed to enable power resource %d\n", ret);
SDE_EVT32(ret, SDE_EVTLOG_ERROR);
return ret;
}
mutex_lock(&sde_crtc->crtc_lock);
drm_for_each_encoder_mask(enc, crtc->dev, sde_crtc->cached_encoder_mask) {
@@ -6627,9 +6630,11 @@ static ssize_t _sde_crtc_misr_read(struct file *file,
if (!sde_kms)
return -EINVAL;
rc = pm_runtime_get_sync(crtc->dev->dev);
if (rc < 0)
rc = pm_runtime_resume_and_get(crtc->dev->dev);
if (rc < 0) {
SDE_ERROR("failed to enable power resource %d\n", rc);
return rc;
}
sde_vm_lock(sde_kms);
if (!sde_vm_owns_hw(sde_kms)) {
@@ -7441,8 +7446,9 @@ static int _sde_crtc_event_enable(struct sde_kms *kms,
ret = 0;
if (crtc_drm->enabled) {
ret = pm_runtime_get_sync(crtc_drm->dev->dev);
ret = pm_runtime_resume_and_get(crtc_drm->dev->dev);
if (ret < 0) {
SDE_ERROR("failed to enable power resource %d\n", ret);
SDE_EVT32(ret, SDE_EVTLOG_ERROR);
kfree(node);
return ret;
@@ -7509,7 +7515,7 @@ static int _sde_crtc_event_disable(struct sde_kms *kms,
kfree(node);
return 0;
}
ret = pm_runtime_get_sync(crtc_drm->dev->dev);
ret = pm_runtime_resume_and_get(crtc_drm->dev->dev);
if (ret < 0) {
SDE_ERROR("failed to enable power resource %d\n", ret);
SDE_EVT32(ret, SDE_EVTLOG_ERROR);