mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 23:59:33 -04:00
drm/rockchip: dw_hdmi_qp: Switch to drmm_encoder_init()
Simplify encoder initialization and cleanup by making use of drmm_encoder_init(), which takes care of registering drm_encoder_cleanup() with drmm_add_action(). Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20260310-drm-rk-fixes-v2-6-645ecfb43f49@collabora.com
This commit is contained in:
committed by
Heiko Stuebner
parent
31a98842a1
commit
e1f7b7cbd7
@@ -21,6 +21,7 @@
|
||||
#include <drm/bridge/dw_hdmi_qp.h>
|
||||
#include <drm/display/drm_hdmi_helper.h>
|
||||
#include <drm/drm_bridge_connector.h>
|
||||
#include <drm/drm_managed.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
#include <drm/drm_simple_kms_helper.h>
|
||||
@@ -477,7 +478,7 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
|
||||
if (!pdev->dev.of_node)
|
||||
return -ENODEV;
|
||||
|
||||
hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
|
||||
hdmi = drmm_kzalloc(drm, sizeof(*hdmi), GFP_KERNEL);
|
||||
if (!hdmi)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -586,16 +587,16 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
|
||||
return ret;
|
||||
|
||||
drm_encoder_helper_add(encoder, &dw_hdmi_qp_rockchip_encoder_helper_funcs);
|
||||
drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
|
||||
ret = drmm_encoder_init(drm, encoder, NULL, DRM_MODE_ENCODER_TMDS, NULL);
|
||||
if (ret)
|
||||
return dev_err_probe(hdmi->dev, ret, "Failed to init encoder");
|
||||
|
||||
platform_set_drvdata(pdev, hdmi);
|
||||
|
||||
hdmi->hdmi = dw_hdmi_qp_bind(pdev, encoder, &plat_data);
|
||||
if (IS_ERR(hdmi->hdmi)) {
|
||||
drm_encoder_cleanup(encoder);
|
||||
if (IS_ERR(hdmi->hdmi))
|
||||
return dev_err_probe(hdmi->dev, PTR_ERR(hdmi->hdmi),
|
||||
"Failed to bind dw-hdmi-qp");
|
||||
}
|
||||
|
||||
connector = drm_bridge_connector_init(drm, encoder);
|
||||
if (IS_ERR(connector))
|
||||
@@ -612,8 +613,6 @@ static void dw_hdmi_qp_rockchip_unbind(struct device *dev,
|
||||
struct rockchip_hdmi_qp *hdmi = dev_get_drvdata(dev);
|
||||
|
||||
cancel_delayed_work_sync(&hdmi->hpd_work);
|
||||
|
||||
drm_encoder_cleanup(&hdmi->encoder.encoder);
|
||||
}
|
||||
|
||||
static const struct component_ops dw_hdmi_qp_rockchip_ops = {
|
||||
|
||||
Reference in New Issue
Block a user