Skip to contentSkip to conversation

GPU: drm: meson: inline call to drm_simple_encoder_init()

PATCH New Liam Zuiderhoek 2 participants 2 messages Jun 22

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GPU: drm: meson: inline call to drm_simple_encoder_init()

Inline the function drm_simple_encoder_init for meson, as per the todo list on docs.kernel.org/gpu/todo.html

---
 drivers/gpu/drm/meson/meson_encoder_hdmi.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/meson/meson_encoder_hdmi.c +11 -2
index 55c0601df3c6..f4100e23dd27 100644
@@ -44,9 +44,17 @@ struct meson_encoder_hdmi {
 	struct cec_notifier *cec_notifier;
 };
 
+static const struct drm_encoder_funcs drm_simple_encoder_funcs_cleanup = {
+	.destroy = drm_encoder_cleanup,
+};
+
 #define bridge_to_meson_encoder_hdmi(x) \
 	container_of(x, struct meson_encoder_hdmi, bridge)
 
+static const struct drm_encoder_funcs drm_simple_encoder_funcs_cleanup = {
+	.destroy = drm_encoder_cleanup,
+};
+
 static int meson_encoder_hdmi_attach(struct drm_bridge *bridge,
 				     struct drm_encoder *encoder,
 				     enum drm_bridge_attach_flags flags)
@@ -407,8 +415,9 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv)
 	meson_encoder_hdmi->priv = priv;
 
 	/* Encoder */
-	ret = drm_simple_encoder_init(priv->drm, &meson_encoder_hdmi->encoder,
-				      DRM_MODE_ENCODER_TMDS);
+	ret = drm_encoder_init(priv->drm, &meson_encoder_hdmi->encoder,
+			       &drm_simple_encoder_funcs_cleanup,
+			       DRM_MODE_ENCODER_TMDS, NULL);
 	if (ret) {
 		dev_err_probe(priv->dev, ret, "Failed to init HDMI encoder\n");
 		goto err_put_node;
Signature · 1 line
2.43.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The patch introduces a duplicate definition of the `drm_simple_encoder_funcs_cleanup` structure…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch introduces a duplicate definition of the drm_simple_encoder_funcs_cleanup structure, causing a build failure. --

commit 2bbec9d596493f3ca9a28c3ddb628d5753d83aa2
Author: Liam Zuiderhoek <[email protected]>

GPU: drm: meson: inline call to drm_simple_encoder_init()

This commit inlines the function drm_simple_encoder_init for the meson driver. It replaces the simple encoder init call with drm_encoder_init and a custom cleanup struct.

Quoted 8 lines
drivers/gpu/drm/meson/meson_encoder_hdmi.c +0 -0
index 55c0601df3c62..f4100e23dd270 100644
@@ -44,9 +44,17 @@ struct meson_encoder_hdmi {
 	struct cec_notifier *cec_notifier;
 };
 

drivers/gpu/drm/meson/meson_encoder_hdmi.c struct meson_encoder_hdmi { · line 56

Quoted 10 lines
drivers/gpu/drm/meson/meson_encoder_hdmi.c +7 -0
+static const struct drm_encoder_funcs drm_simple_encoder_funcs_cleanup = {
+	.destroy = drm_encoder_cleanup,
+};
+
 #define bridge_to_meson_encoder_hdmi(x) \
 	container_of(x, struct meson_encoder_hdmi, bridge)
 
+static const struct drm_encoder_funcs drm_simple_encoder_funcs_cleanup = {
+	.destroy = drm_encoder_cleanup,
+};

[Severity: Low]
Does this code cause a compiler error? It appears that the static structure drm_simple_encoder_funcs_cleanup is defined twice in the same file.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1