Add encoder interface to release dpu encoder on mode_init failures in kms. Signed-off-by: Jeykumar Sankaran <jsanka@xxxxxxxxxxxxxx> --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 ++++++++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index dd7ab85..b253165 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -422,6 +422,15 @@ void dpu_encoder_get_hw_resources(struct drm_encoder *drm_enc, } } +void dpu_encoder_uninit(struct drm_encoder *drm_enc) +{ + struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); + + drm_encoder_cleanup(drm_enc); + + kfree(dpu_enc); +} + static void dpu_encoder_destroy(struct drm_encoder *drm_enc) { struct dpu_encoder_virt *dpu_enc = NULL; @@ -453,10 +462,9 @@ static void dpu_encoder_destroy(struct drm_encoder *drm_enc) dpu_enc->num_phys_encs = 0; mutex_unlock(&dpu_enc->enc_lock); - drm_encoder_cleanup(drm_enc); mutex_destroy(&dpu_enc->enc_lock); - kfree(dpu_enc); + dpu_encoder_uninit(drm_enc); } void dpu_encoder_helper_split_config( diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h index 9dbf38f..60b88bd 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h @@ -142,6 +142,12 @@ struct drm_encoder *dpu_encoder_init( int drm_enc_mode); /** + * dpu_encoder_uninit - uninitialize virtual encoder object + * @drm_enc: Pointer to drm encoder + */ +void dpu_encoder_uninit(struct drm_encoder *drm_enc); + +/** * dpu_encoder_setup - setup dpu_encoder for the display probed * @dev: Pointer to drm device structure * @enc: Pointer to the drm_encoder -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project