drm/mediatek: mtk_dsi: Open-code drm_simple_encoder_init()
Subsystems (3)
PATCH 1/1 drm/mediatek: mtk_dsi: Open-code drm_simple_encoder_init()
The drm_simple_encoder_init() helper is deprecated because it adds an intermediate abstraction layer that only wraps drm_encoder_init() with an empty or minimal drm_encoder_funcs struct.
Replace drm_simple_encoder_init() with explicit calls to drm_encoder_init() and define driver-specific drm_encoder_funcs carrying the cleanup callback.
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +7 -2
@@ -226,6 +226,10 @@ struct mtk_dsi {const struct mtk_dsi_driver_data *driver_data; }; +static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = { + .destroy = drm_encoder_cleanup, +}; +static inline struct mtk_dsi *bridge_to_dsi (struct drm_bridge *b) { return container_of(b, struct mtk_dsi, bridge);
@@ -918,8 +922,9 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) {int ret; - ret =drm_simple_encoder_init (drm, &dsi->encoder, -DRM_MODE_ENCODER_DSI ); + ret =drm_encoder_init (drm, &dsi->encoder, + &mtk_dsi_encoder_funcs, +DRM_MODE_ENCODER_DSI ,NULL );if (ret) {drm_err (drm,"Failed to encoder init to drm\n" );return ret;
Signature · 1 line
2.43.0
drivers/gpu/drm/mediatek/mtk_dsi.c
Quoted 19 lines · Sean Chang
External email : Please do not click links or open attachments until you have verified the sender or the content.
The
drm_simple_encoder_init()helper is deprecated because it adds an intermediate abstraction layer that only wrapsdrm_encoder_init()with an empty or minimaldrm_encoder_funcsstruct.Replace
drm_simple_encoder_init()with explicit calls todrm_encoder_init()and define driver-specificdrm_encoder_funcscarrying the cleanup callback.Signed-off-by Sean Chang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0
Replace
#include <drm/drm_simple_kms_helper.h>
with
#include <drm/drm_encoder.h>
drivers/gpu/drm/mediatek/mtk_dsi.c struct mtk_dsi { · line 232
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +4
-0@@ -226,6 +226,10 @@ struct mtk_dsi {const struct mtk_dsi_driver_data *driver_data; }; +static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = { + .destroy = drm_encoder_cleanup, +}; +
Align to mtk_dpi.c, move this function just before mtk_dsi_ddp_start().
Regards,
CK
Quoted 19 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +3
-3static inline struct mtk_dsi *bridge_to_dsi (struct drm_bridge *b) { return container_of(b, struct mtk_dsi, bridge);@@ -918,8 +922,9 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) {int ret; - ret =drm_simple_encoder_init (drm, &dsi->encoder, -DRM_MODE_ENCODER_DSI ); + ret =drm_encoder_init (drm, &dsi->encoder, + &mtk_dsi_encoder_funcs, +DRM_MODE_ENCODER_DSI ,NULL );if (ret) {drm_err (drm,"Failed to encoder init to drm\n" );return ret; --2.43.0
Hi, Sean:
Quoted 9 lines · Sean Chang
External email : Please do not click links or open attachments until you have verified the sender or the content.
The
drm_simple_encoder_init()helper is deprecated because it adds an intermediate abstraction layer that only wrapsdrm_encoder_init()with an empty or minimaldrm_encoder_funcsstruct.Replace
drm_simple_encoder_init()with explicit calls todrm_encoder_init()and define driver-specificdrm_encoder_funcscarrying the cleanup callback.
Because Diogo Silva has send similar patch before you and it looks good, so I would like to apply his patch.
Regards,
CK
Quoted 37 lines
Signed-off-by Sean Chang <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +7
-3@@ -226,6 +226,10 @@ struct mtk_dsi {const struct mtk_dsi_driver_data *driver_data; }; +static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = { + .destroy = drm_encoder_cleanup, +}; +static inline struct mtk_dsi *bridge_to_dsi (struct drm_bridge *b) { return container_of(b, struct mtk_dsi, bridge);@@ -918,8 +922,9 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) {int ret; - ret =drm_simple_encoder_init (drm, &dsi->encoder, -DRM_MODE_ENCODER_DSI ); + ret =drm_encoder_init (drm, &dsi->encoder, + &mtk_dsi_encoder_funcs, +DRM_MODE_ENCODER_DSI ,NULL );if (ret) {drm_err (drm,"Failed to encoder init to drm\n" );return ret; --2.43.0