| From 0ebe1426e8b3e8378ba4400a49c84c8f8c32363e Mon Sep 17 00:00:00 2001 |
| From: Krishna Manikandan <mkrishn@codeaurora.org> |
| Date: Thu, 28 May 2020 14:04:28 +0530 |
| Subject: [PATCH] drm/msm/dpu: allow initialization of encoder locks during |
| encoder init |
| |
| commit 2e7ec6b5297157efabb50e5f82adc628cf90296c upstream. |
| |
| In the current implementation, mutex initialization |
| for encoder mutex locks are done during encoder |
| setup. This can lead to scenarios where the lock |
| is used before it is initialized. Move mutex_init |
| to dpu_encoder_init to avoid this. |
| |
| Signed-off-by: Krishna Manikandan <mkrishn@codeaurora.org> |
| Signed-off-by: Rob Clark <robdclark@chromium.org> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |
| index e26d2f3363ee..8fcfee5e6e85 100644 |
| --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |
| +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |
| @@ -2221,7 +2221,6 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, |
| |
| dpu_enc = to_dpu_encoder_virt(enc); |
| |
| - mutex_init(&dpu_enc->enc_lock); |
| ret = dpu_encoder_setup_display(dpu_enc, dpu_kms, disp_info); |
| if (ret) |
| goto fail; |
| @@ -2236,7 +2235,6 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, |
| 0); |
| |
| |
| - mutex_init(&dpu_enc->rc_lock); |
| INIT_DELAYED_WORK(&dpu_enc->delayed_off_work, |
| dpu_encoder_off_work); |
| dpu_enc->idle_timeout = IDLE_TIMEOUT; |
| @@ -2281,6 +2279,8 @@ struct drm_encoder *dpu_encoder_init(struct drm_device *dev, |
| |
| spin_lock_init(&dpu_enc->enc_spinlock); |
| dpu_enc->enabled = false; |
| + mutex_init(&dpu_enc->enc_lock); |
| + mutex_init(&dpu_enc->rc_lock); |
| |
| return &dpu_enc->base; |
| } |
| -- |
| 2.27.0 |
| |