Thomas Zimmermann
2020-Mar-05  15:59 UTC
[PATCH 00/22] drm: Convert drivers to drm_simple_encoder_init()
A call to drm_simple_encoder_init() initializes an encoder without further functionality. It only provides the destroy callback to cleanup the encoder's state. Only few drivers implement more sophisticated encoders than that. Most drivers implement such a simple encoder and can use drm_simple_encoder_init() instead. The patchset converts drivers where the encoder's instance is embedded in a larger data structure. The driver releases the memory during cleanup. Each patch replaces drm_encoder_init() with drm_simple_encoder_init() and removes the (now unused) driver's encoder functions. While the patchset is fairly large, the indiviual patches are self- contained and can be merged independently from each other. The simple-encoder functionality is currently in drm-misc-next, where these patches could go as well. Future directions: There's another common case where the driver calls kzalloc() plus drm_encoder_init(). Such drivers are not handled by this patchset. The plan here is to use a simple encoder with either managed memory allocation (once it's merged), or embed the encoder in a larger data structure and drop kzalloc() entirely. The patchset has been compile-tested on x86-64, aarch64 and arm. Thomas Zimmermann (22): drm/arc: Use simple encoder drm/atmel-hlcdc: Use simple encoder drm/exynos: Use simple encoder drm/fsl-dcu: Use simple encoder drm/gma500: Use simple encoder drm/hisilicon/kirin: Use simple encoder drm/i2c/tda998x: Use simple encoder drm/imx: Use simple encoder drm/ingenic: Use simple encoder drm/mediatek: Use simple encoder drm/rcar-du: Use simple encoder drm/rockchip: Use simple encoder drm/shmobile: Use simple encoder drm/sun4i: Use simple encoder drm/tegra: Use simple encoder drm/tidss: Use simple encoder drm/tilcdc: Use simple encoder drm/vc4: Use simple encoder drm/virtgpu: Use simple encoder drm/vkms: Use simple encoder drm/writeback: Use simple encoder drm/zte: Use simple encoder drivers/gpu/drm/arc/arcpgu_hdmi.c | 10 +++------- drivers/gpu/drm/arc/arcpgu_sim.c | 8 ++------ .../gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ++++-------- drivers/gpu/drm/drm_writeback.c | 10 +++------- drivers/gpu/drm/exynos/exynos_dp.c | 8 ++------ drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++------ drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 ++------ drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 ++------ drivers/gpu/drm/exynos/exynos_hdmi.c | 8 ++------ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 14 +++----------- drivers/gpu/drm/gma500/cdv_intel_crt.c | 14 +++----------- drivers/gpu/drm/gma500/cdv_intel_dp.c | 16 +++------------- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 4 ++-- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 17 +++-------------- drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 7 +++---- drivers/gpu/drm/gma500/mdfld_output.h | 1 - drivers/gpu/drm/gma500/mdfld_tmd_vid.c | 6 ------ drivers/gpu/drm/gma500/mdfld_tpo_vid.c | 6 ------ drivers/gpu/drm/gma500/oaktrail_hdmi.c | 14 ++------------ drivers/gpu/drm/gma500/oaktrail_lvds.c | 5 +++-- drivers/gpu/drm/gma500/psb_intel_drv.h | 1 - drivers/gpu/drm/gma500/psb_intel_lvds.c | 18 +++--------------- drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c | 5 ----- drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 8 ++------ drivers/gpu/drm/i2c/tda998x_drv.c | 14 +++----------- drivers/gpu/drm/imx/dw_hdmi-imx.c | 8 ++------ drivers/gpu/drm/imx/imx-drm-core.c | 6 ------ drivers/gpu/drm/imx/imx-drm.h | 1 - drivers/gpu/drm/imx/imx-ldb.c | 8 ++------ drivers/gpu/drm/imx/imx-tve.c | 8 ++------ drivers/gpu/drm/imx/parallel-display.c | 8 ++------ drivers/gpu/drm/ingenic/ingenic-drm.c | 9 +++------ drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++----------- drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++----------- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 14 +++----------- .../gpu/drm/rockchip/analogix_dp-rockchip.c | 9 +++------ drivers/gpu/drm/rockchip/cdn-dp-core.c | 9 +++------ .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 8 ++------ drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 8 ++------ drivers/gpu/drm/rockchip/inno_hdmi.c | 8 ++------ drivers/gpu/drm/rockchip/rk3066_hdmi.c | 8 ++------ drivers/gpu/drm/rockchip/rockchip_lvds.c | 10 +++------- drivers/gpu/drm/rockchip/rockchip_rgb.c | 8 ++------ drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 14 +++----------- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 +++--------- drivers/gpu/drm/sun4i/sun4i_lvds.c | 12 +++--------- drivers/gpu/drm/sun4i/sun4i_rgb.c | 17 +++-------------- drivers/gpu/drm/sun4i/sun4i_tv.c | 17 +++-------------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++--------- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 8 ++------ drivers/gpu/drm/tegra/drm.h | 2 -- drivers/gpu/drm/tegra/dsi.c | 10 +++------- drivers/gpu/drm/tegra/hdmi.c | 9 +++------ drivers/gpu/drm/tegra/output.c | 6 +----- drivers/gpu/drm/tegra/rgb.c | 8 ++------ drivers/gpu/drm/tegra/sor.c | 8 ++------ drivers/gpu/drm/tidss/tidss_encoder.c | 10 +++------- drivers/gpu/drm/tilcdc/tilcdc_external.c | 10 +++------- drivers/gpu/drm/tilcdc/tilcdc_panel.c | 8 ++------ drivers/gpu/drm/vc4/vc4_dpi.c | 8 ++------ drivers/gpu/drm/vc4/vc4_dsi.c | 15 +++------------ drivers/gpu/drm/vc4/vc4_hdmi.c | 17 ++++------------- drivers/gpu/drm/vc4/vc4_vec.c | 8 ++------ drivers/gpu/drm/virtio/virtgpu_display.c | 8 ++------ drivers/gpu/drm/vkms/vkms_output.c | 8 ++------ drivers/gpu/drm/zte/zx_hdmi.c | 8 ++------ drivers/gpu/drm/zte/zx_tvenc.c | 8 ++------ drivers/gpu/drm/zte/zx_vga.c | 8 ++------ 68 files changed, 151 insertions(+), 488 deletions(-) -- 2.25.1
The arc driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/arc/arcpgu_hdmi.c | 10 +++-------
 drivers/gpu/drm/arc/arcpgu_sim.c  |  8 ++------
 2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/arc/arcpgu_hdmi.c
b/drivers/gpu/drm/arc/arcpgu_hdmi.c
index 52839934f2fb..780911765e2e 100644
--- a/drivers/gpu/drm/arc/arcpgu_hdmi.c
+++ b/drivers/gpu/drm/arc/arcpgu_hdmi.c
@@ -7,15 +7,12 @@
 
 #include <drm/drm_bridge.h>
 #include <drm/drm_crtc.h>
-#include <drm/drm_encoder.h>
 #include <drm/drm_device.h>
+#include <drm/drm_encoder.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "arcpgu.h"
 
-static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np)
 {
 	struct drm_encoder *encoder;
@@ -34,8 +31,7 @@ int arcpgu_drm_hdmi_init(struct drm_device *drm, struct
device_node *np)
 
 	encoder->possible_crtcs = 1;
 	encoder->possible_clones = 0;
-	ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
-			       DRM_MODE_ENCODER_TMDS, NULL);
+	ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
 	if (ret)
 		return ret;
 
diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c
index 37d961668dfe..66ca2c26e339 100644
--- a/drivers/gpu/drm/arc/arcpgu_sim.c
+++ b/drivers/gpu/drm/arc/arcpgu_sim.c
@@ -8,6 +8,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_device.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "arcpgu.h"
 
@@ -50,10 +51,6 @@ static const struct drm_connector_funcs
arcpgu_drm_connector_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
-static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
 {
 	struct arcpgu_drm_connector *arcpgu_connector;
@@ -68,8 +65,7 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct
device_node *np)
 	encoder->possible_crtcs = 1;
 	encoder->possible_clones = 0;
 
-	ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
-			       DRM_MODE_ENCODER_VIRTUAL, NULL);
+	ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_VIRTUAL);
 	if (ret)
 		return ret;
 
-- 
2.25.1
The atmel-hlcdc driver uses an empty implementation for its encoder.
Replace the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
index e2019fe97fff..43bc709e3523 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
@@ -11,9 +11,10 @@
 #include <linux/media-bus-format.h>
 #include <linux/of_graph.h>
 
+#include <drm/drm_bridge.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_of.h>
-#include <drm/drm_bridge.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "atmel_hlcdc_dc.h"
 
@@ -22,10 +23,6 @@ struct atmel_hlcdc_rgb_output {
 	int bus_fmt;
 };
 
-static const struct drm_encoder_funcs atmel_hlcdc_panel_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static struct atmel_hlcdc_rgb_output *
 atmel_hlcdc_encoder_to_rgb_output(struct drm_encoder *encoder)
 {
@@ -98,9 +95,8 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev,
int endpoint)
 		return -EINVAL;
 	}
 
-	ret = drm_encoder_init(dev, &output->encoder,
-			       &atmel_hlcdc_panel_encoder_funcs,
-			       DRM_MODE_ENCODER_NONE, NULL);
+	ret = drm_simple_encoder_init(dev, &output->encoder,
+				      DRM_MODE_ENCODER_NONE);
 	if (ret)
 		return ret;
 
-- 
2.25.1
The exynos driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/exynos/exynos_dp.c       | 8 ++------
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  | 8 ++------
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  | 8 ++------
 drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 ++------
 drivers/gpu/drm/exynos/exynos_hdmi.c     | 8 ++------
 5 files changed, 10 insertions(+), 30 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_dp.c
b/drivers/gpu/drm/exynos/exynos_dp.c
index d23d3502ca91..a61482af2998 100644
--- a/drivers/gpu/drm/exynos/exynos_dp.c
+++ b/drivers/gpu/drm/exynos/exynos_dp.c
@@ -25,6 +25,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <drm/exynos_drm.h>
 
 #include "exynos_drm_crtc.h"
@@ -135,10 +136,6 @@ static const struct drm_encoder_helper_funcs
exynos_dp_encoder_helper_funcs = {
 	.disable = exynos_dp_nop,
 };
 
-static const struct drm_encoder_funcs exynos_dp_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
 {
 	int ret;
@@ -174,8 +171,7 @@ static int exynos_dp_bind(struct device *dev, struct device
*master, void *data)
 			return ret;
 	}
 
-	drm_encoder_init(drm_dev, encoder, &exynos_dp_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	drm_encoder_helper_add(encoder, &exynos_dp_encoder_helper_funcs);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 43fa0f26c052..7ba5354e7d94 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -14,6 +14,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include <video/of_videomode.h>
 #include <video/videomode.h>
@@ -149,10 +150,6 @@ static const struct drm_encoder_helper_funcs
exynos_dpi_encoder_helper_funcs = {
 	.disable = exynos_dpi_disable,
 };
 
-static const struct drm_encoder_funcs exynos_dpi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 enum {
 	FIMD_PORT_IN0,
 	FIMD_PORT_IN1,
@@ -201,8 +198,7 @@ int exynos_dpi_bind(struct drm_device *dev, struct
drm_encoder *encoder)
 {
 	int ret;
 
-	drm_encoder_init(dev, encoder, &exynos_dpi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	drm_encoder_helper_add(encoder, &exynos_dpi_encoder_helper_funcs);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 669d3857502a..2986c93382e0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -30,6 +30,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "exynos_drm_crtc.h"
 #include "exynos_drm_drv.h"
@@ -1524,10 +1525,6 @@ static const struct drm_encoder_helper_funcs
exynos_dsi_encoder_helper_funcs = {
 	.disable = exynos_dsi_disable,
 };
 
-static const struct drm_encoder_funcs exynos_dsi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 MODULE_DEVICE_TABLE(of, exynos_dsi_of_match);
 
 static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
@@ -1705,8 +1702,7 @@ static int exynos_dsi_bind(struct device *dev, struct
device *master,
 	struct drm_bridge *in_bridge;
 	int ret;
 
-	drm_encoder_init(drm_dev, encoder, &exynos_dsi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	drm_encoder_helper_add(encoder, &exynos_dsi_encoder_helper_funcs);
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index b320b3a21ad4..282467121699 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -14,6 +14,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <drm/drm_vblank.h>
 #include <drm/exynos_drm.h>
 
@@ -369,10 +370,6 @@ static const struct drm_encoder_helper_funcs
exynos_vidi_encoder_helper_funcs  	.disable = exynos_vidi_disable,
 };
 
-static const struct drm_encoder_funcs exynos_vidi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int vidi_bind(struct device *dev, struct device *master, void *data)
 {
 	struct vidi_context *ctx = dev_get_drvdata(dev);
@@ -406,8 +403,7 @@ static int vidi_bind(struct device *dev, struct device
*master, void *data)
 		return PTR_ERR(ctx->crtc);
 	}
 
-	drm_encoder_init(drm_dev, encoder, &exynos_vidi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	drm_encoder_helper_add(encoder, &exynos_vidi_encoder_helper_funcs);
 
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 3e5f1a77286d..302ffda5f297 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -38,6 +38,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "exynos_drm_crtc.h"
 #include "regs-hdmi.h"
@@ -1559,10 +1560,6 @@ static const struct drm_encoder_helper_funcs
exynos_hdmi_encoder_helper_funcs  	.disable	= hdmi_disable,
 };
 
-static const struct drm_encoder_funcs exynos_hdmi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static void hdmi_audio_shutdown(struct device *dev, void *data)
 {
 	struct hdmi_context *hdata = dev_get_drvdata(dev);
@@ -1851,8 +1848,7 @@ static int hdmi_bind(struct device *dev, struct device
*master, void *data)
 
 	hdata->phy_clk.enable = hdmiphy_clk_enable;
 
-	drm_encoder_init(drm_dev, encoder, &exynos_hdmi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	drm_encoder_helper_add(encoder, &exynos_hdmi_encoder_helper_funcs);
 
-- 
2.25.1
The fsl-dcu driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
index cff344367f81..9b0c4736c21a 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
@@ -13,19 +13,11 @@
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "fsl_dcu_drm_drv.h"
 #include "fsl_tcon.h"
 
-static void fsl_dcu_drm_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs encoder_funcs = {
-	.destroy = fsl_dcu_drm_encoder_destroy,
-};
-
 int fsl_dcu_drm_encoder_create(struct fsl_dcu_drm_device *fsl_dev,
 			       struct drm_crtc *crtc)
 {
@@ -38,8 +30,8 @@ int fsl_dcu_drm_encoder_create(struct fsl_dcu_drm_device
*fsl_dev,
 	if (fsl_dev->tcon)
 		fsl_tcon_bypass_enable(fsl_dev->tcon);
 
-	ret = drm_encoder_init(fsl_dev->drm, encoder, &encoder_funcs,
-			       DRM_MODE_ENCODER_LVDS, NULL);
+	ret = drm_simple_encoder_init(fsl_dev->drm, encoder,
+				      DRM_MODE_ENCODER_LVDS);
 	if (ret < 0)
 		return ret;
 
-- 
2.25.1
The gma500 driver uses empty implementations for some of its encoders.
Replace the code with the generic simple encoder. As a side effect, the
patch also removes an indirection in the encoder setup for Medfield.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/gma500/cdv_intel_crt.c     | 14 +++-----------
 drivers/gpu/drm/gma500/cdv_intel_dp.c      | 16 +++-------------
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c    |  4 ++--
 drivers/gpu/drm/gma500/cdv_intel_lvds.c    | 17 +++--------------
 drivers/gpu/drm/gma500/mdfld_dsi_dpi.c     |  7 +++----
 drivers/gpu/drm/gma500/mdfld_output.h      |  1 -
 drivers/gpu/drm/gma500/mdfld_tmd_vid.c     |  6 ------
 drivers/gpu/drm/gma500/mdfld_tpo_vid.c     |  6 ------
 drivers/gpu/drm/gma500/oaktrail_hdmi.c     | 14 ++------------
 drivers/gpu/drm/gma500/oaktrail_lvds.c     |  5 +++--
 drivers/gpu/drm/gma500/psb_intel_drv.h     |  1 -
 drivers/gpu/drm/gma500/psb_intel_lvds.c    | 18 +++---------------
 drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c |  5 -----
 13 files changed, 22 insertions(+), 92 deletions(-)
diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c
b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index 29c36d63b20e..88535f5aacc5 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -28,6 +28,8 @@
 #include <linux/i2c.h>
 #include <linux/pm_runtime.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "cdv_device.h"
 #include "intel_bios.h"
 #include "power.h"
@@ -237,15 +239,6 @@ static const struct drm_connector_helper_funcs
 	.best_encoder = gma_best_encoder,
 };
 
-static void cdv_intel_crt_enc_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs cdv_intel_crt_enc_funcs = {
-	.destroy = cdv_intel_crt_enc_destroy,
-};
-
 void cdv_intel_crt_init(struct drm_device *dev,
 			struct psb_intel_mode_device *mode_dev)
 {
@@ -271,8 +264,7 @@ void cdv_intel_crt_init(struct drm_device *dev,
 		&cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
 
 	encoder = &gma_encoder->base;
-	drm_encoder_init(dev, encoder,
-		&cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 
diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c
b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index 5772b2dce0d6..13947ec06dbb 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -32,6 +32,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_dp_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "gma_display.h"
 #include "psb_drv.h"
@@ -1908,11 +1909,6 @@ cdv_intel_dp_destroy(struct drm_connector *connector)
 	kfree(connector);
 }
 
-static void cdv_intel_dp_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
 static const struct drm_encoder_helper_funcs cdv_intel_dp_helper_funcs = {
 	.dpms = cdv_intel_dp_dpms,
 	.mode_fixup = cdv_intel_dp_mode_fixup,
@@ -1935,11 +1931,6 @@ static const struct drm_connector_helper_funcs
cdv_intel_dp_connector_helper_fun
 	.best_encoder = gma_best_encoder,
 };
 
-static const struct drm_encoder_funcs cdv_intel_dp_enc_funcs = {
-	.destroy = cdv_intel_dp_encoder_destroy,
-};
-
-
 static void cdv_intel_dp_add_properties(struct drm_connector *connector)
 {
 	cdv_intel_attach_force_audio_property(connector);
@@ -2016,8 +2007,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct
psb_intel_mode_device *mode_dev
 	encoder = &gma_encoder->base;
 
 	drm_connector_init(dev, connector, &cdv_intel_dp_connector_funcs, type);
-	drm_encoder_init(dev, encoder, &cdv_intel_dp_enc_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 
@@ -2120,7 +2110,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct
psb_intel_mode_device *mode_dev
 		if (ret == 0) {
 			/* if this fails, presume the device is a ghost */
 			DRM_INFO("failed to retrieve link info, disabling eDP\n");
-			cdv_intel_dp_encoder_destroy(encoder);
+			drm_encoder_cleanup(encoder);
 			cdv_intel_dp_destroy(connector);
 			goto err_priv;
 		} else {
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index 1711a41acc16..0d12c6ffbc40 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -32,6 +32,7 @@
 #include <drm/drm.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "cdv_device.h"
 #include "psb_drv.h"
@@ -311,8 +312,7 @@ void cdv_hdmi_init(struct drm_device *dev,
 			   &cdv_hdmi_connector_funcs,
 			   DRM_MODE_CONNECTOR_DVID);
 
-	drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 	gma_encoder->type = INTEL_OUTPUT_HDMI;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index ea0a5d9a0acc..18de10e9ff9a 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -12,6 +12,8 @@
 #include <linux/i2c.h>
 #include <linux/pm_runtime.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "cdv_device.h"
 #include "intel_bios.h"
 #include "power.h"
@@ -499,16 +501,6 @@ static const struct drm_connector_funcs
cdv_intel_lvds_connector_funcs = {
 	.destroy = cdv_intel_lvds_destroy,
 };
 
-
-static void cdv_intel_lvds_enc_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs = {
-	.destroy = cdv_intel_lvds_enc_destroy,
-};
-
 /*
  * Enumerate the child dev array parsed from VBT to check whether
  * the LVDS is present.
@@ -616,10 +608,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
 			   &cdv_intel_lvds_connector_funcs,
 			   DRM_MODE_CONNECTOR_LVDS);
 
-	drm_encoder_init(dev, encoder,
-			 &cdv_intel_lvds_enc_funcs,
-			 DRM_MODE_ENCODER_LVDS, NULL);
-
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 	gma_encoder->type = INTEL_OUTPUT_LVDS;
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
index d4c65f268922..aa5aa293ddb6 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
@@ -27,6 +27,8 @@
 
 #include <linux/delay.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "mdfld_dsi_dpi.h"
 #include "mdfld_dsi_pkg_sender.h"
 #include "mdfld_output.h"
@@ -993,10 +995,7 @@ struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct
drm_device *dev,
 	/*create drm encoder object*/
 	connector = &dsi_connector->base.base;
 	encoder = &dpi_output->base.base.base;
-	drm_encoder_init(dev,
-			encoder,
-			p_funcs->encoder_funcs,
-			DRM_MODE_ENCODER_LVDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
 	drm_encoder_helper_add(encoder,
 				p_funcs->encoder_helper_funcs);
 
diff --git a/drivers/gpu/drm/gma500/mdfld_output.h
b/drivers/gpu/drm/gma500/mdfld_output.h
index ab2b27c0f037..17a944d70add 100644
--- a/drivers/gpu/drm/gma500/mdfld_output.h
+++ b/drivers/gpu/drm/gma500/mdfld_output.h
@@ -51,7 +51,6 @@ struct panel_info {
 };
 
 struct panel_funcs {
-	const struct drm_encoder_funcs *encoder_funcs;
 	const struct drm_encoder_helper_funcs *encoder_helper_funcs;
 	struct drm_display_mode * (*get_config_mode)(struct drm_device *);
 	int (*get_panel_info)(struct drm_device *, int, struct panel_info *);
diff --git a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
index 49c92debb7b2..25e897b98f86 100644
--- a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
+++ b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c
@@ -188,13 +188,7 @@ static const struct drm_encoder_helper_funcs
 	.commit = mdfld_dsi_dpi_commit,
 };
 
-/*TPO DPI encoder funcs*/
-static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 const struct panel_funcs mdfld_tmd_vid_funcs = {
-	.encoder_funcs = &mdfld_tpo_dpi_encoder_funcs,
 	.encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
 	.get_config_mode = &tmd_vid_get_config_mode,
 	.get_panel_info = tmd_vid_get_panel_info,
diff --git a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
index a9420bf9a419..11845978fb0a 100644
--- a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
+++ b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c
@@ -76,13 +76,7 @@ static const struct drm_encoder_helper_funcs
 	.commit = mdfld_dsi_dpi_commit,
 };
 
-/*TPO DPI encoder funcs*/
-static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 const struct panel_funcs mdfld_tpo_vid_funcs = {
-	.encoder_funcs = &mdfld_tpo_dpi_encoder_funcs,
 	.encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs,
 	.get_config_mode = &tpo_vid_get_config_mode,
 	.get_panel_info = tpo_vid_get_panel_info,
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index f4370232767d..b25086f252ae 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -27,6 +27,7 @@
 #include <linux/delay.h>
 
 #include <drm/drm.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "psb_drv.h"
 #include "psb_intel_drv.h"
@@ -620,15 +621,6 @@ static const struct drm_connector_funcs
oaktrail_hdmi_connector_funcs = {
 	.destroy = oaktrail_hdmi_destroy,
 };
 
-static void oaktrail_hdmi_enc_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = {
-	.destroy = oaktrail_hdmi_enc_destroy,
-};
-
 void oaktrail_hdmi_init(struct drm_device *dev,
 					struct psb_intel_mode_device *mode_dev)
 {
@@ -651,9 +643,7 @@ void oaktrail_hdmi_init(struct drm_device *dev,
 			   &oaktrail_hdmi_connector_funcs,
 			   DRM_MODE_CONNECTOR_DVID);
 
-	drm_encoder_init(dev, encoder,
-			 &oaktrail_hdmi_enc_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 
diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c
b/drivers/gpu/drm/gma500/oaktrail_lvds.c
index 582e09597500..2828360153d1 100644
--- a/drivers/gpu/drm/gma500/oaktrail_lvds.c
+++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c
@@ -13,6 +13,8 @@
 
 #include <asm/intel-mid.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "intel_bios.h"
 #include "power.h"
 #include "psb_drv.h"
@@ -311,8 +313,7 @@ void oaktrail_lvds_init(struct drm_device *dev,
 			   &psb_intel_lvds_connector_funcs,
 			   DRM_MODE_CONNECTOR_LVDS);
 
-	drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
-			 DRM_MODE_ENCODER_LVDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 	gma_encoder->type = INTEL_OUTPUT_LVDS;
diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h
b/drivers/gpu/drm/gma500/psb_intel_drv.h
index 16c6136f778b..fb601983cef0 100644
--- a/drivers/gpu/drm/gma500/psb_intel_drv.h
+++ b/drivers/gpu/drm/gma500/psb_intel_drv.h
@@ -252,7 +252,6 @@ extern int psb_intel_lvds_set_property(struct drm_connector
*connector,
 					struct drm_property *property,
 					uint64_t value);
 extern void psb_intel_lvds_destroy(struct drm_connector *connector);
-extern const struct drm_encoder_funcs psb_intel_lvds_enc_funcs;
 
 /* intel_gmbus.c */
 extern void gma_intel_i2c_reset(struct drm_device *dev);
diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c
b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index afaebab7bc17..063c66bb946d 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -11,6 +11,8 @@
 #include <linux/i2c.h>
 #include <linux/pm_runtime.h>
 
+#include <drm/drm_simple_kms_helper.h>
+
 #include "intel_bios.h"
 #include "power.h"
 #include "psb_drv.h"
@@ -621,18 +623,6 @@ const struct drm_connector_funcs
psb_intel_lvds_connector_funcs = {
 	.destroy = psb_intel_lvds_destroy,
 };
 
-
-static void psb_intel_lvds_enc_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = {
-	.destroy = psb_intel_lvds_enc_destroy,
-};
-
-
-
 /**
  * psb_intel_lvds_init - setup LVDS connectors on this device
  * @dev: drm device
@@ -683,9 +673,7 @@ void psb_intel_lvds_init(struct drm_device *dev,
 			   &psb_intel_lvds_connector_funcs,
 			   DRM_MODE_CONNECTOR_LVDS);
 
-	drm_encoder_init(dev, encoder,
-			 &psb_intel_lvds_enc_funcs,
-			 DRM_MODE_ENCODER_LVDS, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
 
 	gma_connector_attach_encoder(gma_connector, gma_encoder);
 	gma_encoder->type = INTEL_OUTPUT_LVDS;
diff --git a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
index 9e8224456ea2..f7e121f4c609 100644
--- a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
+++ b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
@@ -765,12 +765,7 @@ static const struct drm_encoder_helper_funcs
tc35876x_encoder_helper_funcs = {
 	.commit = mdfld_dsi_dpi_commit,
 };
 
-static const struct drm_encoder_funcs tc35876x_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 const struct panel_funcs mdfld_tc35876x_funcs = {
-	.encoder_funcs = &tc35876x_encoder_funcs,
 	.encoder_helper_funcs = &tc35876x_encoder_helper_funcs,
 	.get_config_mode = tc35876x_get_config_mode,
 	.get_panel_info = tc35876x_get_panel_info,
-- 
2.25.1
Thomas Zimmermann
2020-Mar-05  15:59 UTC
[PATCH 06/22] drm/hisilicon/kirin: Use simple encoder
The kirin driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
index f31068d74b18..08c1ab542c03 100644
--- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
+++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
@@ -25,6 +25,7 @@
 #include <drm/drm_of.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "dw_dsi_reg.h"
 
@@ -696,10 +697,6 @@ static const struct drm_encoder_helper_funcs
dw_encoder_helper_funcs = {
 	.disable	= dsi_encoder_disable
 };
 
-static const struct drm_encoder_funcs dw_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int dw_drm_encoder_init(struct device *dev,
 			       struct drm_device *drm_dev,
 			       struct drm_encoder *encoder)
@@ -713,8 +710,7 @@ static int dw_drm_encoder_init(struct device *dev,
 	}
 
 	encoder->possible_crtcs = crtc_mask;
-	ret = drm_encoder_init(drm_dev, encoder, &dw_encoder_funcs,
-			       DRM_MODE_ENCODER_DSI, NULL);
+	ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_DSI);
 	if (ret) {
 		DRM_ERROR("failed to init dsi encoder\n");
 		return ret;
-- 
2.25.1
The tda998x driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c
b/drivers/gpu/drm/i2c/tda998x_drv.c
index c3332209f27a..0e1a90f70ec0 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -19,6 +19,7 @@
 #include <drm/drm_of.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <drm/i2c/tda998x.h>
 
 #include <media/cec-notifier.h>
@@ -1997,15 +1998,6 @@ static int tda998x_create(struct device *dev)
 
 /* DRM encoder functions */
 
-static void tda998x_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs tda998x_encoder_funcs = {
-	.destroy = tda998x_encoder_destroy,
-};
-
 static int tda998x_encoder_init(struct device *dev, struct drm_device *drm)
 {
 	struct tda998x_priv *priv = dev_get_drvdata(dev);
@@ -2023,8 +2015,8 @@ static int tda998x_encoder_init(struct device *dev, struct
drm_device *drm)
 
 	priv->encoder.possible_crtcs = crtcs;
 
-	ret = drm_encoder_init(drm, &priv->encoder, &tda998x_encoder_funcs,
-			       DRM_MODE_ENCODER_TMDS, NULL);
+	ret = drm_simple_encoder_init(drm, &priv->encoder,
+				      DRM_MODE_ENCODER_TMDS);
 	if (ret)
 		goto err_encoder;
 
-- 
2.25.1
The imx driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/imx/dw_hdmi-imx.c      | 8 ++------
 drivers/gpu/drm/imx/imx-drm-core.c     | 6 ------
 drivers/gpu/drm/imx/imx-drm.h          | 1 -
 drivers/gpu/drm/imx/imx-ldb.c          | 8 ++------
 drivers/gpu/drm/imx/imx-tve.c          | 8 ++------
 drivers/gpu/drm/imx/parallel-display.c | 8 ++------
 6 files changed, 8 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c
b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index f22cfbf9353e..ba4ca17fd4d8 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -18,6 +18,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_of.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "imx-drm.h"
 
@@ -143,10 +144,6 @@ static const struct drm_encoder_helper_funcs
dw_hdmi_imx_encoder_helper_funcs  	.atomic_check = dw_hdmi_imx_atomic_check,
 };
 
-static const struct drm_encoder_funcs dw_hdmi_imx_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static enum drm_mode_status
 imx6q_hdmi_mode_valid(struct drm_connector *con,
 		      const struct drm_display_mode *mode)
@@ -236,8 +233,7 @@ static int dw_hdmi_imx_bind(struct device *dev, struct
device *master,
 		return ret;
 
 	drm_encoder_helper_add(encoder, &dw_hdmi_imx_encoder_helper_funcs);
-	drm_encoder_init(drm, encoder, &dw_hdmi_imx_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
 
 	platform_set_drvdata(pdev, hdmi);
 
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c
b/drivers/gpu/drm/imx/imx-drm-core.c
index da87c70e413b..9979547ca883 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -42,12 +42,6 @@ void imx_drm_connector_destroy(struct drm_connector
*connector)
 }
 EXPORT_SYMBOL_GPL(imx_drm_connector_destroy);
 
-void imx_drm_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-EXPORT_SYMBOL_GPL(imx_drm_encoder_destroy);
-
 static int imx_drm_atomic_check(struct drm_device *dev,
 				struct drm_atomic_state *state)
 {
diff --git a/drivers/gpu/drm/imx/imx-drm.h b/drivers/gpu/drm/imx/imx-drm.h
index ab9c6f706eb3..c3e1a3f14d30 100644
--- a/drivers/gpu/drm/imx/imx-drm.h
+++ b/drivers/gpu/drm/imx/imx-drm.h
@@ -38,7 +38,6 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
 	struct drm_encoder *encoder, struct device_node *np);
 
 void imx_drm_connector_destroy(struct drm_connector *connector);
-void imx_drm_encoder_destroy(struct drm_encoder *encoder);
 
 int ipu_planes_assign_pre(struct drm_device *dev,
 			  struct drm_atomic_state *state);
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 4da22a94790c..66ea68e8da87 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -26,6 +26,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "imx-drm.h"
 
@@ -393,10 +394,6 @@ static const struct drm_connector_helper_funcs
imx_ldb_connector_helper_funcs  	.best_encoder = imx_ldb_connector_best_encoder,
 };
 
-static const struct drm_encoder_funcs imx_ldb_encoder_funcs = {
-	.destroy = imx_drm_encoder_destroy,
-};
-
 static const struct drm_encoder_helper_funcs imx_ldb_encoder_helper_funcs = {
 	.atomic_mode_set = imx_ldb_encoder_atomic_mode_set,
 	.enable = imx_ldb_encoder_enable,
@@ -441,8 +438,7 @@ static int imx_ldb_register(struct drm_device *drm,
 	}
 
 	drm_encoder_helper_add(encoder, &imx_ldb_encoder_helper_funcs);
-	drm_encoder_init(drm, encoder, &imx_ldb_encoder_funcs,
-			 DRM_MODE_ENCODER_LVDS, NULL);
+	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_LVDS);
 
 	if (imx_ldb_ch->bridge) {
 		ret = drm_bridge_attach(&imx_ldb_ch->encoder,
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index 5bbfaa2cd0f4..ee63782c77e9 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -21,6 +21,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "imx-drm.h"
 
@@ -348,10 +349,6 @@ static const struct drm_connector_helper_funcs
imx_tve_connector_helper_funcs  	.mode_valid = imx_tve_connector_mode_valid,
 };
 
-static const struct drm_encoder_funcs imx_tve_encoder_funcs = {
-	.destroy = imx_drm_encoder_destroy,
-};
-
 static const struct drm_encoder_helper_funcs imx_tve_encoder_helper_funcs = {
 	.mode_set = imx_tve_encoder_mode_set,
 	.enable = imx_tve_encoder_enable,
@@ -479,8 +476,7 @@ static int imx_tve_register(struct drm_device *drm, struct
imx_tve *tve)
 		return ret;
 
 	drm_encoder_helper_add(&tve->encoder,
&imx_tve_encoder_helper_funcs);
-	drm_encoder_init(drm, &tve->encoder, &imx_tve_encoder_funcs,
-			 encoder_type, NULL);
+	drm_simple_encoder_init(drm, &tve->encoder, encoder_type);
 
 	drm_connector_helper_add(&tve->connector,
 			&imx_tve_connector_helper_funcs);
diff --git a/drivers/gpu/drm/imx/parallel-display.c
b/drivers/gpu/drm/imx/parallel-display.c
index 08fafa4bf8c2..ac916c84a631 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -18,6 +18,7 @@
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "imx-drm.h"
 
@@ -256,10 +257,6 @@ static const struct drm_connector_helper_funcs
imx_pd_connector_helper_funcs = {
 	.best_encoder = imx_pd_connector_best_encoder,
 };
 
-static const struct drm_encoder_funcs imx_pd_encoder_funcs = {
-	.destroy = imx_drm_encoder_destroy,
-};
-
 static const struct drm_bridge_funcs imx_pd_bridge_funcs = {
 	.enable = imx_pd_bridge_enable,
 	.disable = imx_pd_bridge_disable,
@@ -288,8 +285,7 @@ static int imx_pd_register(struct drm_device *drm,
 	 */
 	imxpd->connector.dpms = DRM_MODE_DPMS_OFF;
 
-	drm_encoder_init(drm, encoder, &imx_pd_encoder_funcs,
-			 DRM_MODE_ENCODER_NONE, NULL);
+	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_NONE);
 
 	imxpd->bridge.funcs = &imx_pd_bridge_funcs;
 	drm_bridge_attach(encoder, &imxpd->bridge, NULL, 0);
-- 
2.25.1
The ingenic driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/ingenic/ingenic-drm.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c
b/drivers/gpu/drm/ingenic/ingenic-drm.c
index 9dfe7cb530e1..9f7983a97392 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
@@ -28,6 +28,7 @@
 #include <drm/drm_plane.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <drm/drm_vblank.h>
 
 #define JZ_REG_LCD_CFG				0x00
@@ -592,10 +593,6 @@ static const struct drm_mode_config_funcs
ingenic_drm_mode_config_funcs = {
 	.atomic_commit		= drm_atomic_helper_commit,
 };
 
-static const struct drm_encoder_funcs ingenic_drm_encoder_funcs = {
-	.destroy		= drm_encoder_cleanup,
-};
-
 static void ingenic_drm_free_dma_hwdesc(void *d)
 {
 	struct ingenic_drm *priv = d;
@@ -730,8 +727,8 @@ static int ingenic_drm_probe(struct platform_device *pdev)
 	drm_encoder_helper_add(&priv->encoder,
 			       &ingenic_drm_encoder_helper_funcs);
 
-	ret = drm_encoder_init(drm, &priv->encoder,
&ingenic_drm_encoder_funcs,
-			       DRM_MODE_ENCODER_DPI, NULL);
+	ret = drm_simple_encoder_init(drm, &priv->encoder,
+				      DRM_MODE_ENCODER_DPI);
 	if (ret) {
 		dev_err(dev, "Failed to init encoder: %i", ret);
 		return ret;
-- 
2.25.1
The mediatak driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++-----------
 drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++-----------
 2 files changed, 6 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 14fbe1c09ce9..9c90c58e5acd 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -20,6 +20,7 @@
 #include <drm/drm_bridge.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_of.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "mtk_dpi_regs.h"
 #include "mtk_drm_ddp_comp.h"
@@ -509,15 +510,6 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
 	return 0;
 }
 
-static void mtk_dpi_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs mtk_dpi_encoder_funcs = {
-	.destroy = mtk_dpi_encoder_destroy,
-};
-
 static bool mtk_dpi_encoder_mode_fixup(struct drm_encoder *encoder,
 				       const struct drm_display_mode *mode,
 				       struct drm_display_mode *adjusted_mode)
@@ -596,8 +588,8 @@ static int mtk_dpi_bind(struct device *dev, struct device
*master, void *data)
 		return ret;
 	}
 
-	ret = drm_encoder_init(drm_dev, &dpi->encoder,
&mtk_dpi_encoder_funcs,
-			       DRM_MODE_ENCODER_TMDS, NULL);
+	ret = drm_simple_encoder_init(drm_dev, &dpi->encoder,
+				      DRM_MODE_ENCODER_TMDS);
 	if (ret) {
 		dev_err(dev, "Failed to initialize decoder: %d\n", ret);
 		goto err_unregister;
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c
b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ede69830a9d..a9a25087112f 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -22,6 +22,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "mtk_drm_ddp_comp.h"
 
@@ -787,15 +788,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
 	dsi->enabled = false;
 }
 
-static void mtk_dsi_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = {
-	.destroy = mtk_dsi_encoder_destroy,
-};
-
 static bool mtk_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
 				       const struct drm_display_mode *mode,
 				       struct drm_display_mode *adjusted_mode)
@@ -888,8 +880,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm,
struct mtk_dsi *dsi)
 {
 	int ret;
 
-	ret = drm_encoder_init(drm, &dsi->encoder, &mtk_dsi_encoder_funcs,
-			       DRM_MODE_ENCODER_DSI, NULL);
+	ret = drm_simple_encoder_init(drm, &dsi->encoder,
+				      DRM_MODE_ENCODER_DSI);
 	if (ret) {
 		DRM_ERROR("Failed to encoder init to drm\n");
 		return ret;
-- 
2.25.1
The rcar-du driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index c07c6a88aff0..b0335da0c161 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -13,6 +13,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "rcar_du_drv.h"
 #include "rcar_du_encoder.h"
@@ -23,13 +24,6 @@
  * Encoder
  */
 
-static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
-};
-
-static const struct drm_encoder_funcs encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static unsigned int rcar_du_encoder_count_ports(struct device_node *node)
 {
 	struct device_node *ports;
@@ -110,13 +104,11 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 		}
 	}
 
-	ret = drm_encoder_init(rcdu->ddev, encoder, &encoder_funcs,
-			       DRM_MODE_ENCODER_NONE, NULL);
+	ret = drm_simple_encoder_init(rcdu->ddev, encoder,
+				      DRM_MODE_ENCODER_NONE);
 	if (ret < 0)
 		goto done;
 
-	drm_encoder_helper_add(encoder, &encoder_helper_funcs);
-
 	/*
 	 * Attach the bridge to the encoder. The bridge will create the
 	 * connector.
-- 
2.25.1
The rockchip driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c |  9 +++------
 drivers/gpu/drm/rockchip/cdn-dp-core.c          |  9 +++------
 drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c |  8 ++------
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c     |  8 ++------
 drivers/gpu/drm/rockchip/inno_hdmi.c            |  8 ++------
 drivers/gpu/drm/rockchip/rk3066_hdmi.c          |  8 ++------
 drivers/gpu/drm/rockchip/rockchip_lvds.c        | 10 +++-------
 drivers/gpu/drm/rockchip/rockchip_rgb.c         |  8 ++------
 8 files changed, 19 insertions(+), 49 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index f38f5e113c6b..848522797314 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -26,6 +26,7 @@
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "rockchip_drm_drv.h"
 #include "rockchip_drm_vop.h"
@@ -258,10 +259,6 @@ static struct drm_encoder_helper_funcs
rockchip_dp_encoder_helper_funcs = {
 	.atomic_check = rockchip_dp_drm_encoder_atomic_check,
 };
 
-static struct drm_encoder_funcs rockchip_dp_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int rockchip_dp_of_probe(struct rockchip_dp_device *dp)
 {
 	struct device *dev = dp->dev;
@@ -309,8 +306,8 @@ static int rockchip_dp_drm_create_encoder(struct
rockchip_dp_device *dp)
 							     dev->of_node);
 	DRM_DEBUG_KMS("possible_crtcs = 0x%x\n",
encoder->possible_crtcs);
 
-	ret = drm_encoder_init(drm_dev, encoder, &rockchip_dp_encoder_funcs,
-			       DRM_MODE_ENCODER_TMDS, NULL);
+	ret = drm_simple_encoder_init(drm_dev, encoder,
+				      DRM_MODE_ENCODER_TMDS);
 	if (ret) {
 		DRM_ERROR("failed to initialize encoder with drm\n");
 		return ret;
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c
b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index eed594bd38d3..06f85138b51b 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -20,6 +20,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "cdn-dp-core.h"
 #include "cdn-dp-reg.h"
@@ -689,10 +690,6 @@ static const struct drm_encoder_helper_funcs
cdn_dp_encoder_helper_funcs = {
 	.atomic_check = cdn_dp_encoder_atomic_check,
 };
 
-static const struct drm_encoder_funcs cdn_dp_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int cdn_dp_parse_dt(struct cdn_dp_device *dp)
 {
 	struct device *dev = dp->dev;
@@ -1030,8 +1027,8 @@ static int cdn_dp_bind(struct device *dev, struct device
*master, void *data)
 							     dev->of_node);
 	DRM_DEBUG_KMS("possible_crtcs = 0x%x\n",
encoder->possible_crtcs);
 
-	ret = drm_encoder_init(drm_dev, encoder, &cdn_dp_encoder_funcs,
-			       DRM_MODE_ENCODER_TMDS, NULL);
+	ret = drm_simple_encoder_init(drm_dev, encoder,
+				      DRM_MODE_ENCODER_TMDS);
 	if (ret) {
 		DRM_ERROR("failed to initialize encoder with drm\n");
 		return ret;
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
index 6e1270e45f97..3feff0c45b3f 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
@@ -21,6 +21,7 @@
 #include <drm/bridge/dw_mipi_dsi.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_of.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "rockchip_drm_drv.h"
 #include "rockchip_drm_vop.h"
@@ -789,10 +790,6 @@ dw_mipi_dsi_encoder_helper_funcs = {
 	.disable = dw_mipi_dsi_encoder_disable,
 };
 
-static const struct drm_encoder_funcs dw_mipi_dsi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int rockchip_dsi_drm_create_encoder(struct dw_mipi_dsi_rockchip *dsi,
 					   struct drm_device *drm_dev)
 {
@@ -802,8 +799,7 @@ static int rockchip_dsi_drm_create_encoder(struct
dw_mipi_dsi_rockchip *dsi,
 	encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
 							     dsi->dev->of_node);
 
-	ret = drm_encoder_init(drm_dev, encoder, &dw_mipi_dsi_encoder_funcs,
-			       DRM_MODE_ENCODER_DSI, NULL);
+	ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_DSI);
 	if (ret) {
 		DRM_ERROR("Failed to initialize encoder with drm\n");
 		return ret;
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 7f56d8c3491d..121aa8a63a76 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -14,6 +14,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "rockchip_drm_drv.h"
 #include "rockchip_drm_vop.h"
@@ -237,10 +238,6 @@ dw_hdmi_rockchip_mode_valid(struct drm_connector
*connector,
 	return (valid) ? MODE_OK : MODE_BAD;
 }
 
-static const struct drm_encoder_funcs dw_hdmi_rockchip_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
 {
 }
@@ -546,8 +543,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct
device *master,
 	}
 
 	drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs);
-	drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
 
 	platform_set_drvdata(pdev, hdmi);
 
diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c
b/drivers/gpu/drm/rockchip/inno_hdmi.c
index e5864e823020..7afdc54eb3ec 100644
--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -19,6 +19,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "rockchip_drm_drv.h"
 #include "rockchip_drm_vop.h"
@@ -532,10 +533,6 @@ static struct drm_encoder_helper_funcs
inno_hdmi_encoder_helper_funcs = {
 	.atomic_check = inno_hdmi_encoder_atomic_check,
 };
 
-static struct drm_encoder_funcs inno_hdmi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static enum drm_connector_status
 inno_hdmi_connector_detect(struct drm_connector *connector, bool force)
 {
@@ -617,8 +614,7 @@ static int inno_hdmi_register(struct drm_device *drm, struct
inno_hdmi *hdmi)
 		return -EPROBE_DEFER;
 
 	drm_encoder_helper_add(encoder, &inno_hdmi_encoder_helper_funcs);
-	drm_encoder_init(drm, encoder, &inno_hdmi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
 
 	hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;
 
diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c
b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
index fe203d38664e..1c546c3a8998 100644
--- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c
+++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
@@ -6,6 +6,7 @@
 
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include <linux/clk.h>
 #include <linux/mfd/syscon.h>
@@ -451,10 +452,6 @@ struct drm_encoder_helper_funcs
rk3066_hdmi_encoder_helper_funcs = {
 	.atomic_check = rk3066_hdmi_encoder_atomic_check,
 };
 
-static const struct drm_encoder_funcs rk3066_hdmi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static enum drm_connector_status
 rk3066_hdmi_connector_detect(struct drm_connector *connector, bool force)
 {
@@ -557,8 +554,7 @@ rk3066_hdmi_register(struct drm_device *drm, struct
rk3066_hdmi *hdmi)
 		return -EPROBE_DEFER;
 
 	drm_encoder_helper_add(encoder, &rk3066_hdmi_encoder_helper_funcs);
-	drm_encoder_init(drm, encoder, &rk3066_hdmi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
 
 	hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;
 
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c
b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index 449a62908d21..63f967902c2d 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -16,13 +16,14 @@
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
+
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
-
 #include <drm/drm_dp_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "rockchip_drm_drv.h"
 #include "rockchip_drm_vop.h"
@@ -435,10 +436,6 @@ struct drm_encoder_helper_funcs
px30_lvds_encoder_helper_funcs = {
 	.atomic_check = rockchip_lvds_encoder_atomic_check,
 };
 
-static const struct drm_encoder_funcs rockchip_lvds_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int rk3288_lvds_probe(struct platform_device *pdev,
 			     struct rockchip_lvds *lvds)
 {
@@ -607,8 +604,7 @@ static int rockchip_lvds_bind(struct device *dev, struct
device *master,
 	encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
 							     dev->of_node);
 
-	ret = drm_encoder_init(drm_dev, encoder, &rockchip_lvds_encoder_funcs,
-			       DRM_MODE_ENCODER_LVDS, NULL);
+	ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_LVDS);
 	if (ret < 0) {
 		DRM_DEV_ERROR(drm_dev->dev,
 			      "failed to initialize encoder: %d\n", ret);
diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c
b/drivers/gpu/drm/rockchip/rockchip_rgb.c
index 3e2484985955..6c10caecd0db 100644
--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c
@@ -14,6 +14,7 @@
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "rockchip_drm_drv.h"
 #include "rockchip_drm_vop.h"
@@ -67,10 +68,6 @@ struct drm_encoder_helper_funcs
rockchip_rgb_encoder_helper_funcs = {
 	.atomic_check = rockchip_rgb_encoder_atomic_check,
 };
 
-static const struct drm_encoder_funcs rockchip_rgb_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 				       struct drm_crtc *crtc,
 				       struct drm_device *drm_dev)
@@ -125,8 +122,7 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev,
 	encoder = &rgb->encoder;
 	encoder->possible_crtcs = drm_crtc_mask(crtc);
 
-	ret = drm_encoder_init(drm_dev, encoder, &rockchip_rgb_encoder_funcs,
-			       DRM_MODE_ENCODER_NONE, NULL);
+	ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_NONE);
 	if (ret < 0) {
 		DRM_DEV_ERROR(drm_dev->dev,
 			      "failed to initialize encoder: %d\n", ret);
-- 
2.25.1
The shmobile driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index 75a752d59ef1..03556dbfcafb 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -17,6 +17,7 @@
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_plane_helper.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <drm/drm_vblank.h>
 
 #include "shmob_drm_backlight.h"
@@ -558,15 +559,6 @@ static const struct drm_encoder_helper_funcs
encoder_helper_funcs = {
 	.mode_set = shmob_drm_encoder_mode_set,
 };
 
-static void shmob_drm_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs encoder_funcs = {
-	.destroy = shmob_drm_encoder_destroy,
-};
-
 int shmob_drm_encoder_create(struct shmob_drm_device *sdev)
 {
 	struct drm_encoder *encoder = &sdev->encoder.encoder;
@@ -576,8 +568,8 @@ int shmob_drm_encoder_create(struct shmob_drm_device *sdev)
 
 	encoder->possible_crtcs = 1;
 
-	ret = drm_encoder_init(sdev->ddev, encoder, &encoder_funcs,
-			       DRM_MODE_ENCODER_LVDS, NULL);
+	ret = drm_simple_encoder_init(sdev->ddev, encoder,
+				      DRM_MODE_ENCODER_LVDS);
 	if (ret < 0)
 		return ret;
 
-- 
2.25.1
The ingenic driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 +++---------
 drivers/gpu/drm/sun4i/sun4i_lvds.c     | 12 +++---------
 drivers/gpu/drm/sun4i/sun4i_rgb.c      | 17 +++--------------
 drivers/gpu/drm/sun4i/sun4i_tv.c       | 17 +++--------------
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++---------
 drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c  |  8 ++------
 6 files changed, 17 insertions(+), 61 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index 68d4644ac2dc..e324d7db7b7d 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -22,6 +22,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "sun4i_backend.h"
 #include "sun4i_crtc.h"
@@ -204,10 +205,6 @@ static const struct drm_encoder_helper_funcs
sun4i_hdmi_helper_funcs = {
 	.mode_valid	= sun4i_hdmi_mode_valid,
 };
 
-static const struct drm_encoder_funcs sun4i_hdmi_funcs = {
-	.destroy	= drm_encoder_cleanup,
-};
-
 static int sun4i_hdmi_get_modes(struct drm_connector *connector)
 {
 	struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector);
@@ -611,11 +608,8 @@ static int sun4i_hdmi_bind(struct device *dev, struct
device *master,
 
 	drm_encoder_helper_add(&hdmi->encoder,
 			       &sun4i_hdmi_helper_funcs);
-	ret = drm_encoder_init(drm,
-			       &hdmi->encoder,
-			       &sun4i_hdmi_funcs,
-			       DRM_MODE_ENCODER_TMDS,
-			       NULL);
+	ret = drm_simple_encoder_init(drm, &hdmi->encoder,
+				      DRM_MODE_ENCODER_TMDS);
 	if (ret) {
 		dev_err(dev, "Couldn't initialise the HDMI encoder\n");
 		goto err_put_ddc_i2c;
diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c
b/drivers/gpu/drm/sun4i/sun4i_lvds.c
index 26e5c7ceb8ff..ffda3184aa12 100644
--- a/drivers/gpu/drm/sun4i/sun4i_lvds.c
+++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c
@@ -12,6 +12,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "sun4i_crtc.h"
 #include "sun4i_tcon.h"
@@ -96,10 +97,6 @@ static const struct drm_encoder_helper_funcs
sun4i_lvds_enc_helper_funcs = {
 	.enable		= sun4i_lvds_encoder_enable,
 };
 
-static const struct drm_encoder_funcs sun4i_lvds_enc_funcs = {
-	.destroy	= drm_encoder_cleanup,
-};
-
 int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 {
 	struct drm_encoder *encoder;
@@ -121,11 +118,8 @@ int sun4i_lvds_init(struct drm_device *drm, struct
sun4i_tcon *tcon)
 
 	drm_encoder_helper_add(&lvds->encoder,
 			       &sun4i_lvds_enc_helper_funcs);
-	ret = drm_encoder_init(drm,
-			       &lvds->encoder,
-			       &sun4i_lvds_enc_funcs,
-			       DRM_MODE_ENCODER_LVDS,
-			       NULL);
+	ret = drm_simple_encoder_init(drm, &lvds->encoder,
+				      DRM_MODE_ENCODER_LVDS);
 	if (ret) {
 		dev_err(drm->dev, "Couldn't initialise the lvds encoder\n");
 		goto err_out;
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c
b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index 3b23d5be3cf3..5a7d43939ae6 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -14,6 +14,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "sun4i_crtc.h"
 #include "sun4i_tcon.h"
@@ -188,15 +189,6 @@ static struct drm_encoder_helper_funcs
sun4i_rgb_enc_helper_funcs = {
 	.mode_valid	= sun4i_rgb_mode_valid,
 };
 
-static void sun4i_rgb_enc_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static struct drm_encoder_funcs sun4i_rgb_enc_funcs = {
-	.destroy	= sun4i_rgb_enc_destroy,
-};
-
 int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 {
 	struct drm_encoder *encoder;
@@ -218,11 +210,8 @@ int sun4i_rgb_init(struct drm_device *drm, struct
sun4i_tcon *tcon)
 
 	drm_encoder_helper_add(&rgb->encoder,
 			       &sun4i_rgb_enc_helper_funcs);
-	ret = drm_encoder_init(drm,
-			       &rgb->encoder,
-			       &sun4i_rgb_enc_funcs,
-			       DRM_MODE_ENCODER_NONE,
-			       NULL);
+	ret = drm_simple_encoder_init(drm, &rgb->encoder,
+				      DRM_MODE_ENCODER_NONE);
 	if (ret) {
 		dev_err(drm->dev, "Couldn't initialise the rgb encoder\n");
 		goto err_out;
diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index 39c15282e448..63f4428ac3bf 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -19,6 +19,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "sun4i_crtc.h"
 #include "sun4i_drv.h"
@@ -473,15 +474,6 @@ static struct drm_encoder_helper_funcs
sun4i_tv_helper_funcs = {
 	.mode_set	= sun4i_tv_mode_set,
 };
 
-static void sun4i_tv_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static struct drm_encoder_funcs sun4i_tv_funcs = {
-	.destroy	= sun4i_tv_destroy,
-};
-
 static int sun4i_tv_comp_get_modes(struct drm_connector *connector)
 {
 	int i;
@@ -592,11 +584,8 @@ static int sun4i_tv_bind(struct device *dev, struct device
*master,
 
 	drm_encoder_helper_add(&tv->encoder,
 			       &sun4i_tv_helper_funcs);
-	ret = drm_encoder_init(drm,
-			       &tv->encoder,
-			       &sun4i_tv_funcs,
-			       DRM_MODE_ENCODER_TVDAC,
-			       NULL);
+	ret = drm_simple_encoder_init(drm, &tv->encoder,
+				      DRM_MODE_ENCODER_TVDAC);
 	if (ret) {
 		dev_err(dev, "Couldn't initialise the TV encoder\n");
 		goto err_disable_clk;
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 059939789730..f6c67dd87a05 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -24,6 +24,7 @@
 #include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "sun4i_crtc.h"
 #include "sun4i_tcon.h"
@@ -846,10 +847,6 @@ static const struct drm_encoder_helper_funcs
sun6i_dsi_enc_helper_funcs = {
 	.enable		= sun6i_dsi_encoder_enable,
 };
 
-static const struct drm_encoder_funcs sun6i_dsi_enc_funcs = {
-	.destroy	= drm_encoder_cleanup,
-};
-
 static u32 sun6i_dsi_dcs_build_pkt_hdr(struct sun6i_dsi *dsi,
 				       const struct mipi_dsi_msg *msg)
 {
@@ -1062,11 +1059,8 @@ static int sun6i_dsi_bind(struct device *dev, struct
device *master,
 
 	drm_encoder_helper_add(&dsi->encoder,
 			       &sun6i_dsi_enc_helper_funcs);
-	ret = drm_encoder_init(drm,
-			       &dsi->encoder,
-			       &sun6i_dsi_enc_funcs,
-			       DRM_MODE_ENCODER_DSI,
-			       NULL);
+	ret = drm_simple_encoder_init(drm, &dsi->encoder,
+				      DRM_MODE_ENCODER_DSI);
 	if (ret) {
 		dev_err(dsi->dev, "Couldn't initialise the DSI encoder\n");
 		return ret;
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
index e8a317d5ba19..972682bb8000 100644
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
@@ -10,6 +10,7 @@
 
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_of.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "sun8i_dw_hdmi.h"
 #include "sun8i_tcon_top.h"
@@ -29,10 +30,6 @@ sun8i_dw_hdmi_encoder_helper_funcs = {
 	.mode_set = sun8i_dw_hdmi_encoder_mode_set,
 };
 
-static const struct drm_encoder_funcs sun8i_dw_hdmi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static enum drm_mode_status
 sun8i_dw_hdmi_mode_valid_a83t(struct drm_connector *connector,
 			      const struct drm_display_mode *mode)
@@ -220,8 +217,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct
device *master,
 	}
 
 	drm_encoder_helper_add(encoder, &sun8i_dw_hdmi_encoder_helper_funcs);
-	drm_encoder_init(drm, encoder, &sun8i_dw_hdmi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
 
 	sun8i_hdmi_phy_init(hdmi->phy);
 
-- 
2.25.1
The tegra driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/tegra/drm.h    |  2 --
 drivers/gpu/drm/tegra/dsi.c    | 10 +++-------
 drivers/gpu/drm/tegra/hdmi.c   |  9 +++------
 drivers/gpu/drm/tegra/output.c |  6 +-----
 drivers/gpu/drm/tegra/rgb.c    |  8 ++------
 drivers/gpu/drm/tegra/sor.c    |  8 ++------
 6 files changed, 11 insertions(+), 32 deletions(-)
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index ed99b67deb29..804869799305 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -152,8 +152,6 @@ enum drm_connector_status
 tegra_output_connector_detect(struct drm_connector *connector, bool force);
 void tegra_output_connector_destroy(struct drm_connector *connector);
 
-void tegra_output_encoder_destroy(struct drm_encoder *encoder);
-
 /* from dpaux.c */
 struct drm_dp_aux *drm_dp_aux_find_by_of_node(struct device_node *np);
 enum drm_connector_status drm_dp_aux_detect(struct drm_dp_aux *aux);
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 88b9d64c77bf..76369b128e5d 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -22,6 +22,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "dc.h"
 #include "drm.h"
@@ -824,10 +825,6 @@ static const struct drm_connector_helper_funcs
tegra_dsi_connector_helper_funcs
 	.mode_valid = tegra_dsi_connector_mode_valid,
 };
 
-static const struct drm_encoder_funcs tegra_dsi_encoder_funcs = {
-	.destroy = tegra_output_encoder_destroy,
-};
-
 static void tegra_dsi_unprepare(struct tegra_dsi *dsi)
 {
 	int err;
@@ -1058,9 +1055,8 @@ static int tegra_dsi_init(struct host1x_client *client)
 					 &tegra_dsi_connector_helper_funcs);
 		dsi->output.connector.dpms = DRM_MODE_DPMS_OFF;
 
-		drm_encoder_init(drm, &dsi->output.encoder,
-				 &tegra_dsi_encoder_funcs,
-				 DRM_MODE_ENCODER_DSI, NULL);
+		drm_simple_encoder_init(drm, &dsi->output.encoder,
+					DRM_MODE_ENCODER_DSI);
 		drm_encoder_helper_add(&dsi->output.encoder,
 				       &tegra_dsi_encoder_helper_funcs);
 
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index 6f117628f257..8ec72546f330 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -22,6 +22,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "hda.h"
 #include "hdmi.h"
@@ -1136,10 +1137,6 @@ tegra_hdmi_connector_helper_funcs = {
 	.mode_valid = tegra_hdmi_connector_mode_valid,
 };
 
-static const struct drm_encoder_funcs tegra_hdmi_encoder_funcs = {
-	.destroy = tegra_output_encoder_destroy,
-};
-
 static void tegra_hdmi_encoder_disable(struct drm_encoder *encoder)
 {
 	struct tegra_output *output = encoder_to_output(encoder);
@@ -1445,8 +1442,8 @@ static int tegra_hdmi_init(struct host1x_client *client)
 				 &tegra_hdmi_connector_helper_funcs);
 	hdmi->output.connector.dpms = DRM_MODE_DPMS_OFF;
 
-	drm_encoder_init(drm, &hdmi->output.encoder,
&tegra_hdmi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm, &hdmi->output.encoder,
+				DRM_MODE_ENCODER_TMDS);
 	drm_encoder_helper_add(&hdmi->output.encoder,
 			       &tegra_hdmi_encoder_helper_funcs);
 
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c
index a264259b97a2..e36e5e7c2f69 100644
--- a/drivers/gpu/drm/tegra/output.c
+++ b/drivers/gpu/drm/tegra/output.c
@@ -6,6 +6,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "drm.h"
 #include "dc.h"
@@ -79,11 +80,6 @@ void tegra_output_connector_destroy(struct drm_connector
*connector)
 	drm_connector_cleanup(connector);
 }
 
-void tegra_output_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
 static irqreturn_t hpd_irq(int irq, void *data)
 {
 	struct tegra_output *output = data;
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
index 4be4dfd4a68a..0562a7eb793f 100644
--- a/drivers/gpu/drm/tegra/rgb.c
+++ b/drivers/gpu/drm/tegra/rgb.c
@@ -8,6 +8,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "drm.h"
 #include "dc.h"
@@ -110,10 +111,6 @@ static const struct drm_connector_helper_funcs
tegra_rgb_connector_helper_funcs
 	.mode_valid = tegra_rgb_connector_mode_valid,
 };
 
-static const struct drm_encoder_funcs tegra_rgb_encoder_funcs = {
-	.destroy = tegra_output_encoder_destroy,
-};
-
 static void tegra_rgb_encoder_disable(struct drm_encoder *encoder)
 {
 	struct tegra_output *output = encoder_to_output(encoder);
@@ -281,8 +278,7 @@ int tegra_dc_rgb_init(struct drm_device *drm, struct
tegra_dc *dc)
 				 &tegra_rgb_connector_helper_funcs);
 	output->connector.dpms = DRM_MODE_DPMS_OFF;
 
-	drm_encoder_init(drm, &output->encoder, &tegra_rgb_encoder_funcs,
-			 DRM_MODE_ENCODER_LVDS, NULL);
+	drm_simple_encoder_init(drm, &output->encoder, DRM_MODE_ENCODER_LVDS);
 	drm_encoder_helper_add(&output->encoder,
 			       &tegra_rgb_encoder_helper_funcs);
 
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 81226a4953c1..606cab4f37b2 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -23,6 +23,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_scdc_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "dc.h"
 #include "dp.h"
@@ -1805,10 +1806,6 @@ static const struct drm_connector_helper_funcs
tegra_sor_connector_helper_funcs
 	.mode_valid = tegra_sor_connector_mode_valid,
 };
 
-static const struct drm_encoder_funcs tegra_sor_encoder_funcs = {
-	.destroy = tegra_output_encoder_destroy,
-};
-
 static int
 tegra_sor_encoder_atomic_check(struct drm_encoder *encoder,
 			       struct drm_crtc_state *crtc_state,
@@ -3102,8 +3099,7 @@ static int tegra_sor_init(struct host1x_client *client)
 				 &tegra_sor_connector_helper_funcs);
 	sor->output.connector.dpms = DRM_MODE_DPMS_OFF;
 
-	drm_encoder_init(drm, &sor->output.encoder,
&tegra_sor_encoder_funcs,
-			 encoder, NULL);
+	drm_simple_encoder_init(drm, &sor->output.encoder, encoder);
 	drm_encoder_helper_add(&sor->output.encoder, helpers);
 
 	drm_connector_attach_encoder(&sor->output.connector,
-- 
2.25.1
The tidss driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/tidss/tidss_encoder.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c
b/drivers/gpu/drm/tidss/tidss_encoder.c
index 83785b0a66a9..4c0558286f5e 100644
--- a/drivers/gpu/drm/tidss/tidss_encoder.c
+++ b/drivers/gpu/drm/tidss/tidss_encoder.c
@@ -8,8 +8,9 @@
 
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
-#include <drm/drm_panel.h>
 #include <drm/drm_of.h>
+#include <drm/drm_panel.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "tidss_crtc.h"
 #include "tidss_drv.h"
@@ -59,10 +60,6 @@ static const struct drm_encoder_helper_funcs
encoder_helper_funcs = {
 	.atomic_check = tidss_encoder_atomic_check,
 };
 
-static const struct drm_encoder_funcs encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss,
 					 u32 encoder_type, u32 possible_crtcs)
 {
@@ -75,8 +72,7 @@ struct drm_encoder *tidss_encoder_create(struct tidss_device
*tidss,
 
 	enc->possible_crtcs = possible_crtcs;
 
-	ret = drm_encoder_init(&tidss->ddev, enc, &encoder_funcs,
-			       encoder_type, NULL);
+	ret = drm_simple_encoder_init(&tidss->ddev, enc, encoder_type);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
-- 
2.25.1
The tilcdc driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/tilcdc/tilcdc_external.c | 10 +++-------
 drivers/gpu/drm/tilcdc/tilcdc_panel.c    |  8 ++------
 2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c
b/drivers/gpu/drm/tilcdc/tilcdc_external.c
index 28b7f703236e..b177525588c1 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
@@ -10,6 +10,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_of.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "tilcdc_drv.h"
 #include "tilcdc_external.h"
@@ -83,10 +84,6 @@ int tilcdc_add_component_encoder(struct drm_device *ddev)
 	return 0;
 }
 
-static const struct drm_encoder_funcs tilcdc_external_encoder_funcs = {
-	.destroy	= drm_encoder_cleanup,
-};
-
 static
 int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge)
 {
@@ -131,9 +128,8 @@ int tilcdc_attach_external_device(struct drm_device *ddev)
 	if (!priv->external_encoder)
 		return -ENOMEM;
 
-	ret = drm_encoder_init(ddev, priv->external_encoder,
-			       &tilcdc_external_encoder_funcs,
-			       DRM_MODE_ENCODER_NONE, NULL);
+	ret = drm_simple_encoder_init(ddev, priv->external_encoder,
+				      DRM_MODE_ENCODER_NONE);
 	if (ret) {
 		dev_err(ddev->dev, "drm_encoder_init() failed %d\n", ret);
 		return ret;
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 5584e656b857..12823d60c4e8 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -16,6 +16,7 @@
 #include <drm/drm_connector.h>
 #include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "tilcdc_drv.h"
 #include "tilcdc_panel.h"
@@ -74,10 +75,6 @@ static void panel_encoder_mode_set(struct drm_encoder
*encoder,
 	/* nothing needed */
 }
 
-static const struct drm_encoder_funcs panel_encoder_funcs = {
-		.destroy        = drm_encoder_cleanup,
-};
-
 static const struct drm_encoder_helper_funcs panel_encoder_helper_funcs = {
 		.dpms           = panel_encoder_dpms,
 		.prepare        = panel_encoder_prepare,
@@ -102,8 +99,7 @@ static struct drm_encoder *panel_encoder_create(struct
drm_device *dev,
 	encoder = &panel_encoder->base;
 	encoder->possible_crtcs = 1;
 
-	ret = drm_encoder_init(dev, encoder, &panel_encoder_funcs,
-			DRM_MODE_ENCODER_LVDS, NULL);
+	ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
 	if (ret < 0)
 		goto fail;
 
-- 
2.25.1
The vc4 driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/vc4/vc4_dpi.c  |  8 ++------
 drivers/gpu/drm/vc4/vc4_dsi.c  | 15 +++------------
 drivers/gpu/drm/vc4/vc4_hdmi.c | 17 ++++-------------
 drivers/gpu/drm/vc4/vc4_vec.c  |  8 ++------
 4 files changed, 11 insertions(+), 37 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index 6dfede03396e..a90f2545baee 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -17,6 +17,7 @@
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <linux/clk.h>
 #include <linux/component.h>
 #include <linux/of_graph.h>
@@ -114,10 +115,6 @@ static const struct debugfs_reg32 dpi_regs[] = {
 	VC4_REG32(DPI_ID),
 };
 
-static const struct drm_encoder_funcs vc4_dpi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static void vc4_dpi_encoder_disable(struct drm_encoder *encoder)
 {
 	struct vc4_dpi_encoder *vc4_encoder = to_vc4_dpi_encoder(encoder);
@@ -309,8 +306,7 @@ static int vc4_dpi_bind(struct device *dev, struct device
*master, void *data)
 	if (ret)
 		DRM_ERROR("Failed to turn on core clock: %d\n", ret);
 
-	drm_encoder_init(drm, dpi->encoder, &vc4_dpi_encoder_funcs,
-			 DRM_MODE_ENCODER_DPI, NULL);
+	drm_simple_encoder_init(drm, dpi->encoder, DRM_MODE_ENCODER_DPI);
 	drm_encoder_helper_add(dpi->encoder, &vc4_dpi_encoder_helper_funcs);
 
 	ret = vc4_dpi_init_bridge(dpi);
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index d99b1d526651..eaf276978ee7 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -37,6 +37,7 @@
 #include <drm/drm_of.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
@@ -652,15 +653,6 @@ static const struct debugfs_reg32 dsi1_regs[] = {
 	VC4_REG32(DSI1_ID),
 };
 
-static void vc4_dsi_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs vc4_dsi_encoder_funcs = {
-	.destroy = vc4_dsi_encoder_destroy,
-};
-
 static void vc4_dsi_latch_ulps(struct vc4_dsi *dsi, bool latch)
 {
 	u32 afec0 = DSI_PORT_READ(PHY_AFEC0);
@@ -1615,8 +1607,7 @@ static int vc4_dsi_bind(struct device *dev, struct device
*master, void *data)
 	if (dsi->port == 1)
 		vc4->dsi1 = dsi;
 
-	drm_encoder_init(drm, dsi->encoder, &vc4_dsi_encoder_funcs,
-			 DRM_MODE_ENCODER_DSI, NULL);
+	drm_simple_encoder_init(drm, dsi->encoder, DRM_MODE_ENCODER_DSI);
 	drm_encoder_helper_add(dsi->encoder, &vc4_dsi_encoder_helper_funcs);
 
 	ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL, 0);
@@ -1656,7 +1647,7 @@ static void vc4_dsi_unbind(struct device *dev, struct
device *master,
 	 * normally.
 	 */
 	list_splice_init(&dsi->bridge_chain,
&dsi->encoder->bridge_chain);
-	vc4_dsi_encoder_destroy(dsi->encoder);
+	drm_encoder_cleanup(dsi->encoder);
 
 	if (dsi->port == 1)
 		vc4->dsi1 = NULL;
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index cea18dc15f77..8f956156eb8e 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -34,6 +34,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <linux/clk.h>
 #include <linux/component.h>
 #include <linux/i2c.h>
@@ -306,15 +307,6 @@ static struct drm_connector *vc4_hdmi_connector_init(struct
drm_device *dev,
 	return connector;
 }
 
-static void vc4_hdmi_encoder_destroy(struct drm_encoder *encoder)
-{
-	drm_encoder_cleanup(encoder);
-}
-
-static const struct drm_encoder_funcs vc4_hdmi_encoder_funcs = {
-	.destroy = vc4_hdmi_encoder_destroy,
-};
-
 static int vc4_hdmi_stop_packet(struct drm_encoder *encoder,
 				enum hdmi_infoframe_type type)
 {
@@ -1394,8 +1386,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device
*master, void *data)
 	}
 	pm_runtime_enable(dev);
 
-	drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm, hdmi->encoder, DRM_MODE_ENCODER_TMDS);
 	drm_encoder_helper_add(hdmi->encoder, &vc4_hdmi_encoder_helper_funcs);
 
 	hdmi->connector @@ -1453,7 +1444,7 @@ static int vc4_hdmi_bind(struct
device *dev, struct device *master, void *data)
 	vc4_hdmi_connector_destroy(hdmi->connector);
 #endif
 err_destroy_encoder:
-	vc4_hdmi_encoder_destroy(hdmi->encoder);
+	drm_encoder_cleanup(hdmi->encoder);
 err_unprepare_hsm:
 	clk_disable_unprepare(hdmi->hsm_clock);
 	pm_runtime_disable(dev);
@@ -1472,7 +1463,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct
device *master,
 
 	cec_unregister_adapter(hdmi->cec_adap);
 	vc4_hdmi_connector_destroy(hdmi->connector);
-	vc4_hdmi_encoder_destroy(hdmi->encoder);
+	drm_encoder_cleanup(hdmi->encoder);
 
 	clk_disable_unprepare(hdmi->hsm_clock);
 	pm_runtime_disable(dev);
diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
index 7402bc768664..bd5b8eb58b18 100644
--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -17,6 +17,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <linux/clk.h>
 #include <linux/component.h>
 #include <linux/of_graph.h>
@@ -374,10 +375,6 @@ static struct drm_connector *vc4_vec_connector_init(struct
drm_device *dev,
 	return connector;
 }
 
-static const struct drm_encoder_funcs vc4_vec_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static void vc4_vec_encoder_disable(struct drm_encoder *encoder)
 {
 	struct vc4_vec_encoder *vc4_vec_encoder = to_vc4_vec_encoder(encoder);
@@ -566,8 +563,7 @@ static int vc4_vec_bind(struct device *dev, struct device
*master, void *data)
 
 	pm_runtime_enable(dev);
 
-	drm_encoder_init(drm, vec->encoder, &vc4_vec_encoder_funcs,
-			 DRM_MODE_ENCODER_TVDAC, NULL);
+	drm_simple_encoder_init(drm, vec->encoder, DRM_MODE_ENCODER_TVDAC);
 	drm_encoder_helper_add(vec->encoder, &vc4_vec_encoder_helper_funcs);
 
 	vec->connector = vc4_vec_connector_init(drm, vec);
-- 
2.25.1
The virtgpu driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c
b/drivers/gpu/drm/virtio/virtgpu_display.c
index 2b7e6ae65546..cc7fd957a307 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -30,6 +30,7 @@
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "virtgpu_drv.h"
 
@@ -240,10 +241,6 @@ static const struct drm_connector_funcs
virtio_gpu_connector_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
-static const struct drm_encoder_funcs virtio_gpu_enc_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
 {
 	struct drm_device *dev = vgdev->ddev;
@@ -276,8 +273,7 @@ static int vgdev_output_init(struct virtio_gpu_device
*vgdev, int index)
 	if (vgdev->has_edid)
 		drm_connector_attach_edid_property(connector);
 
-	drm_encoder_init(dev, encoder, &virtio_gpu_enc_funcs,
-			 DRM_MODE_ENCODER_VIRTUAL, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
 	drm_encoder_helper_add(encoder, &virtio_gpu_enc_helper_funcs);
 	encoder->possible_crtcs = 1 << index;
 
-- 
2.25.1
The vkms driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/vkms/vkms_output.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_output.c
b/drivers/gpu/drm/vkms/vkms_output.c
index fb1941a6522c..85afb77e97f0 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -3,6 +3,7 @@
 #include "vkms_drv.h"
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 static void vkms_connector_destroy(struct drm_connector *connector)
 {
@@ -17,10 +18,6 @@ static const struct drm_connector_funcs vkms_connector_funcs
= {
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
-static const struct drm_encoder_funcs vkms_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int vkms_conn_get_modes(struct drm_connector *connector)
 {
 	int count;
@@ -70,8 +67,7 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
 
 	drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
 
-	ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs,
-			       DRM_MODE_ENCODER_VIRTUAL, NULL);
+	ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
 	if (ret) {
 		DRM_ERROR("Failed to init encoder\n");
 		goto err_encoder;
-- 
2.25.1
The writeback code uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/drm_writeback.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
index 43d9e3bb3a94..cefb500c4ed7 100644
--- a/drivers/gpu/drm/drm_writeback.c
+++ b/drivers/gpu/drm/drm_writeback.c
@@ -16,6 +16,7 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_property.h>
+#include <drm/drm_simple_kms_helper.h>
 #include <drm/drm_writeback.h>
 
 /**
@@ -146,10 +147,6 @@ static int create_writeback_properties(struct drm_device
*dev)
 	return 0;
 }
 
-static const struct drm_encoder_funcs drm_writeback_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 /**
  * drm_writeback_connector_init - Initialize a writeback connector and its
properties
  * @dev: DRM device
@@ -191,9 +188,8 @@ int drm_writeback_connector_init(struct drm_device *dev,
 		return PTR_ERR(blob);
 
 	drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
-	ret = drm_encoder_init(dev, &wb_connector->encoder,
-			       &drm_writeback_encoder_funcs,
-			       DRM_MODE_ENCODER_VIRTUAL, NULL);
+	ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
+				      DRM_MODE_ENCODER_VIRTUAL);
 	if (ret)
 		goto fail;
 
-- 
2.25.1
The zte driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/zte/zx_hdmi.c  | 8 ++------
 drivers/gpu/drm/zte/zx_tvenc.c | 8 ++------
 drivers/gpu/drm/zte/zx_vga.c   | 8 ++------
 3 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/zte/zx_hdmi.c b/drivers/gpu/drm/zte/zx_hdmi.c
index b98a1420dcd3..76a16d997a23 100644
--- a/drivers/gpu/drm/zte/zx_hdmi.c
+++ b/drivers/gpu/drm/zte/zx_hdmi.c
@@ -20,6 +20,7 @@
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_print.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include <sound/hdmi-codec.h>
 
@@ -254,10 +255,6 @@ static const struct drm_encoder_helper_funcs
zx_hdmi_encoder_helper_funcs = {
 	.mode_set = zx_hdmi_encoder_mode_set,
 };
 
-static const struct drm_encoder_funcs zx_hdmi_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int zx_hdmi_connector_get_modes(struct drm_connector *connector)
 {
 	struct zx_hdmi *hdmi = to_zx_hdmi(connector);
@@ -313,8 +310,7 @@ static int zx_hdmi_register(struct drm_device *drm, struct
zx_hdmi *hdmi)
 
 	encoder->possible_crtcs = VOU_CRTC_MASK;
 
-	drm_encoder_init(drm, encoder, &zx_hdmi_encoder_funcs,
-			 DRM_MODE_ENCODER_TMDS, NULL);
+	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
 	drm_encoder_helper_add(encoder, &zx_hdmi_encoder_helper_funcs);
 
 	hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;
diff --git a/drivers/gpu/drm/zte/zx_tvenc.c b/drivers/gpu/drm/zte/zx_tvenc.c
index c598b7daf1f1..d8a89ba383bc 100644
--- a/drivers/gpu/drm/zte/zx_tvenc.c
+++ b/drivers/gpu/drm/zte/zx_tvenc.c
@@ -14,6 +14,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "zx_drm_drv.h"
 #include "zx_tvenc_regs.h"
@@ -218,10 +219,6 @@ static const struct drm_encoder_helper_funcs
zx_tvenc_encoder_helper_funcs = {
 	.mode_set = zx_tvenc_encoder_mode_set,
 };
 
-static const struct drm_encoder_funcs zx_tvenc_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int zx_tvenc_connector_get_modes(struct drm_connector *connector)
 {
 	struct zx_tvenc *tvenc = to_zx_tvenc(connector);
@@ -285,8 +282,7 @@ static int zx_tvenc_register(struct drm_device *drm, struct
zx_tvenc *tvenc)
 	 */
 	encoder->possible_crtcs = BIT(1);
 
-	drm_encoder_init(drm, encoder, &zx_tvenc_encoder_funcs,
-			 DRM_MODE_ENCODER_TVDAC, NULL);
+	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TVDAC);
 	drm_encoder_helper_add(encoder, &zx_tvenc_encoder_helper_funcs);
 
 	connector->interlace_allowed = true;
diff --git a/drivers/gpu/drm/zte/zx_vga.c b/drivers/gpu/drm/zte/zx_vga.c
index c4fa3bbaba78..a7ed7f5ca837 100644
--- a/drivers/gpu/drm/zte/zx_vga.c
+++ b/drivers/gpu/drm/zte/zx_vga.c
@@ -14,6 +14,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "zx_drm_drv.h"
 #include "zx_vga_regs.h"
@@ -72,10 +73,6 @@ static const struct drm_encoder_helper_funcs
zx_vga_encoder_helper_funcs = {
 	.disable = zx_vga_encoder_disable,
 };
 
-static const struct drm_encoder_funcs zx_vga_encoder_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int zx_vga_connector_get_modes(struct drm_connector *connector)
 {
 	struct zx_vga *vga = to_zx_vga(connector);
@@ -154,8 +151,7 @@ static int zx_vga_register(struct drm_device *drm, struct
zx_vga *vga)
 
 	encoder->possible_crtcs = VOU_CRTC_MASK;
 
-	ret = drm_encoder_init(drm, encoder, &zx_vga_encoder_funcs,
-			       DRM_MODE_ENCODER_DAC, NULL);
+	ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_DAC);
 	if (ret) {
 		DRM_DEV_ERROR(dev, "failed to init encoder: %d\n", ret);
 		return ret;
-- 
2.25.1
On Thu, Mar 5, 2020 at 8:00 AM Thomas Zimmermann <tzimmermann at suse.de> wrote:> > The vc4 driver uses empty implementations for its encoders. Replace > the code with the generic simple encoder.Acked-by: Eric Anholt <eric at anholt.net>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: mips-randconfig-a001-20200306 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 5.5.0
reproduce:
        wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=5.5.0 make.cross ARCH=mips 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/arc/arcpgu_hdmi.c: In function
'arcpgu_drm_hdmi_init':>> drivers/gpu/drm/arc/arcpgu_hdmi.c:34:8: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
           ^
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/arc/arcpgu_sim.c: In function
'arcpgu_drm_sim_init':>> drivers/gpu/drm/arc/arcpgu_sim.c:68:8: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_VIRTUAL);
           ^
   cc1: some warnings being treated as errors
vim +/drm_simple_encoder_init +34 drivers/gpu/drm/arc/arcpgu_hdmi.c
    15	
    16	int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np)
    17	{
    18		struct drm_encoder *encoder;
    19		struct drm_bridge *bridge;
    20	
    21		int ret = 0;
    22	
    23		encoder = devm_kzalloc(drm->dev, sizeof(*encoder), GFP_KERNEL);
    24		if (encoder == NULL)
    25			return -ENOMEM;
    26	
    27		/* Locate drm bridge from the hdmi encoder DT node */
    28		bridge = of_drm_find_bridge(np);
    29		if (!bridge)
    30			return -EPROBE_DEFER;
    31	
    32		encoder->possible_crtcs = 1;
    33		encoder->possible_clones = 0;
  > 34		ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29264 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/caffcba2/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.5.0
reproduce:
        wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=sparc 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/rockchip/analogix_dp-rockchip.c: In function
'rockchip_dp_drm_create_encoder':>> drivers/gpu/drm/rockchip/analogix_dp-rockchip.c:309:8: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(drm_dev, encoder,
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/rockchip/cdn-dp-core.c: In function
'cdn_dp_bind':>> drivers/gpu/drm/rockchip/cdn-dp-core.c:1030:8: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(drm_dev, encoder,
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c: In function
'dw_hdmi_rockchip_bind':>> drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c:546:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c: In function
'rockchip_dsi_drm_create_encoder':>> drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c:802:8: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_DSI);
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/rockchip/inno_hdmi.c: In function
'inno_hdmi_register':>> drivers/gpu/drm/rockchip/inno_hdmi.c:617:2: error: implicit declaration
of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/rockchip/rockchip_lvds.c: In function
'rockchip_lvds_bind':>> drivers/gpu/drm/rockchip/rockchip_lvds.c:607:8: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_LVDS);
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/rockchip/rockchip_rgb.c: In function
'rockchip_rgb_init':>> drivers/gpu/drm/rockchip/rockchip_rgb.c:125:8: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_NONE);
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/rockchip/rk3066_hdmi.c: In function
'rk3066_hdmi_register':>> drivers/gpu/drm/rockchip/rk3066_hdmi.c:557:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
vim +309 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
   297	
   298	static int rockchip_dp_drm_create_encoder(struct rockchip_dp_device *dp)
   299	{
   300		struct drm_encoder *encoder = &dp->encoder;
   301		struct drm_device *drm_dev = dp->drm_dev;
   302		struct device *dev = dp->dev;
   303		int ret;
   304	
   305		encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
   306								     dev->of_node);
   307		DRM_DEBUG_KMS("possible_crtcs = 0x%x\n",
encoder->possible_crtcs);
   308	
 > 309		ret = drm_simple_encoder_init(drm_dev, encoder,
   310					      DRM_MODE_ENCODER_TMDS);
   311		if (ret) {
   312			DRM_ERROR("failed to initialize encoder with drm\n");
   313			return ret;
   314		}
   315	
   316		drm_encoder_helper_add(encoder, &rockchip_dp_encoder_helper_funcs);
   317	
   318		return 0;
   319	}
   320	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 61637 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/9211d4ed/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm-multi_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0
reproduce:
        wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=arm 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c: In function
'fsl_dcu_drm_encoder_create':>> drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c:33:8: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(fsl_dev->drm, encoder,
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
vim +33 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
    20	
    21	int fsl_dcu_drm_encoder_create(struct fsl_dcu_drm_device *fsl_dev,
    22				       struct drm_crtc *crtc)
    23	{
    24		struct drm_encoder *encoder = &fsl_dev->encoder;
    25		int ret;
    26	
    27		encoder->possible_crtcs = 1;
    28	
    29		/* Use bypass mode for parallel RGB/LVDS encoder */
    30		if (fsl_dev->tcon)
    31			fsl_tcon_bypass_enable(fsl_dev->tcon);
    32	
  > 33		ret = drm_simple_encoder_init(fsl_dev->drm, encoder,
    34					      DRM_MODE_ENCODER_LVDS);
    35		if (ret < 0)
    36			return ret;
    37	
    38		return 0;
    39	}
    40	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 50199 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/a5f68f86/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: mips-randconfig-a001-20200306 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 5.5.0
reproduce:
        wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=5.5.0 make.cross ARCH=mips 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/vkms/vkms_output.c: In function
'vkms_output_init':>> drivers/gpu/drm/vkms/vkms_output.c:70:8: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
           ^
   cc1: some warnings being treated as errors
vim +/drm_simple_encoder_init +70 drivers/gpu/drm/vkms/vkms_output.c
    34	
    35	int vkms_output_init(struct vkms_device *vkmsdev, int index)
    36	{
    37		struct vkms_output *output = &vkmsdev->output;
    38		struct drm_device *dev = &vkmsdev->drm;
    39		struct drm_connector *connector = &output->connector;
    40		struct drm_encoder *encoder = &output->encoder;
    41		struct drm_crtc *crtc = &output->crtc;
    42		struct drm_plane *primary, *cursor = NULL;
    43		int ret;
    44	
    45		primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index);
    46		if (IS_ERR(primary))
    47			return PTR_ERR(primary);
    48	
    49		if (enable_cursor) {
    50			cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, index);
    51			if (IS_ERR(cursor)) {
    52				ret = PTR_ERR(cursor);
    53				goto err_cursor;
    54			}
    55		}
    56	
    57		ret = vkms_crtc_init(dev, crtc, primary, cursor);
    58		if (ret)
    59			goto err_crtc;
    60	
    61		ret = drm_connector_init(dev, connector, &vkms_connector_funcs,
    62					 DRM_MODE_CONNECTOR_VIRTUAL);
    63		if (ret) {
    64			DRM_ERROR("Failed to init connector\n");
    65			goto err_connector;
    66		}
    67	
    68		drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
    69	
  > 70		ret = drm_simple_encoder_init(dev, encoder,
DRM_MODE_ENCODER_VIRTUAL);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29264 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/28d3ddd2/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm-at91_dt_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0
reproduce:
        wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=arm 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu//drm/atmel-hlcdc/atmel_hlcdc_output.c: In function
'atmel_hlcdc_attach_endpoint':>> drivers/gpu//drm/atmel-hlcdc/atmel_hlcdc_output.c:98:8: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(dev, &output->encoder,
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
vim +98 drivers/gpu//drm/atmel-hlcdc/atmel_hlcdc_output.c
    65	
    66	static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int
endpoint)
    67	{
    68		struct atmel_hlcdc_rgb_output *output;
    69		struct device_node *ep;
    70		struct drm_panel *panel;
    71		struct drm_bridge *bridge;
    72		int ret;
    73	
    74		ep = of_graph_get_endpoint_by_regs(dev->dev->of_node, 0,
endpoint);
    75		if (!ep)
    76			return -ENODEV;
    77	
    78		ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint,
    79						  &panel, &bridge);
    80		if (ret) {
    81			of_node_put(ep);
    82			return ret;
    83		}
    84	
    85		output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL);
    86		if (!output) {
    87			of_node_put(ep);
    88			return -ENOMEM;
    89		}
    90	
    91		output->bus_fmt = atmel_hlcdc_of_bus_fmt(ep);
    92		of_node_put(ep);
    93		if (output->bus_fmt < 0) {
    94			dev_err(dev->dev, "endpoint %d: invalid bus width\n",
endpoint);
    95			return -EINVAL;
    96		}
    97	
  > 98		ret = drm_simple_encoder_init(dev, &output->encoder,
    99					      DRM_MODE_ENCODER_NONE);
   100		if (ret)
   101			return ret;
   102	
   103		output->encoder.possible_crtcs = 0x1;
   104	
   105		if (panel) {
   106			bridge = drm_panel_bridge_add_typed(panel,
   107							    DRM_MODE_CONNECTOR_Unknown);
   108			if (IS_ERR(bridge))
   109				return PTR_ERR(bridge);
   110		}
   111	
   112		if (bridge) {
   113			ret = drm_bridge_attach(&output->encoder, bridge, NULL, 0);
   114			if (!ret)
   115				return 0;
   116	
   117			if (panel)
   118				drm_panel_bridge_remove(bridge);
   119		}
   120	
   121		drm_encoder_cleanup(&output->encoder);
   122	
   123		return ret;
   124	}
   125	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 26878 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/d221e89b/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/gma500/psb_intel_lvds.c: In function
'psb_intel_lvds_init':>> drivers/gpu/drm/gma500/psb_intel_lvds.c:676:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/cdv_intel_crt.c: In function
'cdv_intel_crt_init':>> drivers/gpu/drm/gma500/cdv_intel_crt.c:267:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/cdv_intel_hdmi.c: In function
'cdv_hdmi_init':>> drivers/gpu/drm/gma500/cdv_intel_hdmi.c:315:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/cdv_intel_dp.c: In function
'cdv_intel_dp_init':>> drivers/gpu/drm/gma500/cdv_intel_dp.c:2010:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/cdv_intel_lvds.c: In function
'cdv_intel_lvds_init':>> drivers/gpu/drm/gma500/cdv_intel_lvds.c:611:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/oaktrail_lvds.c: In function
'oaktrail_lvds_init':>> drivers/gpu/drm/gma500/oaktrail_lvds.c:316:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/oaktrail_hdmi.c: In function
'oaktrail_hdmi_init':>> drivers/gpu/drm/gma500/oaktrail_hdmi.c:646:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/gma500/mdfld_dsi_dpi.c: In function
'mdfld_dsi_dpi_init':>> drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:998:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
vim +676 drivers/gpu/drm/gma500/psb_intel_lvds.c
   625	
   626	/**
   627	 * psb_intel_lvds_init - setup LVDS connectors on this device
   628	 * @dev: drm device
   629	 *
   630	 * Create the connector, register the LVDS DDC bus, and try to figure out
what
   631	 * modes we can display on the LVDS panel (if present).
   632	 */
   633	void psb_intel_lvds_init(struct drm_device *dev,
   634				 struct psb_intel_mode_device *mode_dev)
   635	{
   636		struct gma_encoder *gma_encoder;
   637		struct gma_connector *gma_connector;
   638		struct psb_intel_lvds_priv *lvds_priv;
   639		struct drm_connector *connector;
   640		struct drm_encoder *encoder;
   641		struct drm_display_mode *scan;	/* *modes, *bios_mode; */
   642		struct drm_crtc *crtc;
   643		struct drm_psb_private *dev_priv = dev->dev_private;
   644		u32 lvds;
   645		int pipe;
   646	
   647		gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
   648		if (!gma_encoder) {
   649			dev_err(dev->dev, "gma_encoder allocation error\n");
   650			return;
   651		}
   652	
   653		gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
   654		if (!gma_connector) {
   655			dev_err(dev->dev, "gma_connector allocation error\n");
   656			goto failed_encoder;
   657		}
   658	
   659		lvds_priv = kzalloc(sizeof(struct psb_intel_lvds_priv), GFP_KERNEL);
   660		if (!lvds_priv) {
   661			dev_err(dev->dev, "LVDS private allocation error\n");
   662			goto failed_connector;
   663		}
   664	
   665		gma_encoder->dev_priv = lvds_priv;
   666	
   667		connector = &gma_connector->base;
   668		gma_connector->save = psb_intel_lvds_save;
   669		gma_connector->restore = psb_intel_lvds_restore;
   670	
   671		encoder = &gma_encoder->base;
   672		drm_connector_init(dev, connector,
   673				   &psb_intel_lvds_connector_funcs,
   674				   DRM_MODE_CONNECTOR_LVDS);
   675	
 > 676		drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS);
   677	
   678		gma_connector_attach_encoder(gma_connector, gma_encoder);
   679		gma_encoder->type = INTEL_OUTPUT_LVDS;
   680	
   681		drm_encoder_helper_add(encoder, &psb_intel_lvds_helper_funcs);
   682		drm_connector_helper_add(connector,
   683					 &psb_intel_lvds_connector_helper_funcs);
   684		connector->display_info.subpixel_order = SubPixelHorizontalRGB;
   685		connector->interlace_allowed = false;
   686		connector->doublescan_allowed = false;
   687	
   688		/*Attach connector properties*/
   689		drm_object_attach_property(&connector->base,
   690					      dev->mode_config.scaling_mode_property,
   691					      DRM_MODE_SCALE_FULLSCREEN);
   692		drm_object_attach_property(&connector->base,
   693					      dev_priv->backlight_property,
   694					      BRIGHTNESS_MAX_LEVEL);
   695	
   696		/*
   697		 * Set up I2C bus
   698		 * FIXME: distroy i2c_bus when exit
   699		 */
   700		lvds_priv->i2c_bus = psb_intel_i2c_create(dev, GPIOB,
"LVDSBLC_B");
   701		if (!lvds_priv->i2c_bus) {
   702			dev_printk(KERN_ERR,
   703				&dev->pdev->dev, "I2C bus registration
failed.\n");
   704			goto failed_blc_i2c;
   705		}
   706		lvds_priv->i2c_bus->slave_addr = 0x2C;
   707		dev_priv->lvds_i2c_bus =  lvds_priv->i2c_bus;
   708	
   709		/*
   710		 * LVDS discovery:
   711		 * 1) check for EDID on DDC
   712		 * 2) check for VBT data
   713		 * 3) check to see if LVDS is already on
   714		 *    if none of the above, no panel
   715		 * 4) make sure lid is open
   716		 *    if closed, act like it's not there for now
   717		 */
   718	
   719		/* Set up the DDC bus. */
   720		lvds_priv->ddc_bus = psb_intel_i2c_create(dev, GPIOC,
"LVDSDDC_C");
   721		if (!lvds_priv->ddc_bus) {
   722			dev_printk(KERN_ERR, &dev->pdev->dev,
   723				   "DDC bus registration " "failed.\n");
   724			goto failed_ddc;
   725		}
   726	
   727		/*
   728		 * Attempt to get the fixed panel mode from DDC.  Assume that the
   729		 * preferred mode is the right one.
   730		 */
   731		mutex_lock(&dev->mode_config.mutex);
   732		psb_intel_ddc_get_modes(connector,
&lvds_priv->ddc_bus->adapter);
   733		list_for_each_entry(scan, &connector->probed_modes, head) {
   734			if (scan->type & DRM_MODE_TYPE_PREFERRED) {
   735				mode_dev->panel_fixed_mode    736				    drm_mode_duplicate(dev,
scan);
   737				DRM_DEBUG_KMS("Using mode from DDC\n");
   738				goto out;	/* FIXME: check for quirks */
   739			}
   740		}
   741	
   742		/* Failed to get EDID, what about VBT? do we need this? */
   743		if (dev_priv->lfp_lvds_vbt_mode) {
   744			mode_dev->panel_fixed_mode    745				drm_mode_duplicate(dev,
dev_priv->lfp_lvds_vbt_mode);
   746	
   747			if (mode_dev->panel_fixed_mode) {
   748				mode_dev->panel_fixed_mode->type |   749				
DRM_MODE_TYPE_PREFERRED;
   750				DRM_DEBUG_KMS("Using mode from VBT\n");
   751				goto out;
   752			}
   753		}
   754	
   755		/*
   756		 * If we didn't get EDID, try checking if the panel is already
turned
   757		 * on.	If so, assume that whatever is currently programmed is the
   758		 * correct mode.
   759		 */
   760		lvds = REG_READ(LVDS);
   761		pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0;
   762		crtc = psb_intel_get_crtc_from_pipe(dev, pipe);
   763	
   764		if (crtc && (lvds & LVDS_PORT_EN)) {
   765			mode_dev->panel_fixed_mode    766			    psb_intel_crtc_mode_get(dev,
crtc);
   767			if (mode_dev->panel_fixed_mode) {
   768				mode_dev->panel_fixed_mode->type |   769				   
DRM_MODE_TYPE_PREFERRED;
   770				DRM_DEBUG_KMS("Using pre-programmed mode\n");
   771				goto out;	/* FIXME: check for quirks */
   772			}
   773		}
   774	
   775		/* If we still don't have a mode after all that, give up. */
   776		if (!mode_dev->panel_fixed_mode) {
   777			dev_err(dev->dev, "Found no modes on the lvds, ignoring the
LVDS\n");
   778			goto failed_find;
   779		}
   780	
   781		/*
   782		 * Blacklist machines with BIOSes that list an LVDS panel without
   783		 * actually having one.
   784		 */
   785	out:
   786		mutex_unlock(&dev->mode_config.mutex);
   787		drm_connector_register(connector);
   788		return;
   789	
   790	failed_find:
   791		mutex_unlock(&dev->mode_config.mutex);
   792		psb_intel_i2c_destroy(lvds_priv->ddc_bus);
   793	failed_ddc:
   794		psb_intel_i2c_destroy(lvds_priv->i2c_bus);
   795	failed_blc_i2c:
   796		drm_encoder_cleanup(encoder);
   797		drm_connector_cleanup(connector);
   798	failed_connector:
   799		kfree(gma_connector);
   800	failed_encoder:
   801		kfree(gma_encoder);
   802	}
   803	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 72615 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/70137678/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/drm_writeback.c: In function
'drm_writeback_connector_init':>> drivers/gpu/drm/drm_writeback.c:191:8: error: implicit declaration of
function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
vim +191 drivers/gpu/drm/drm_writeback.c
   149	
   150	/**
   151	 * drm_writeback_connector_init - Initialize a writeback connector and
its properties
   152	 * @dev: DRM device
   153	 * @wb_connector: Writeback connector to initialize
   154	 * @con_funcs: Connector funcs vtable
   155	 * @enc_helper_funcs: Encoder helper funcs vtable to be used by the
internal encoder
   156	 * @formats: Array of supported pixel formats for the writeback engine
   157	 * @n_formats: Length of the formats array
   158	 *
   159	 * This function creates the writeback-connector-specific properties if
they
   160	 * have not been already created, initializes the connector as
   161	 * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the
property
   162	 * values. It will also create an internal encoder associated with the
   163	 * drm_writeback_connector and set it to use the @enc_helper_funcs vtable
for
   164	 * the encoder helper.
   165	 *
   166	 * Drivers should always use this function instead of
drm_connector_init() to
   167	 * set up writeback connectors.
   168	 *
   169	 * Returns: 0 on success, or a negative error code
   170	 */
   171	int drm_writeback_connector_init(struct drm_device *dev,
   172					 struct drm_writeback_connector *wb_connector,
   173					 const struct drm_connector_funcs *con_funcs,
   174					 const struct drm_encoder_helper_funcs *enc_helper_funcs,
   175					 const u32 *formats, int n_formats)
   176	{
   177		struct drm_property_blob *blob;
   178		struct drm_connector *connector = &wb_connector->base;
   179		struct drm_mode_config *config = &dev->mode_config;
   180		int ret = create_writeback_properties(dev);
   181	
   182		if (ret != 0)
   183			return ret;
   184	
   185		blob = drm_property_create_blob(dev, n_formats * sizeof(*formats),
   186						formats);
   187		if (IS_ERR(blob))
   188			return PTR_ERR(blob);
   189	
   190		drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
 > 191		ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
   192					      DRM_MODE_ENCODER_VIRTUAL);
   193		if (ret)
   194			goto fail;
   195	
   196		connector->interlace_allowed = 0;
   197	
   198		ret = drm_connector_init(dev, connector, con_funcs,
   199					 DRM_MODE_CONNECTOR_WRITEBACK);
   200		if (ret)
   201			goto connector_fail;
   202	
   203		ret = drm_connector_attach_encoder(connector,
   204							&wb_connector->encoder);
   205		if (ret)
   206			goto attach_fail;
   207	
   208		INIT_LIST_HEAD(&wb_connector->job_queue);
   209		spin_lock_init(&wb_connector->job_lock);
   210	
   211		wb_connector->fence_context = dma_fence_context_alloc(1);
   212		spin_lock_init(&wb_connector->fence_lock);
   213		snprintf(wb_connector->timeline_name,
   214			 sizeof(wb_connector->timeline_name),
   215			 "CONNECTOR:%d-%s", connector->base.id,
connector->name);
   216	
   217		drm_object_attach_property(&connector->base,
   218					   config->writeback_out_fence_ptr_property, 0);
   219	
   220		drm_object_attach_property(&connector->base,
   221					   config->writeback_fb_id_property, 0);
   222	
   223		drm_object_attach_property(&connector->base,
   224					   config->writeback_pixel_formats_property,
   225					   blob->base.id);
   226		wb_connector->pixel_formats_blob_ptr = blob;
   227	
   228		return 0;
   229	
   230	attach_fail:
   231		drm_connector_cleanup(connector);
   232	connector_fail:
   233		drm_encoder_cleanup(&wb_connector->encoder);
   234	fail:
   235		drm_property_blob_put(blob);
   236		return ret;
   237	}
   238	EXPORT_SYMBOL(drm_writeback_connector_init);
   239	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29068 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/a4fbdefd/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 7.5.0
reproduce:
        wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=m68k 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/exynos/exynos_drm_dpi.c: In function
'exynos_dpi_bind':>> drivers/gpu/drm/exynos/exynos_drm_dpi.c:201:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/exynos/exynos_dp.c: In function
'exynos_dp_bind':>> drivers/gpu/drm/exynos/exynos_dp.c:174:2: error: implicit declaration
of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   cc1: some warnings being treated as errors
vim +201 drivers/gpu/drm/exynos/exynos_drm_dpi.c
   196	
   197	int exynos_dpi_bind(struct drm_device *dev, struct drm_encoder *encoder)
   198	{
   199		int ret;
   200	
 > 201		drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS);
   202	
   203		drm_encoder_helper_add(encoder, &exynos_dpi_encoder_helper_funcs);
   204	
   205		ret = exynos_drm_set_possible_crtcs(encoder, EXYNOS_DISPLAY_TYPE_LCD);
   206		if (ret < 0)
   207			return ret;
   208	
   209		ret = exynos_dpi_create_connector(encoder);
   210		if (ret) {
   211			DRM_DEV_ERROR(encoder_to_dpi(encoder)->dev,
   212				      "failed to create connector ret = %d\n", ret);
   213			drm_encoder_cleanup(encoder);
   214			return ret;
   215		}
   216	
   217		return 0;
   218	}
   219	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 53261 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/e3bec5de/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: mips-randconfig-a001-20200306 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 5.5.0
reproduce:
        wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=5.5.0 make.cross ARCH=mips 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/drm_writeback.c: In function
'drm_writeback_connector_init':>> drivers/gpu/drm/drm_writeback.c:191:8: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
           ^
   cc1: some warnings being treated as errors
vim +/drm_simple_encoder_init +191 drivers/gpu/drm/drm_writeback.c
   149	
   150	/**
   151	 * drm_writeback_connector_init - Initialize a writeback connector and
its properties
   152	 * @dev: DRM device
   153	 * @wb_connector: Writeback connector to initialize
   154	 * @con_funcs: Connector funcs vtable
   155	 * @enc_helper_funcs: Encoder helper funcs vtable to be used by the
internal encoder
   156	 * @formats: Array of supported pixel formats for the writeback engine
   157	 * @n_formats: Length of the formats array
   158	 *
   159	 * This function creates the writeback-connector-specific properties if
they
   160	 * have not been already created, initializes the connector as
   161	 * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the
property
   162	 * values. It will also create an internal encoder associated with the
   163	 * drm_writeback_connector and set it to use the @enc_helper_funcs vtable
for
   164	 * the encoder helper.
   165	 *
   166	 * Drivers should always use this function instead of
drm_connector_init() to
   167	 * set up writeback connectors.
   168	 *
   169	 * Returns: 0 on success, or a negative error code
   170	 */
   171	int drm_writeback_connector_init(struct drm_device *dev,
   172					 struct drm_writeback_connector *wb_connector,
   173					 const struct drm_connector_funcs *con_funcs,
   174					 const struct drm_encoder_helper_funcs *enc_helper_funcs,
   175					 const u32 *formats, int n_formats)
   176	{
   177		struct drm_property_blob *blob;
   178		struct drm_connector *connector = &wb_connector->base;
   179		struct drm_mode_config *config = &dev->mode_config;
   180		int ret = create_writeback_properties(dev);
   181	
   182		if (ret != 0)
   183			return ret;
   184	
   185		blob = drm_property_create_blob(dev, n_formats * sizeof(*formats),
   186						formats);
   187		if (IS_ERR(blob))
   188			return PTR_ERR(blob);
   189	
   190		drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
 > 191		ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
   192					      DRM_MODE_ENCODER_VIRTUAL);
   193		if (ret)
   194			goto fail;
   195	
   196		connector->interlace_allowed = 0;
   197	
   198		ret = drm_connector_init(dev, connector, con_funcs,
   199					 DRM_MODE_CONNECTOR_WRITEBACK);
   200		if (ret)
   201			goto connector_fail;
   202	
   203		ret = drm_connector_attach_encoder(connector,
   204							&wb_connector->encoder);
   205		if (ret)
   206			goto attach_fail;
   207	
   208		INIT_LIST_HEAD(&wb_connector->job_queue);
   209		spin_lock_init(&wb_connector->job_lock);
   210	
   211		wb_connector->fence_context = dma_fence_context_alloc(1);
   212		spin_lock_init(&wb_connector->fence_lock);
   213		snprintf(wb_connector->timeline_name,
   214			 sizeof(wb_connector->timeline_name),
   215			 "CONNECTOR:%d-%s", connector->base.id,
connector->name);
   216	
   217		drm_object_attach_property(&connector->base,
   218					   config->writeback_out_fence_ptr_property, 0);
   219	
   220		drm_object_attach_property(&connector->base,
   221					   config->writeback_fb_id_property, 0);
   222	
   223		drm_object_attach_property(&connector->base,
   224					   config->writeback_pixel_formats_property,
   225					   blob->base.id);
   226		wb_connector->pixel_formats_blob_ptr = blob;
   227	
   228		return 0;
   229	
   230	attach_fail:
   231		drm_connector_cleanup(connector);
   232	connector_fail:
   233		drm_encoder_cleanup(&wb_connector->encoder);
   234	fail:
   235		drm_property_blob_put(blob);
   236		return ret;
   237	}
   238	EXPORT_SYMBOL(drm_writeback_connector_init);
   239	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29264 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/354b29f1/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project
a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/exynos/exynos_drm_dsi.c:1705:2: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
           ^
   drivers/gpu/drm/exynos/exynos_drm_dsi.c:1705:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/exynos/exynos_hdmi.c:1851:2: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
           ^
   drivers/gpu/drm/exynos/exynos_hdmi.c:1851:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
vim +/drm_simple_encoder_init +1705 drivers/gpu/drm/exynos/exynos_drm_dsi.c
  1695	
  1696	static int exynos_dsi_bind(struct device *dev, struct device *master,
  1697					void *data)
  1698	{
  1699		struct drm_encoder *encoder = dev_get_drvdata(dev);
  1700		struct exynos_dsi *dsi = encoder_to_dsi(encoder);
  1701		struct drm_device *drm_dev = data;
  1702		struct drm_bridge *in_bridge;
  1703		int ret;
  1704	> 1705		drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
  1706	
  1707		drm_encoder_helper_add(encoder, &exynos_dsi_encoder_helper_funcs);
  1708	
  1709		ret = exynos_drm_set_possible_crtcs(encoder, EXYNOS_DISPLAY_TYPE_LCD);
  1710		if (ret < 0)
  1711			return ret;
  1712	
  1713		if (dsi->in_bridge_node) {
  1714			in_bridge = of_drm_find_bridge(dsi->in_bridge_node);
  1715			if (in_bridge)
  1716				drm_bridge_attach(encoder, in_bridge, NULL, 0);
  1717		}
  1718	
  1719		return mipi_dsi_host_register(&dsi->dsi_host);
  1720	}
  1721	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47744 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/ce2f57f5/attachment-0001.gz>
kbuild test robot
2020-Mar-06  06:16 UTC
[PATCH 06/22] drm/hisilicon/kirin: Use simple encoder
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project
a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpu//drm/hisilicon/kirin/dw_drm_dsi.c:713:8: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm_dev, encoder,
DRM_MODE_ENCODER_DSI);
                 ^
   drivers/gpu//drm/hisilicon/kirin/dw_drm_dsi.c:713:8: note: did you mean
'drm_i2c_encoder_init'?
   include/drm/drm_encoder_slave.h:104:5: note: 'drm_i2c_encoder_init'
declared here
   int drm_i2c_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
vim +/drm_simple_encoder_init +713 drivers/gpu//drm/hisilicon/kirin/dw_drm_dsi.c
   699	
   700	static int dw_drm_encoder_init(struct device *dev,
   701				       struct drm_device *drm_dev,
   702				       struct drm_encoder *encoder)
   703	{
   704		int ret;
   705		u32 crtc_mask = drm_of_find_possible_crtcs(drm_dev, dev->of_node);
   706	
   707		if (!crtc_mask) {
   708			DRM_ERROR("failed to find crtc mask\n");
   709			return -EINVAL;
   710		}
   711	
   712		encoder->possible_crtcs = crtc_mask;
 > 713		ret = drm_simple_encoder_init(drm_dev, encoder,
DRM_MODE_ENCODER_DSI);
   714		if (ret) {
   715			DRM_ERROR("failed to init dsi encoder\n");
   716			return ret;
   717		}
   718	
   719		drm_encoder_helper_add(encoder, &dw_encoder_helper_funcs);
   720	
   721		return 0;
   722	}
   723	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47744 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/43de0946/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project
a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/i2c/tda998x_drv.c:2018:8: error: implicit declaration
of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm, &priv->encoder,
                 ^
   drivers/gpu/drm/i2c/tda998x_drv.c:2018:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
vim +/drm_simple_encoder_init +2018 drivers/gpu/drm/i2c/tda998x_drv.c
  2000	
  2001	static int tda998x_encoder_init(struct device *dev, struct drm_device
*drm)
  2002	{
  2003		struct tda998x_priv *priv = dev_get_drvdata(dev);
  2004		u32 crtcs = 0;
  2005		int ret;
  2006	
  2007		if (dev->of_node)
  2008			crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
  2009	
  2010		/* If no CRTCs were found, fall back to our old behaviour */
  2011		if (crtcs == 0) {
  2012			dev_warn(dev, "Falling back to first CRTC\n");
  2013			crtcs = 1 << 0;
  2014		}
  2015	
  2016		priv->encoder.possible_crtcs = crtcs;
  2017	> 2018		ret = drm_simple_encoder_init(drm, &priv->encoder,
  2019					      DRM_MODE_ENCODER_TMDS);
  2020		if (ret)
  2021			goto err_encoder;
  2022	
  2023		ret = drm_bridge_attach(&priv->encoder, &priv->bridge,
NULL, 0);
  2024		if (ret)
  2025			goto err_bridge;
  2026	
  2027		return 0;
  2028	
  2029	err_bridge:
  2030		drm_encoder_cleanup(&priv->encoder);
  2031	err_encoder:
  2032		return ret;
  2033	}
  2034	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47744 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/c5d989d3/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project
a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpu//drm/rcar-du/rcar_du_encoder.c:107:8: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(rcdu->ddev, encoder,
                 ^
   drivers/gpu//drm/rcar-du/rcar_du_encoder.c:107:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
vim +/drm_simple_encoder_init +107 drivers/gpu//drm/rcar-du/rcar_du_encoder.c
    46	
    47	int rcar_du_encoder_init(struct rcar_du_device *rcdu,
    48				 enum rcar_du_output output,
    49				 struct device_node *enc_node)
    50	{
    51		struct rcar_du_encoder *renc;
    52		struct drm_encoder *encoder;
    53		struct drm_bridge *bridge;
    54		int ret;
    55	
    56		renc = devm_kzalloc(rcdu->dev, sizeof(*renc), GFP_KERNEL);
    57		if (renc == NULL)
    58			return -ENOMEM;
    59	
    60		rcdu->encoders[output] = renc;
    61		renc->output = output;
    62		encoder = rcar_encoder_to_drm_encoder(renc);
    63	
    64		dev_dbg(rcdu->dev, "initializing encoder %pOF for output
%u\n",
    65			enc_node, output);
    66	
    67		/*
    68		 * Locate the DRM bridge from the DT node. For the DPAD outputs, if the
    69		 * DT node has a single port, assume that it describes a panel and
    70		 * create a panel bridge.
    71		 */
    72		if ((output == RCAR_DU_OUTPUT_DPAD0 ||
    73		     output == RCAR_DU_OUTPUT_DPAD1) &&
    74		    rcar_du_encoder_count_ports(enc_node) == 1) {
    75			struct drm_panel *panel = of_drm_find_panel(enc_node);
    76	
    77			if (IS_ERR(panel)) {
    78				ret = PTR_ERR(panel);
    79				goto done;
    80			}
    81	
    82			bridge = devm_drm_panel_bridge_add_typed(rcdu->dev, panel,
    83								 DRM_MODE_CONNECTOR_DPI);
    84			if (IS_ERR(bridge)) {
    85				ret = PTR_ERR(bridge);
    86				goto done;
    87			}
    88		} else {
    89			bridge = of_drm_find_bridge(enc_node);
    90			if (!bridge) {
    91				ret = -EPROBE_DEFER;
    92				goto done;
    93			}
    94		}
    95	
    96		/*
    97		 * On Gen3 skip the LVDS1 output if the LVDS1 encoder is used as a
    98		 * companion for LVDS0 in dual-link mode.
    99		 */
   100		if (rcdu->info->gen >= 3 && output ==
RCAR_DU_OUTPUT_LVDS1) {
   101			if (rcar_lvds_dual_link(bridge)) {
   102				ret = -ENOLINK;
   103				goto done;
   104			}
   105		}
   106	
 > 107		ret = drm_simple_encoder_init(rcdu->ddev, encoder,
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47744 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/8f960c9f/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project
a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/rockchip/analogix_dp-rockchip.c:309:8: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm_dev, encoder,
                 ^
   drivers/gpu/drm/rockchip/analogix_dp-rockchip.c:309:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/rockchip/cdn-dp-core.c:1030:8: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm_dev, encoder,
                 ^
   drivers/gpu/drm/rockchip/cdn-dp-core.c:1030:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c:546:2: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
           ^
   drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c:546:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c:802:8: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm_dev, encoder,
DRM_MODE_ENCODER_DSI);
                 ^
   drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c:802:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/rockchip/inno_hdmi.c:617:2: error: implicit declaration
of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
           ^
   drivers/gpu/drm/rockchip/inno_hdmi.c:617:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
vim +/drm_simple_encoder_init +309
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
   297	
   298	static int rockchip_dp_drm_create_encoder(struct rockchip_dp_device *dp)
   299	{
   300		struct drm_encoder *encoder = &dp->encoder;
   301		struct drm_device *drm_dev = dp->drm_dev;
   302		struct device *dev = dp->dev;
   303		int ret;
   304	
   305		encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
   306								     dev->of_node);
   307		DRM_DEBUG_KMS("possible_crtcs = 0x%x\n",
encoder->possible_crtcs);
   308	
 > 309		ret = drm_simple_encoder_init(drm_dev, encoder,
   310					      DRM_MODE_ENCODER_TMDS);
   311		if (ret) {
   312			DRM_ERROR("failed to initialize encoder with drm\n");
   313			return ret;
   314		}
   315	
   316		drm_encoder_helper_add(encoder, &rockchip_dp_encoder_helper_funcs);
   317	
   318		return 0;
   319	}
   320	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47744 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/f683b9dd/attachment-0001.gz>
Daniel Vetter
2020-Mar-06  10:56 UTC
[PATCH 00/22] drm: Convert drivers to drm_simple_encoder_init()
On Thu, Mar 05, 2020 at 04:59:28PM +0100, Thomas Zimmermann wrote:> A call to drm_simple_encoder_init() initializes an encoder without > further functionality. It only provides the destroy callback to > cleanup the encoder's state. Only few drivers implement more > sophisticated encoders than that. Most drivers implement such a > simple encoder and can use drm_simple_encoder_init() instead. > > The patchset converts drivers where the encoder's instance is > embedded in a larger data structure. The driver releases the > memory during cleanup. Each patch replaces drm_encoder_init() with > drm_simple_encoder_init() and removes the (now unused) driver's > encoder functions. > > While the patchset is fairly large, the indiviual patches are self- > contained and can be merged independently from each other. The > simple-encoder functionality is currently in drm-misc-next, where > these patches could go as well. > > Future directions: There's another common case where the driver > calls kzalloc() plus drm_encoder_init(). Such drivers are not > handled by this patchset. The plan here is to use a simple encoder > with either managed memory allocation (once it's merged), or embed > the encoder in a larger data structure and drop kzalloc() entirely. > > The patchset has been compile-tested on x86-64, aarch64 and arm.So from a cursory look all these drivers get it wrong and devm_kzalloc their encoders. But I guess simplifying stuff like you do here will at least give us a nice list of things to look at once we get to the drmm_simple_encoder_init version of all this. On the series: Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch>> > Thomas Zimmermann (22): > drm/arc: Use simple encoder > drm/atmel-hlcdc: Use simple encoder > drm/exynos: Use simple encoder > drm/fsl-dcu: Use simple encoder > drm/gma500: Use simple encoder > drm/hisilicon/kirin: Use simple encoder > drm/i2c/tda998x: Use simple encoder > drm/imx: Use simple encoder > drm/ingenic: Use simple encoder > drm/mediatek: Use simple encoder > drm/rcar-du: Use simple encoder > drm/rockchip: Use simple encoder > drm/shmobile: Use simple encoder > drm/sun4i: Use simple encoder > drm/tegra: Use simple encoder > drm/tidss: Use simple encoder > drm/tilcdc: Use simple encoder > drm/vc4: Use simple encoder > drm/virtgpu: Use simple encoder > drm/vkms: Use simple encoder > drm/writeback: Use simple encoder > drm/zte: Use simple encoder > > drivers/gpu/drm/arc/arcpgu_hdmi.c | 10 +++------- > drivers/gpu/drm/arc/arcpgu_sim.c | 8 ++------ > .../gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ++++-------- > drivers/gpu/drm/drm_writeback.c | 10 +++------- > drivers/gpu/drm/exynos/exynos_dp.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_hdmi.c | 8 ++------ > drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 14 +++----------- > drivers/gpu/drm/gma500/cdv_intel_crt.c | 14 +++----------- > drivers/gpu/drm/gma500/cdv_intel_dp.c | 16 +++------------- > drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 4 ++-- > drivers/gpu/drm/gma500/cdv_intel_lvds.c | 17 +++-------------- > drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 7 +++---- > drivers/gpu/drm/gma500/mdfld_output.h | 1 - > drivers/gpu/drm/gma500/mdfld_tmd_vid.c | 6 ------ > drivers/gpu/drm/gma500/mdfld_tpo_vid.c | 6 ------ > drivers/gpu/drm/gma500/oaktrail_hdmi.c | 14 ++------------ > drivers/gpu/drm/gma500/oaktrail_lvds.c | 5 +++-- > drivers/gpu/drm/gma500/psb_intel_drv.h | 1 - > drivers/gpu/drm/gma500/psb_intel_lvds.c | 18 +++--------------- > drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c | 5 ----- > drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 8 ++------ > drivers/gpu/drm/i2c/tda998x_drv.c | 14 +++----------- > drivers/gpu/drm/imx/dw_hdmi-imx.c | 8 ++------ > drivers/gpu/drm/imx/imx-drm-core.c | 6 ------ > drivers/gpu/drm/imx/imx-drm.h | 1 - > drivers/gpu/drm/imx/imx-ldb.c | 8 ++------ > drivers/gpu/drm/imx/imx-tve.c | 8 ++------ > drivers/gpu/drm/imx/parallel-display.c | 8 ++------ > drivers/gpu/drm/ingenic/ingenic-drm.c | 9 +++------ > drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++----------- > drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++----------- > drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 14 +++----------- > .../gpu/drm/rockchip/analogix_dp-rockchip.c | 9 +++------ > drivers/gpu/drm/rockchip/cdn-dp-core.c | 9 +++------ > .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 8 ++------ > drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 8 ++------ > drivers/gpu/drm/rockchip/inno_hdmi.c | 8 ++------ > drivers/gpu/drm/rockchip/rk3066_hdmi.c | 8 ++------ > drivers/gpu/drm/rockchip/rockchip_lvds.c | 10 +++------- > drivers/gpu/drm/rockchip/rockchip_rgb.c | 8 ++------ > drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 14 +++----------- > drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 +++--------- > drivers/gpu/drm/sun4i/sun4i_lvds.c | 12 +++--------- > drivers/gpu/drm/sun4i/sun4i_rgb.c | 17 +++-------------- > drivers/gpu/drm/sun4i/sun4i_tv.c | 17 +++-------------- > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++--------- > drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 8 ++------ > drivers/gpu/drm/tegra/drm.h | 2 -- > drivers/gpu/drm/tegra/dsi.c | 10 +++------- > drivers/gpu/drm/tegra/hdmi.c | 9 +++------ > drivers/gpu/drm/tegra/output.c | 6 +----- > drivers/gpu/drm/tegra/rgb.c | 8 ++------ > drivers/gpu/drm/tegra/sor.c | 8 ++------ > drivers/gpu/drm/tidss/tidss_encoder.c | 10 +++------- > drivers/gpu/drm/tilcdc/tilcdc_external.c | 10 +++------- > drivers/gpu/drm/tilcdc/tilcdc_panel.c | 8 ++------ > drivers/gpu/drm/vc4/vc4_dpi.c | 8 ++------ > drivers/gpu/drm/vc4/vc4_dsi.c | 15 +++------------ > drivers/gpu/drm/vc4/vc4_hdmi.c | 17 ++++------------- > drivers/gpu/drm/vc4/vc4_vec.c | 8 ++------ > drivers/gpu/drm/virtio/virtgpu_display.c | 8 ++------ > drivers/gpu/drm/vkms/vkms_output.c | 8 ++------ > drivers/gpu/drm/zte/zx_hdmi.c | 8 ++------ > drivers/gpu/drm/zte/zx_tvenc.c | 8 ++------ > drivers/gpu/drm/zte/zx_vga.c | 8 ++------ > 68 files changed, 151 insertions(+), 488 deletions(-) > > -- > 2.25.1 >-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project
a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/sun4i/sun4i_lvds.c:121:8: error: implicit declaration
of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm, &lvds->encoder,
                 ^
   drivers/gpu/drm/sun4i/sun4i_lvds.c:121:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/sun4i/sun4i_rgb.c:213:8: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm, &rgb->encoder,
                 ^
   drivers/gpu/drm/sun4i/sun4i_rgb.c:213:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c:611:8: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm, &hdmi->encoder,
                 ^
   drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c:611:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c:220:2: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
           ^
   drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c:220:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/sun4i/sun4i_tv.c:587:8: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm, &tv->encoder,
                 ^
   drivers/gpu/drm/sun4i/sun4i_tv.c:587:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c:1062:8: error: implicit
declaration of function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(drm, &dsi->encoder,
                 ^
   drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c:1062:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
vim +/drm_simple_encoder_init +121 drivers/gpu/drm/sun4i/sun4i_lvds.c
    99	
   100	int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
   101	{
   102		struct drm_encoder *encoder;
   103		struct drm_bridge *bridge;
   104		struct sun4i_lvds *lvds;
   105		int ret;
   106	
   107		lvds = devm_kzalloc(drm->dev, sizeof(*lvds), GFP_KERNEL);
   108		if (!lvds)
   109			return -ENOMEM;
   110		encoder = &lvds->encoder;
   111	
   112		ret = drm_of_find_panel_or_bridge(tcon->dev->of_node, 1, 0,
   113						  &lvds->panel, &bridge);
   114		if (ret) {
   115			dev_info(drm->dev, "No panel or bridge found... LVDS output
disabled\n");
   116			return 0;
   117		}
   118	
   119		drm_encoder_helper_add(&lvds->encoder,
   120				       &sun4i_lvds_enc_helper_funcs);
 > 121		ret = drm_simple_encoder_init(drm, &lvds->encoder,
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47744 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/23e37ea2/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project
a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/tegra/rgb.c:281:2: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, &output->encoder,
DRM_MODE_ENCODER_LVDS);
           ^
   drivers/gpu/drm/tegra/rgb.c:281:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/tegra/hdmi.c:1445:2: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, &hdmi->output.encoder,
           ^
   drivers/gpu/drm/tegra/hdmi.c:1445:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/tegra/dsi.c:1058:3: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
                   drm_simple_encoder_init(drm, &dsi->output.encoder,
                   ^
   drivers/gpu/drm/tegra/dsi.c:1058:3: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu/drm/tegra/sor.c:3102:2: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, &sor->output.encoder, encoder);
           ^
   drivers/gpu/drm/tegra/sor.c:3102:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
vim +/drm_simple_encoder_init +281 drivers/gpu/drm/tegra/rgb.c
   266	
   267	int tegra_dc_rgb_init(struct drm_device *drm, struct tegra_dc *dc)
   268	{
   269		struct tegra_output *output = dc->rgb;
   270		int err;
   271	
   272		if (!dc->rgb)
   273			return -ENODEV;
   274	
   275		drm_connector_init(drm, &output->connector,
&tegra_rgb_connector_funcs,
   276				   DRM_MODE_CONNECTOR_LVDS);
   277		drm_connector_helper_add(&output->connector,
   278					 &tegra_rgb_connector_helper_funcs);
   279		output->connector.dpms = DRM_MODE_DPMS_OFF;
   280	
 > 281		drm_simple_encoder_init(drm, &output->encoder,
DRM_MODE_ENCODER_LVDS);
   282		drm_encoder_helper_add(&output->encoder,
   283				       &tegra_rgb_encoder_helper_funcs);
   284	
   285		drm_connector_attach_encoder(&output->connector,
   286						  &output->encoder);
   287		drm_connector_register(&output->connector);
   288	
   289		err = tegra_output_init(drm, output);
   290		if (err < 0) {
   291			dev_err(output->dev, "failed to initialize output: %d\n",
err);
   292			return err;
   293		}
   294	
   295		/*
   296		 * Other outputs can be attached to either display controller. The RGB
   297		 * outputs are an exception and work only with their parent display
   298		 * controller.
   299		 */
   300		output->encoder.possible_crtcs = drm_crtc_mask(&dc->base);
   301	
   302		return 0;
   303	}
   304	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47744 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/c8190e1c/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project
a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpu//drm/vc4/vc4_dpi.c:309:2: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, dpi->encoder, DRM_MODE_ENCODER_DPI);
           ^
   drivers/gpu//drm/vc4/vc4_dpi.c:309:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu//drm/vc4/vc4_dsi.c:1610:2: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, dsi->encoder, DRM_MODE_ENCODER_DSI);
           ^
   drivers/gpu//drm/vc4/vc4_dsi.c:1610:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu//drm/vc4/vc4_hdmi.c:1389:2: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, hdmi->encoder,
DRM_MODE_ENCODER_TMDS);
           ^
   drivers/gpu//drm/vc4/vc4_hdmi.c:1389:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
-->> drivers/gpu//drm/vc4/vc4_vec.c:566:2: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           drm_simple_encoder_init(drm, vec->encoder,
DRM_MODE_ENCODER_TVDAC);
           ^
   drivers/gpu//drm/vc4/vc4_vec.c:566:2: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
vim +/drm_simple_encoder_init +309 drivers/gpu//drm/vc4/vc4_dpi.c
   254	
   255	static int vc4_dpi_bind(struct device *dev, struct device *master, void
*data)
   256	{
   257		struct platform_device *pdev = to_platform_device(dev);
   258		struct drm_device *drm = dev_get_drvdata(master);
   259		struct vc4_dev *vc4 = to_vc4_dev(drm);
   260		struct vc4_dpi *dpi;
   261		struct vc4_dpi_encoder *vc4_dpi_encoder;
   262		int ret;
   263	
   264		dpi = devm_kzalloc(dev, sizeof(*dpi), GFP_KERNEL);
   265		if (!dpi)
   266			return -ENOMEM;
   267	
   268		vc4_dpi_encoder = devm_kzalloc(dev, sizeof(*vc4_dpi_encoder),
   269					       GFP_KERNEL);
   270		if (!vc4_dpi_encoder)
   271			return -ENOMEM;
   272		vc4_dpi_encoder->base.type = VC4_ENCODER_TYPE_DPI;
   273		vc4_dpi_encoder->dpi = dpi;
   274		dpi->encoder = &vc4_dpi_encoder->base.base;
   275	
   276		dpi->pdev = pdev;
   277		dpi->regs = vc4_ioremap_regs(pdev, 0);
   278		if (IS_ERR(dpi->regs))
   279			return PTR_ERR(dpi->regs);
   280		dpi->regset.base = dpi->regs;
   281		dpi->regset.regs = dpi_regs;
   282		dpi->regset.nregs = ARRAY_SIZE(dpi_regs);
   283	
   284		if (DPI_READ(DPI_ID) != DPI_ID_VALUE) {
   285			dev_err(dev, "Port returned 0x%08x for ID instead of
0x%08x\n",
   286				DPI_READ(DPI_ID), DPI_ID_VALUE);
   287			return -ENODEV;
   288		}
   289	
   290		dpi->core_clock = devm_clk_get(dev, "core");
   291		if (IS_ERR(dpi->core_clock)) {
   292			ret = PTR_ERR(dpi->core_clock);
   293			if (ret != -EPROBE_DEFER)
   294				DRM_ERROR("Failed to get core clock: %d\n", ret);
   295			return ret;
   296		}
   297		dpi->pixel_clock = devm_clk_get(dev, "pixel");
   298		if (IS_ERR(dpi->pixel_clock)) {
   299			ret = PTR_ERR(dpi->pixel_clock);
   300			if (ret != -EPROBE_DEFER)
   301				DRM_ERROR("Failed to get pixel clock: %d\n", ret);
   302			return ret;
   303		}
   304	
   305		ret = clk_prepare_enable(dpi->core_clock);
   306		if (ret)
   307			DRM_ERROR("Failed to turn on core clock: %d\n", ret);
   308	
 > 309		drm_simple_encoder_init(drm, dpi->encoder, DRM_MODE_ENCODER_DPI);
   310		drm_encoder_helper_add(dpi->encoder,
&vc4_dpi_encoder_helper_funcs);
   311	
   312		ret = vc4_dpi_init_bridge(dpi);
   313		if (ret)
   314			goto err_destroy_encoder;
   315	
   316		dev_set_drvdata(dev, dpi);
   317	
   318		vc4->dpi = dpi;
   319	
   320		vc4_debugfs_add_regset32(drm, "dpi_regs",
&dpi->regset);
   321	
   322		return 0;
   323	
   324	err_destroy_encoder:
   325		drm_encoder_cleanup(dpi->encoder);
   326		clk_disable_unprepare(dpi->core_clock);
   327		return ret;
   328	}
   329	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47744 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/73f50201/attachment-0001.gz>
Laurent Pinchart
2020-Mar-06  14:22 UTC
[PATCH 00/22] drm: Convert drivers to drm_simple_encoder_init()
Hi Thomas, Thank you for the patch. On Thu, Mar 05, 2020 at 04:59:28PM +0100, Thomas Zimmermann wrote:> A call to drm_simple_encoder_init() initializes an encoder without > further functionality. It only provides the destroy callback to > cleanup the encoder's state. Only few drivers implement more > sophisticated encoders than that. Most drivers implement such a > simple encoder and can use drm_simple_encoder_init() instead. > > The patchset converts drivers where the encoder's instance is > embedded in a larger data structure. The driver releases the > memory during cleanup. Each patch replaces drm_encoder_init() with > drm_simple_encoder_init() and removes the (now unused) driver's > encoder functions. > > While the patchset is fairly large, the indiviual patches are self- > contained and can be merged independently from each other. The > simple-encoder functionality is currently in drm-misc-next, where > these patches could go as well.I've reviewed the whole series, including verifying that the few instances of struct drm_encoder_funcs that were not declared const were not modified somewhere to add more function pointers. Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com> for all the patches. However, I'd like to note that drm_simple_encoder_init() is a bit of a misnommer here. Several of the encoders in those drivers to implement additional functionality. They just expose them through drm_encoder_helper_funcs, not drm_encoder_funcs.> Future directions: There's another common case where the driver > calls kzalloc() plus drm_encoder_init(). Such drivers are not > handled by this patchset. The plan here is to use a simple encoder > with either managed memory allocation (once it's merged), or embed > the encoder in a larger data structure and drop kzalloc() entirely.I think an even more interesting future enhancement would be to add encoder support to the newly added drm_bridge_connector_init(), for drivers that are fully based on bridges and don't implement any encoder operation, neither through drm_encoder_funcs nor through drm_encoder_helper_funcs.> The patchset has been compile-tested on x86-64, aarch64 and arm. > > Thomas Zimmermann (22): > drm/arc: Use simple encoder > drm/atmel-hlcdc: Use simple encoder > drm/exynos: Use simple encoder > drm/fsl-dcu: Use simple encoder > drm/gma500: Use simple encoder > drm/hisilicon/kirin: Use simple encoder > drm/i2c/tda998x: Use simple encoder > drm/imx: Use simple encoder > drm/ingenic: Use simple encoder > drm/mediatek: Use simple encoder > drm/rcar-du: Use simple encoder > drm/rockchip: Use simple encoder > drm/shmobile: Use simple encoder > drm/sun4i: Use simple encoder > drm/tegra: Use simple encoder > drm/tidss: Use simple encoder > drm/tilcdc: Use simple encoder > drm/vc4: Use simple encoder > drm/virtgpu: Use simple encoder > drm/vkms: Use simple encoder > drm/writeback: Use simple encoder > drm/zte: Use simple encoder > > drivers/gpu/drm/arc/arcpgu_hdmi.c | 10 +++------- > drivers/gpu/drm/arc/arcpgu_sim.c | 8 ++------ > .../gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ++++-------- > drivers/gpu/drm/drm_writeback.c | 10 +++------- > drivers/gpu/drm/exynos/exynos_dp.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_hdmi.c | 8 ++------ > drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 14 +++----------- > drivers/gpu/drm/gma500/cdv_intel_crt.c | 14 +++----------- > drivers/gpu/drm/gma500/cdv_intel_dp.c | 16 +++------------- > drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 4 ++-- > drivers/gpu/drm/gma500/cdv_intel_lvds.c | 17 +++-------------- > drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 7 +++---- > drivers/gpu/drm/gma500/mdfld_output.h | 1 - > drivers/gpu/drm/gma500/mdfld_tmd_vid.c | 6 ------ > drivers/gpu/drm/gma500/mdfld_tpo_vid.c | 6 ------ > drivers/gpu/drm/gma500/oaktrail_hdmi.c | 14 ++------------ > drivers/gpu/drm/gma500/oaktrail_lvds.c | 5 +++-- > drivers/gpu/drm/gma500/psb_intel_drv.h | 1 - > drivers/gpu/drm/gma500/psb_intel_lvds.c | 18 +++--------------- > drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c | 5 ----- > drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 8 ++------ > drivers/gpu/drm/i2c/tda998x_drv.c | 14 +++----------- > drivers/gpu/drm/imx/dw_hdmi-imx.c | 8 ++------ > drivers/gpu/drm/imx/imx-drm-core.c | 6 ------ > drivers/gpu/drm/imx/imx-drm.h | 1 - > drivers/gpu/drm/imx/imx-ldb.c | 8 ++------ > drivers/gpu/drm/imx/imx-tve.c | 8 ++------ > drivers/gpu/drm/imx/parallel-display.c | 8 ++------ > drivers/gpu/drm/ingenic/ingenic-drm.c | 9 +++------ > drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++----------- > drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++----------- > drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 14 +++----------- > .../gpu/drm/rockchip/analogix_dp-rockchip.c | 9 +++------ > drivers/gpu/drm/rockchip/cdn-dp-core.c | 9 +++------ > .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 8 ++------ > drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 8 ++------ > drivers/gpu/drm/rockchip/inno_hdmi.c | 8 ++------ > drivers/gpu/drm/rockchip/rk3066_hdmi.c | 8 ++------ > drivers/gpu/drm/rockchip/rockchip_lvds.c | 10 +++------- > drivers/gpu/drm/rockchip/rockchip_rgb.c | 8 ++------ > drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 14 +++----------- > drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 +++--------- > drivers/gpu/drm/sun4i/sun4i_lvds.c | 12 +++--------- > drivers/gpu/drm/sun4i/sun4i_rgb.c | 17 +++-------------- > drivers/gpu/drm/sun4i/sun4i_tv.c | 17 +++-------------- > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++--------- > drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 8 ++------ > drivers/gpu/drm/tegra/drm.h | 2 -- > drivers/gpu/drm/tegra/dsi.c | 10 +++------- > drivers/gpu/drm/tegra/hdmi.c | 9 +++------ > drivers/gpu/drm/tegra/output.c | 6 +----- > drivers/gpu/drm/tegra/rgb.c | 8 ++------ > drivers/gpu/drm/tegra/sor.c | 8 ++------ > drivers/gpu/drm/tidss/tidss_encoder.c | 10 +++------- > drivers/gpu/drm/tilcdc/tilcdc_external.c | 10 +++------- > drivers/gpu/drm/tilcdc/tilcdc_panel.c | 8 ++------ > drivers/gpu/drm/vc4/vc4_dpi.c | 8 ++------ > drivers/gpu/drm/vc4/vc4_dsi.c | 15 +++------------ > drivers/gpu/drm/vc4/vc4_hdmi.c | 17 ++++------------- > drivers/gpu/drm/vc4/vc4_vec.c | 8 ++------ > drivers/gpu/drm/virtio/virtgpu_display.c | 8 ++------ > drivers/gpu/drm/vkms/vkms_output.c | 8 ++------ > drivers/gpu/drm/zte/zx_hdmi.c | 8 ++------ > drivers/gpu/drm/zte/zx_tvenc.c | 8 ++------ > drivers/gpu/drm/zte/zx_vga.c | 8 ++------ > 68 files changed, 151 insertions(+), 488 deletions(-)-- Regards, Laurent Pinchart
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project
a0cd413426479abb207381bdbab862f3dfb3ce7d)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/drm_writeback.c:191:8: error: implicit declaration of
function 'drm_simple_encoder_init'
[-Werror,-Wimplicit-function-declaration]
           ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
                 ^
   drivers/gpu/drm/drm_writeback.c:191:8: note: did you mean
'drm_encoder_init'?
   include/drm/drm_encoder.h:189:5: note: 'drm_encoder_init' declared
here
   int drm_encoder_init(struct drm_device *dev,
       ^
   1 error generated.
vim +/drm_simple_encoder_init +191 drivers/gpu/drm/drm_writeback.c
   149	
   150	/**
   151	 * drm_writeback_connector_init - Initialize a writeback connector and
its properties
   152	 * @dev: DRM device
   153	 * @wb_connector: Writeback connector to initialize
   154	 * @con_funcs: Connector funcs vtable
   155	 * @enc_helper_funcs: Encoder helper funcs vtable to be used by the
internal encoder
   156	 * @formats: Array of supported pixel formats for the writeback engine
   157	 * @n_formats: Length of the formats array
   158	 *
   159	 * This function creates the writeback-connector-specific properties if
they
   160	 * have not been already created, initializes the connector as
   161	 * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the
property
   162	 * values. It will also create an internal encoder associated with the
   163	 * drm_writeback_connector and set it to use the @enc_helper_funcs vtable
for
   164	 * the encoder helper.
   165	 *
   166	 * Drivers should always use this function instead of
drm_connector_init() to
   167	 * set up writeback connectors.
   168	 *
   169	 * Returns: 0 on success, or a negative error code
   170	 */
   171	int drm_writeback_connector_init(struct drm_device *dev,
   172					 struct drm_writeback_connector *wb_connector,
   173					 const struct drm_connector_funcs *con_funcs,
   174					 const struct drm_encoder_helper_funcs *enc_helper_funcs,
   175					 const u32 *formats, int n_formats)
   176	{
   177		struct drm_property_blob *blob;
   178		struct drm_connector *connector = &wb_connector->base;
   179		struct drm_mode_config *config = &dev->mode_config;
   180		int ret = create_writeback_properties(dev);
   181	
   182		if (ret != 0)
   183			return ret;
   184	
   185		blob = drm_property_create_blob(dev, n_formats * sizeof(*formats),
   186						formats);
   187		if (IS_ERR(blob))
   188			return PTR_ERR(blob);
   189	
   190		drm_encoder_helper_add(&wb_connector->encoder, enc_helper_funcs);
 > 191		ret = drm_simple_encoder_init(dev, &wb_connector->encoder,
   192					      DRM_MODE_ENCODER_VIRTUAL);
   193		if (ret)
   194			goto fail;
   195	
   196		connector->interlace_allowed = 0;
   197	
   198		ret = drm_connector_init(dev, connector, con_funcs,
   199					 DRM_MODE_CONNECTOR_WRITEBACK);
   200		if (ret)
   201			goto connector_fail;
   202	
   203		ret = drm_connector_attach_encoder(connector,
   204							&wb_connector->encoder);
   205		if (ret)
   206			goto attach_fail;
   207	
   208		INIT_LIST_HEAD(&wb_connector->job_queue);
   209		spin_lock_init(&wb_connector->job_lock);
   210	
   211		wb_connector->fence_context = dma_fence_context_alloc(1);
   212		spin_lock_init(&wb_connector->fence_lock);
   213		snprintf(wb_connector->timeline_name,
   214			 sizeof(wb_connector->timeline_name),
   215			 "CONNECTOR:%d-%s", connector->base.id,
connector->name);
   216	
   217		drm_object_attach_property(&connector->base,
   218					   config->writeback_out_fence_ptr_property, 0);
   219	
   220		drm_object_attach_property(&connector->base,
   221					   config->writeback_fb_id_property, 0);
   222	
   223		drm_object_attach_property(&connector->base,
   224					   config->writeback_pixel_formats_property,
   225					   blob->base.id);
   226		wb_connector->pixel_formats_blob_ptr = blob;
   227	
   228		return 0;
   229	
   230	attach_fail:
   231		drm_connector_cleanup(connector);
   232	connector_fail:
   233		drm_encoder_cleanup(&wb_connector->encoder);
   234	fail:
   235		drm_property_blob_put(blob);
   236		return ret;
   237	}
   238	EXPORT_SYMBOL(drm_writeback_connector_init);
   239	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47744 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/a04dafa2/attachment-0001.gz>
Thomas Zimmermann
2020-Mar-06  15:10 UTC
[PATCH 00/22] drm: Convert drivers to drm_simple_encoder_init()
Hi Am 06.03.20 um 11:56 schrieb Daniel Vetter:> On Thu, Mar 05, 2020 at 04:59:28PM +0100, Thomas Zimmermann wrote: >> A call to drm_simple_encoder_init() initializes an encoder without >> further functionality. It only provides the destroy callback to >> cleanup the encoder's state. Only few drivers implement more >> sophisticated encoders than that. Most drivers implement such a >> simple encoder and can use drm_simple_encoder_init() instead. >> >> The patchset converts drivers where the encoder's instance is >> embedded in a larger data structure. The driver releases the >> memory during cleanup. Each patch replaces drm_encoder_init() with >> drm_simple_encoder_init() and removes the (now unused) driver's >> encoder functions. >> >> While the patchset is fairly large, the indiviual patches are self- >> contained and can be merged independently from each other. The >> simple-encoder functionality is currently in drm-misc-next, where >> these patches could go as well. >> >> Future directions: There's another common case where the driver >> calls kzalloc() plus drm_encoder_init(). Such drivers are not >> handled by this patchset. The plan here is to use a simple encoder >> with either managed memory allocation (once it's merged), or embed >> the encoder in a larger data structure and drop kzalloc() entirely. >> >> The patchset has been compile-tested on x86-64, aarch64 and arm. > > So from a cursory look all these drivers get it wrong and devm_kzalloc > their encoders. But I guess simplifying stuff like you do here will at > least give us a nice list of things to look at once we get to the > drmm_simple_encoder_init version of all this. On the series: > > Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch>Thanks!> >> >> Thomas Zimmermann (22): >> drm/arc: Use simple encoder >> drm/atmel-hlcdc: Use simple encoder >> drm/exynos: Use simple encoder >> drm/fsl-dcu: Use simple encoder >> drm/gma500: Use simple encoder >> drm/hisilicon/kirin: Use simple encoder >> drm/i2c/tda998x: Use simple encoder >> drm/imx: Use simple encoder >> drm/ingenic: Use simple encoder >> drm/mediatek: Use simple encoder >> drm/rcar-du: Use simple encoder >> drm/rockchip: Use simple encoder >> drm/shmobile: Use simple encoder >> drm/sun4i: Use simple encoder >> drm/tegra: Use simple encoder >> drm/tidss: Use simple encoder >> drm/tilcdc: Use simple encoder >> drm/vc4: Use simple encoder >> drm/virtgpu: Use simple encoder >> drm/vkms: Use simple encoder >> drm/writeback: Use simple encoder >> drm/zte: Use simple encoder >> >> drivers/gpu/drm/arc/arcpgu_hdmi.c | 10 +++------- >> drivers/gpu/drm/arc/arcpgu_sim.c | 8 ++------ >> .../gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ++++-------- >> drivers/gpu/drm/drm_writeback.c | 10 +++------- >> drivers/gpu/drm/exynos/exynos_dp.c | 8 ++------ >> drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++------ >> drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 ++------ >> drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 ++------ >> drivers/gpu/drm/exynos/exynos_hdmi.c | 8 ++------ >> drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 14 +++----------- >> drivers/gpu/drm/gma500/cdv_intel_crt.c | 14 +++----------- >> drivers/gpu/drm/gma500/cdv_intel_dp.c | 16 +++------------- >> drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 4 ++-- >> drivers/gpu/drm/gma500/cdv_intel_lvds.c | 17 +++-------------- >> drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 7 +++---- >> drivers/gpu/drm/gma500/mdfld_output.h | 1 - >> drivers/gpu/drm/gma500/mdfld_tmd_vid.c | 6 ------ >> drivers/gpu/drm/gma500/mdfld_tpo_vid.c | 6 ------ >> drivers/gpu/drm/gma500/oaktrail_hdmi.c | 14 ++------------ >> drivers/gpu/drm/gma500/oaktrail_lvds.c | 5 +++-- >> drivers/gpu/drm/gma500/psb_intel_drv.h | 1 - >> drivers/gpu/drm/gma500/psb_intel_lvds.c | 18 +++--------------- >> drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c | 5 ----- >> drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 8 ++------ >> drivers/gpu/drm/i2c/tda998x_drv.c | 14 +++----------- >> drivers/gpu/drm/imx/dw_hdmi-imx.c | 8 ++------ >> drivers/gpu/drm/imx/imx-drm-core.c | 6 ------ >> drivers/gpu/drm/imx/imx-drm.h | 1 - >> drivers/gpu/drm/imx/imx-ldb.c | 8 ++------ >> drivers/gpu/drm/imx/imx-tve.c | 8 ++------ >> drivers/gpu/drm/imx/parallel-display.c | 8 ++------ >> drivers/gpu/drm/ingenic/ingenic-drm.c | 9 +++------ >> drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++----------- >> drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++----------- >> drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 14 +++----------- >> .../gpu/drm/rockchip/analogix_dp-rockchip.c | 9 +++------ >> drivers/gpu/drm/rockchip/cdn-dp-core.c | 9 +++------ >> .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 8 ++------ >> drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 8 ++------ >> drivers/gpu/drm/rockchip/inno_hdmi.c | 8 ++------ >> drivers/gpu/drm/rockchip/rk3066_hdmi.c | 8 ++------ >> drivers/gpu/drm/rockchip/rockchip_lvds.c | 10 +++------- >> drivers/gpu/drm/rockchip/rockchip_rgb.c | 8 ++------ >> drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 14 +++----------- >> drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 +++--------- >> drivers/gpu/drm/sun4i/sun4i_lvds.c | 12 +++--------- >> drivers/gpu/drm/sun4i/sun4i_rgb.c | 17 +++-------------- >> drivers/gpu/drm/sun4i/sun4i_tv.c | 17 +++-------------- >> drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++--------- >> drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 8 ++------ >> drivers/gpu/drm/tegra/drm.h | 2 -- >> drivers/gpu/drm/tegra/dsi.c | 10 +++------- >> drivers/gpu/drm/tegra/hdmi.c | 9 +++------ >> drivers/gpu/drm/tegra/output.c | 6 +----- >> drivers/gpu/drm/tegra/rgb.c | 8 ++------ >> drivers/gpu/drm/tegra/sor.c | 8 ++------ >> drivers/gpu/drm/tidss/tidss_encoder.c | 10 +++------- >> drivers/gpu/drm/tilcdc/tilcdc_external.c | 10 +++------- >> drivers/gpu/drm/tilcdc/tilcdc_panel.c | 8 ++------ >> drivers/gpu/drm/vc4/vc4_dpi.c | 8 ++------ >> drivers/gpu/drm/vc4/vc4_dsi.c | 15 +++------------ >> drivers/gpu/drm/vc4/vc4_hdmi.c | 17 ++++------------- >> drivers/gpu/drm/vc4/vc4_vec.c | 8 ++------ >> drivers/gpu/drm/virtio/virtgpu_display.c | 8 ++------ >> drivers/gpu/drm/vkms/vkms_output.c | 8 ++------ >> drivers/gpu/drm/zte/zx_hdmi.c | 8 ++------ >> drivers/gpu/drm/zte/zx_tvenc.c | 8 ++------ >> drivers/gpu/drm/zte/zx_vga.c | 8 ++------ >> 68 files changed, 151 insertions(+), 488 deletions(-) >> >> -- >> 2.25.1 >> >-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N?rnberg, Germany (HRB 36809, AG N?rnberg) Gesch?ftsf?hrer: Felix Imend?rffer -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/259af06f/attachment.sig>
Thomas Zimmermann
2020-Mar-06  15:18 UTC
[PATCH 00/22] drm: Convert drivers to drm_simple_encoder_init()
Hi Laurent Am 06.03.20 um 15:22 schrieb Laurent Pinchart:> Hi Thomas, > > Thank you for the patch. > > On Thu, Mar 05, 2020 at 04:59:28PM +0100, Thomas Zimmermann wrote: >> A call to drm_simple_encoder_init() initializes an encoder without >> further functionality. It only provides the destroy callback to >> cleanup the encoder's state. Only few drivers implement more >> sophisticated encoders than that. Most drivers implement such a >> simple encoder and can use drm_simple_encoder_init() instead. >> >> The patchset converts drivers where the encoder's instance is >> embedded in a larger data structure. The driver releases the >> memory during cleanup. Each patch replaces drm_encoder_init() with >> drm_simple_encoder_init() and removes the (now unused) driver's >> encoder functions. >> >> While the patchset is fairly large, the indiviual patches are self- >> contained and can be merged independently from each other. The >> simple-encoder functionality is currently in drm-misc-next, where >> these patches could go as well. > > I've reviewed the whole series, including verifying that the few > instances of struct drm_encoder_funcs that were not declared const were > not modified somewhere to add more function pointers. > > Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>Thanks for the detailed review.> > for all the patches. > > However, I'd like to note that drm_simple_encoder_init() is a bit of a > misnommer here. Several of the encoders in those drivers to implement > additional functionality. They just expose them through > drm_encoder_helper_funcs, not drm_encoder_funcs.True. It's called 'simple encoder' for the lack of a better name. It's part of the simple KMS helpers, so the name's at least consistent. OTOH I always find drm_simple_display_pipe a bad name. We can still rename the simple-encoder function without much effort. I'm open for suggestions. Best regards Thomas> >> Future directions: There's another common case where the driver >> calls kzalloc() plus drm_encoder_init(). Such drivers are not >> handled by this patchset. The plan here is to use a simple encoder >> with either managed memory allocation (once it's merged), or embed >> the encoder in a larger data structure and drop kzalloc() entirely. > > I think an even more interesting future enhancement would be to add > encoder support to the newly added drm_bridge_connector_init(), for > drivers that are fully based on bridges and don't implement any encoder > operation, neither through drm_encoder_funcs nor through > drm_encoder_helper_funcs. > >> The patchset has been compile-tested on x86-64, aarch64 and arm. >> >> Thomas Zimmermann (22): >> drm/arc: Use simple encoder >> drm/atmel-hlcdc: Use simple encoder >> drm/exynos: Use simple encoder >> drm/fsl-dcu: Use simple encoder >> drm/gma500: Use simple encoder >> drm/hisilicon/kirin: Use simple encoder >> drm/i2c/tda998x: Use simple encoder >> drm/imx: Use simple encoder >> drm/ingenic: Use simple encoder >> drm/mediatek: Use simple encoder >> drm/rcar-du: Use simple encoder >> drm/rockchip: Use simple encoder >> drm/shmobile: Use simple encoder >> drm/sun4i: Use simple encoder >> drm/tegra: Use simple encoder >> drm/tidss: Use simple encoder >> drm/tilcdc: Use simple encoder >> drm/vc4: Use simple encoder >> drm/virtgpu: Use simple encoder >> drm/vkms: Use simple encoder >> drm/writeback: Use simple encoder >> drm/zte: Use simple encoder >> >> drivers/gpu/drm/arc/arcpgu_hdmi.c | 10 +++------- >> drivers/gpu/drm/arc/arcpgu_sim.c | 8 ++------ >> .../gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ++++-------- >> drivers/gpu/drm/drm_writeback.c | 10 +++------- >> drivers/gpu/drm/exynos/exynos_dp.c | 8 ++------ >> drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++------ >> drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 ++------ >> drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 ++------ >> drivers/gpu/drm/exynos/exynos_hdmi.c | 8 ++------ >> drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c | 14 +++----------- >> drivers/gpu/drm/gma500/cdv_intel_crt.c | 14 +++----------- >> drivers/gpu/drm/gma500/cdv_intel_dp.c | 16 +++------------- >> drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 4 ++-- >> drivers/gpu/drm/gma500/cdv_intel_lvds.c | 17 +++-------------- >> drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 7 +++---- >> drivers/gpu/drm/gma500/mdfld_output.h | 1 - >> drivers/gpu/drm/gma500/mdfld_tmd_vid.c | 6 ------ >> drivers/gpu/drm/gma500/mdfld_tpo_vid.c | 6 ------ >> drivers/gpu/drm/gma500/oaktrail_hdmi.c | 14 ++------------ >> drivers/gpu/drm/gma500/oaktrail_lvds.c | 5 +++-- >> drivers/gpu/drm/gma500/psb_intel_drv.h | 1 - >> drivers/gpu/drm/gma500/psb_intel_lvds.c | 18 +++--------------- >> drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c | 5 ----- >> drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 8 ++------ >> drivers/gpu/drm/i2c/tda998x_drv.c | 14 +++----------- >> drivers/gpu/drm/imx/dw_hdmi-imx.c | 8 ++------ >> drivers/gpu/drm/imx/imx-drm-core.c | 6 ------ >> drivers/gpu/drm/imx/imx-drm.h | 1 - >> drivers/gpu/drm/imx/imx-ldb.c | 8 ++------ >> drivers/gpu/drm/imx/imx-tve.c | 8 ++------ >> drivers/gpu/drm/imx/parallel-display.c | 8 ++------ >> drivers/gpu/drm/ingenic/ingenic-drm.c | 9 +++------ >> drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++----------- >> drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++----------- >> drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 14 +++----------- >> .../gpu/drm/rockchip/analogix_dp-rockchip.c | 9 +++------ >> drivers/gpu/drm/rockchip/cdn-dp-core.c | 9 +++------ >> .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 8 ++------ >> drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 8 ++------ >> drivers/gpu/drm/rockchip/inno_hdmi.c | 8 ++------ >> drivers/gpu/drm/rockchip/rk3066_hdmi.c | 8 ++------ >> drivers/gpu/drm/rockchip/rockchip_lvds.c | 10 +++------- >> drivers/gpu/drm/rockchip/rockchip_rgb.c | 8 ++------ >> drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 14 +++----------- >> drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 +++--------- >> drivers/gpu/drm/sun4i/sun4i_lvds.c | 12 +++--------- >> drivers/gpu/drm/sun4i/sun4i_rgb.c | 17 +++-------------- >> drivers/gpu/drm/sun4i/sun4i_tv.c | 17 +++-------------- >> drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++--------- >> drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 8 ++------ >> drivers/gpu/drm/tegra/drm.h | 2 -- >> drivers/gpu/drm/tegra/dsi.c | 10 +++------- >> drivers/gpu/drm/tegra/hdmi.c | 9 +++------ >> drivers/gpu/drm/tegra/output.c | 6 +----- >> drivers/gpu/drm/tegra/rgb.c | 8 ++------ >> drivers/gpu/drm/tegra/sor.c | 8 ++------ >> drivers/gpu/drm/tidss/tidss_encoder.c | 10 +++------- >> drivers/gpu/drm/tilcdc/tilcdc_external.c | 10 +++------- >> drivers/gpu/drm/tilcdc/tilcdc_panel.c | 8 ++------ >> drivers/gpu/drm/vc4/vc4_dpi.c | 8 ++------ >> drivers/gpu/drm/vc4/vc4_dsi.c | 15 +++------------ >> drivers/gpu/drm/vc4/vc4_hdmi.c | 17 ++++------------- >> drivers/gpu/drm/vc4/vc4_vec.c | 8 ++------ >> drivers/gpu/drm/virtio/virtgpu_display.c | 8 ++------ >> drivers/gpu/drm/vkms/vkms_output.c | 8 ++------ >> drivers/gpu/drm/zte/zx_hdmi.c | 8 ++------ >> drivers/gpu/drm/zte/zx_tvenc.c | 8 ++------ >> drivers/gpu/drm/zte/zx_vga.c | 8 ++------ >> 68 files changed, 151 insertions(+), 488 deletions(-) >-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N?rnberg, Germany (HRB 36809, AG N?rnberg) Gesch?ftsf?hrer: Felix Imend?rffer -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200306/deb770be/attachment-0001.sig>
On Thu, Mar 05, 2020 at 04:59:29PM +0100, Thomas Zimmermann wrote:> The arc driver uses empty implementations for its encoders. Replace > the code with the generic simple encoder.We should , as a follow-up patch, embed the encoder in arcgpu_drm_private. Then we drop the kzalloc() and avoid that life-time challenge. This patch looks good for what it does. Acked-by: Sam Ravnborg <sam at ravnborg.org>> > Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de> > --- > drivers/gpu/drm/arc/arcpgu_hdmi.c | 10 +++------- > drivers/gpu/drm/arc/arcpgu_sim.c | 8 ++------ > 2 files changed, 5 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/arc/arcpgu_hdmi.c b/drivers/gpu/drm/arc/arcpgu_hdmi.c > index 52839934f2fb..780911765e2e 100644 > --- a/drivers/gpu/drm/arc/arcpgu_hdmi.c > +++ b/drivers/gpu/drm/arc/arcpgu_hdmi.c > @@ -7,15 +7,12 @@ > > #include <drm/drm_bridge.h> > #include <drm/drm_crtc.h> > -#include <drm/drm_encoder.h> > #include <drm/drm_device.h> > +#include <drm/drm_encoder.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "arcpgu.h" > > -static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np) > { > struct drm_encoder *encoder; > @@ -34,8 +31,7 @@ int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np) > > encoder->possible_crtcs = 1; > encoder->possible_clones = 0; > - ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); > if (ret) > return ret; > > diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c > index 37d961668dfe..66ca2c26e339 100644 > --- a/drivers/gpu/drm/arc/arcpgu_sim.c > +++ b/drivers/gpu/drm/arc/arcpgu_sim.c > @@ -8,6 +8,7 @@ > #include <drm/drm_atomic_helper.h> > #include <drm/drm_device.h> > #include <drm/drm_probe_helper.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "arcpgu.h" > > @@ -50,10 +51,6 @@ static const struct drm_connector_funcs arcpgu_drm_connector_funcs = { > .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > }; > > -static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) > { > struct arcpgu_drm_connector *arcpgu_connector; > @@ -68,8 +65,7 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) > encoder->possible_crtcs = 1; > encoder->possible_clones = 0; > > - ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs, > - DRM_MODE_ENCODER_VIRTUAL, NULL); > + ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_VIRTUAL); > if (ret) > return ret; > > -- > 2.25.1
On Thu, Mar 05, 2020 at 04:59:30PM +0100, Thomas Zimmermann wrote:> The atmel-hlcdc driver uses an empty implementation for its encoder. > Replace the code with the generic simple encoder. > > Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>Reviewed-by: Sam Ravnborg <sam at ravnborg.org>> --- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > index e2019fe97fff..43bc709e3523 100644 > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c > @@ -11,9 +11,10 @@ > #include <linux/media-bus-format.h> > #include <linux/of_graph.h> > > +#include <drm/drm_bridge.h> > #include <drm/drm_encoder.h> > #include <drm/drm_of.h> > -#include <drm/drm_bridge.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "atmel_hlcdc_dc.h" > > @@ -22,10 +23,6 @@ struct atmel_hlcdc_rgb_output { > int bus_fmt; > }; > > -static const struct drm_encoder_funcs atmel_hlcdc_panel_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > static struct atmel_hlcdc_rgb_output * > atmel_hlcdc_encoder_to_rgb_output(struct drm_encoder *encoder) > { > @@ -98,9 +95,8 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint) > return -EINVAL; > } > > - ret = drm_encoder_init(dev, &output->encoder, > - &atmel_hlcdc_panel_encoder_funcs, > - DRM_MODE_ENCODER_NONE, NULL); > + ret = drm_simple_encoder_init(dev, &output->encoder, > + DRM_MODE_ENCODER_NONE); > if (ret) > return ret; > > -- > 2.25.1
On Thu, Mar 05, 2020 at 04:59:31PM +0100, Thomas Zimmermann wrote:> The exynos driver uses empty implementations for its encoders. Replace > the code with the generic simple encoder. > > Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>Acked-by: Sam Ravnborg <sam at ravnborg.org>> --- > drivers/gpu/drm/exynos/exynos_dp.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 ++------ > drivers/gpu/drm/exynos/exynos_hdmi.c | 8 ++------ > 5 files changed, 10 insertions(+), 30 deletions(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c > index d23d3502ca91..a61482af2998 100644 > --- a/drivers/gpu/drm/exynos/exynos_dp.c > +++ b/drivers/gpu/drm/exynos/exynos_dp.c > @@ -25,6 +25,7 @@ > #include <drm/drm_panel.h> > #include <drm/drm_print.h> > #include <drm/drm_probe_helper.h> > +#include <drm/drm_simple_kms_helper.h> > #include <drm/exynos_drm.h> > > #include "exynos_drm_crtc.h" > @@ -135,10 +136,6 @@ static const struct drm_encoder_helper_funcs exynos_dp_encoder_helper_funcs = { > .disable = exynos_dp_nop, > }; > > -static const struct drm_encoder_funcs exynos_dp_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp) > { > int ret; > @@ -174,8 +171,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) > return ret; > } > > - drm_encoder_init(drm_dev, encoder, &exynos_dp_encoder_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS); > > drm_encoder_helper_add(encoder, &exynos_dp_encoder_helper_funcs); > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c > index 43fa0f26c052..7ba5354e7d94 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c > @@ -14,6 +14,7 @@ > #include <drm/drm_panel.h> > #include <drm/drm_print.h> > #include <drm/drm_probe_helper.h> > +#include <drm/drm_simple_kms_helper.h> > > #include <video/of_videomode.h> > #include <video/videomode.h> > @@ -149,10 +150,6 @@ static const struct drm_encoder_helper_funcs exynos_dpi_encoder_helper_funcs = { > .disable = exynos_dpi_disable, > }; > > -static const struct drm_encoder_funcs exynos_dpi_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > enum { > FIMD_PORT_IN0, > FIMD_PORT_IN1, > @@ -201,8 +198,7 @@ int exynos_dpi_bind(struct drm_device *dev, struct drm_encoder *encoder) > { > int ret; > > - drm_encoder_init(dev, encoder, &exynos_dpi_encoder_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS); > > drm_encoder_helper_add(encoder, &exynos_dpi_encoder_helper_funcs); > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c > index 669d3857502a..2986c93382e0 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c > @@ -30,6 +30,7 @@ > #include <drm/drm_panel.h> > #include <drm/drm_print.h> > #include <drm/drm_probe_helper.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "exynos_drm_crtc.h" > #include "exynos_drm_drv.h" > @@ -1524,10 +1525,6 @@ static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = { > .disable = exynos_dsi_disable, > }; > > -static const struct drm_encoder_funcs exynos_dsi_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); > > static int exynos_dsi_host_attach(struct mipi_dsi_host *host, > @@ -1705,8 +1702,7 @@ static int exynos_dsi_bind(struct device *dev, struct device *master, > struct drm_bridge *in_bridge; > int ret; > > - drm_encoder_init(drm_dev, encoder, &exynos_dsi_encoder_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS); > > drm_encoder_helper_add(encoder, &exynos_dsi_encoder_helper_funcs); > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c > index b320b3a21ad4..282467121699 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c > @@ -14,6 +14,7 @@ > #include <drm/drm_atomic_helper.h> > #include <drm/drm_edid.h> > #include <drm/drm_probe_helper.h> > +#include <drm/drm_simple_kms_helper.h> > #include <drm/drm_vblank.h> > #include <drm/exynos_drm.h> > > @@ -369,10 +370,6 @@ static const struct drm_encoder_helper_funcs exynos_vidi_encoder_helper_funcs > .disable = exynos_vidi_disable, > }; > > -static const struct drm_encoder_funcs exynos_vidi_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > static int vidi_bind(struct device *dev, struct device *master, void *data) > { > struct vidi_context *ctx = dev_get_drvdata(dev); > @@ -406,8 +403,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data) > return PTR_ERR(ctx->crtc); > } > > - drm_encoder_init(drm_dev, encoder, &exynos_vidi_encoder_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS); > > drm_encoder_helper_add(encoder, &exynos_vidi_encoder_helper_funcs); > > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c > index 3e5f1a77286d..302ffda5f297 100644 > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c > @@ -38,6 +38,7 @@ > #include <drm/drm_edid.h> > #include <drm/drm_print.h> > #include <drm/drm_probe_helper.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "exynos_drm_crtc.h" > #include "regs-hdmi.h" > @@ -1559,10 +1560,6 @@ static const struct drm_encoder_helper_funcs exynos_hdmi_encoder_helper_funcs > .disable = hdmi_disable, > }; > > -static const struct drm_encoder_funcs exynos_hdmi_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > static void hdmi_audio_shutdown(struct device *dev, void *data) > { > struct hdmi_context *hdata = dev_get_drvdata(dev); > @@ -1851,8 +1848,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) > > hdata->phy_clk.enable = hdmiphy_clk_enable; > > - drm_encoder_init(drm_dev, encoder, &exynos_hdmi_encoder_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS); > > drm_encoder_helper_add(encoder, &exynos_hdmi_encoder_helper_funcs); > > -- > 2.25.1
Hi Thomas. On Thu, Mar 05, 2020 at 04:59:33PM +0100, Thomas Zimmermann wrote:> The gma500 driver uses empty implementations for some of its encoders. > Replace the code with the generic simple encoder.This parts looks good.> As a side effect, the > patch also removes an indirection in the encoder setup for Medfield.I failed to see where this was done. Maybe too late for me to review patches, so I will stop now. No matter - patch is: Acked-by: Sam Ravnborg <sam at ravnborg.org>> > Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de> > --- > drivers/gpu/drm/gma500/cdv_intel_crt.c | 14 +++----------- > drivers/gpu/drm/gma500/cdv_intel_dp.c | 16 +++------------- > drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 4 ++-- > drivers/gpu/drm/gma500/cdv_intel_lvds.c | 17 +++-------------- > drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 7 +++---- > drivers/gpu/drm/gma500/mdfld_output.h | 1 - > drivers/gpu/drm/gma500/mdfld_tmd_vid.c | 6 ------ > drivers/gpu/drm/gma500/mdfld_tpo_vid.c | 6 ------ > drivers/gpu/drm/gma500/oaktrail_hdmi.c | 14 ++------------ > drivers/gpu/drm/gma500/oaktrail_lvds.c | 5 +++-- > drivers/gpu/drm/gma500/psb_intel_drv.h | 1 - > drivers/gpu/drm/gma500/psb_intel_lvds.c | 18 +++--------------- > drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c | 5 ----- > 13 files changed, 22 insertions(+), 92 deletions(-) > > diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c > index 29c36d63b20e..88535f5aacc5 100644 > --- a/drivers/gpu/drm/gma500/cdv_intel_crt.c > +++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c > @@ -28,6 +28,8 @@ > #include <linux/i2c.h> > #include <linux/pm_runtime.h> > > +#include <drm/drm_simple_kms_helper.h> > + > #include "cdv_device.h" > #include "intel_bios.h" > #include "power.h" > @@ -237,15 +239,6 @@ static const struct drm_connector_helper_funcs > .best_encoder = gma_best_encoder, > }; > > -static void cdv_intel_crt_enc_destroy(struct drm_encoder *encoder) > -{ > - drm_encoder_cleanup(encoder); > -} > - > -static const struct drm_encoder_funcs cdv_intel_crt_enc_funcs = { > - .destroy = cdv_intel_crt_enc_destroy, > -}; > - > void cdv_intel_crt_init(struct drm_device *dev, > struct psb_intel_mode_device *mode_dev) > { > @@ -271,8 +264,7 @@ void cdv_intel_crt_init(struct drm_device *dev, > &cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); > > encoder = &gma_encoder->base; > - drm_encoder_init(dev, encoder, > - &cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC, NULL); > + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC); > > gma_connector_attach_encoder(gma_connector, gma_encoder); > > diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c > index 5772b2dce0d6..13947ec06dbb 100644 > --- a/drivers/gpu/drm/gma500/cdv_intel_dp.c > +++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c > @@ -32,6 +32,7 @@ > #include <drm/drm_crtc.h> > #include <drm/drm_crtc_helper.h> > #include <drm/drm_dp_helper.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "gma_display.h" > #include "psb_drv.h" > @@ -1908,11 +1909,6 @@ cdv_intel_dp_destroy(struct drm_connector *connector) > kfree(connector); > } > > -static void cdv_intel_dp_encoder_destroy(struct drm_encoder *encoder) > -{ > - drm_encoder_cleanup(encoder); > -} > - > static const struct drm_encoder_helper_funcs cdv_intel_dp_helper_funcs = { > .dpms = cdv_intel_dp_dpms, > .mode_fixup = cdv_intel_dp_mode_fixup, > @@ -1935,11 +1931,6 @@ static const struct drm_connector_helper_funcs cdv_intel_dp_connector_helper_fun > .best_encoder = gma_best_encoder, > }; > > -static const struct drm_encoder_funcs cdv_intel_dp_enc_funcs = { > - .destroy = cdv_intel_dp_encoder_destroy, > -}; > - > - > static void cdv_intel_dp_add_properties(struct drm_connector *connector) > { > cdv_intel_attach_force_audio_property(connector); > @@ -2016,8 +2007,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev > encoder = &gma_encoder->base; > > drm_connector_init(dev, connector, &cdv_intel_dp_connector_funcs, type); > - drm_encoder_init(dev, encoder, &cdv_intel_dp_enc_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS); > > gma_connector_attach_encoder(gma_connector, gma_encoder); > > @@ -2120,7 +2110,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev > if (ret == 0) { > /* if this fails, presume the device is a ghost */ > DRM_INFO("failed to retrieve link info, disabling eDP\n"); > - cdv_intel_dp_encoder_destroy(encoder); > + drm_encoder_cleanup(encoder); > cdv_intel_dp_destroy(connector); > goto err_priv; > } else { > diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c > index 1711a41acc16..0d12c6ffbc40 100644 > --- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c > +++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c > @@ -32,6 +32,7 @@ > #include <drm/drm.h> > #include <drm/drm_crtc.h> > #include <drm/drm_edid.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "cdv_device.h" > #include "psb_drv.h" > @@ -311,8 +312,7 @@ void cdv_hdmi_init(struct drm_device *dev, > &cdv_hdmi_connector_funcs, > DRM_MODE_CONNECTOR_DVID); > > - drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS); > > gma_connector_attach_encoder(gma_connector, gma_encoder); > gma_encoder->type = INTEL_OUTPUT_HDMI; > diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c > index ea0a5d9a0acc..18de10e9ff9a 100644 > --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c > +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c > @@ -12,6 +12,8 @@ > #include <linux/i2c.h> > #include <linux/pm_runtime.h> > > +#include <drm/drm_simple_kms_helper.h> > + > #include "cdv_device.h" > #include "intel_bios.h" > #include "power.h" > @@ -499,16 +501,6 @@ static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = { > .destroy = cdv_intel_lvds_destroy, > }; > > - > -static void cdv_intel_lvds_enc_destroy(struct drm_encoder *encoder) > -{ > - drm_encoder_cleanup(encoder); > -} > - > -static const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs = { > - .destroy = cdv_intel_lvds_enc_destroy, > -}; > - > /* > * Enumerate the child dev array parsed from VBT to check whether > * the LVDS is present. > @@ -616,10 +608,7 @@ void cdv_intel_lvds_init(struct drm_device *dev, > &cdv_intel_lvds_connector_funcs, > DRM_MODE_CONNECTOR_LVDS); > > - drm_encoder_init(dev, encoder, > - &cdv_intel_lvds_enc_funcs, > - DRM_MODE_ENCODER_LVDS, NULL); > - > + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS); > > gma_connector_attach_encoder(gma_connector, gma_encoder); > gma_encoder->type = INTEL_OUTPUT_LVDS; > diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c > index d4c65f268922..aa5aa293ddb6 100644 > --- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c > +++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c > @@ -27,6 +27,8 @@ > > #include <linux/delay.h> > > +#include <drm/drm_simple_kms_helper.h> > + > #include "mdfld_dsi_dpi.h" > #include "mdfld_dsi_pkg_sender.h" > #include "mdfld_output.h" > @@ -993,10 +995,7 @@ struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct drm_device *dev, > /*create drm encoder object*/ > connector = &dsi_connector->base.base; > encoder = &dpi_output->base.base.base; > - drm_encoder_init(dev, > - encoder, > - p_funcs->encoder_funcs, > - DRM_MODE_ENCODER_LVDS, NULL); > + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS); > drm_encoder_helper_add(encoder, > p_funcs->encoder_helper_funcs); > > diff --git a/drivers/gpu/drm/gma500/mdfld_output.h b/drivers/gpu/drm/gma500/mdfld_output.h > index ab2b27c0f037..17a944d70add 100644 > --- a/drivers/gpu/drm/gma500/mdfld_output.h > +++ b/drivers/gpu/drm/gma500/mdfld_output.h > @@ -51,7 +51,6 @@ struct panel_info { > }; > > struct panel_funcs { > - const struct drm_encoder_funcs *encoder_funcs; > const struct drm_encoder_helper_funcs *encoder_helper_funcs; > struct drm_display_mode * (*get_config_mode)(struct drm_device *); > int (*get_panel_info)(struct drm_device *, int, struct panel_info *); > diff --git a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c > index 49c92debb7b2..25e897b98f86 100644 > --- a/drivers/gpu/drm/gma500/mdfld_tmd_vid.c > +++ b/drivers/gpu/drm/gma500/mdfld_tmd_vid.c > @@ -188,13 +188,7 @@ static const struct drm_encoder_helper_funcs > .commit = mdfld_dsi_dpi_commit, > }; > > -/*TPO DPI encoder funcs*/ > -static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > const struct panel_funcs mdfld_tmd_vid_funcs = { > - .encoder_funcs = &mdfld_tpo_dpi_encoder_funcs, > .encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs, > .get_config_mode = &tmd_vid_get_config_mode, > .get_panel_info = tmd_vid_get_panel_info, > diff --git a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c > index a9420bf9a419..11845978fb0a 100644 > --- a/drivers/gpu/drm/gma500/mdfld_tpo_vid.c > +++ b/drivers/gpu/drm/gma500/mdfld_tpo_vid.c > @@ -76,13 +76,7 @@ static const struct drm_encoder_helper_funcs > .commit = mdfld_dsi_dpi_commit, > }; > > -/*TPO DPI encoder funcs*/ > -static const struct drm_encoder_funcs mdfld_tpo_dpi_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > const struct panel_funcs mdfld_tpo_vid_funcs = { > - .encoder_funcs = &mdfld_tpo_dpi_encoder_funcs, > .encoder_helper_funcs = &mdfld_tpo_dpi_encoder_helper_funcs, > .get_config_mode = &tpo_vid_get_config_mode, > .get_panel_info = tpo_vid_get_panel_info, > diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c > index f4370232767d..b25086f252ae 100644 > --- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c > +++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c > @@ -27,6 +27,7 @@ > #include <linux/delay.h> > > #include <drm/drm.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "psb_drv.h" > #include "psb_intel_drv.h" > @@ -620,15 +621,6 @@ static const struct drm_connector_funcs oaktrail_hdmi_connector_funcs = { > .destroy = oaktrail_hdmi_destroy, > }; > > -static void oaktrail_hdmi_enc_destroy(struct drm_encoder *encoder) > -{ > - drm_encoder_cleanup(encoder); > -} > - > -static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = { > - .destroy = oaktrail_hdmi_enc_destroy, > -}; > - > void oaktrail_hdmi_init(struct drm_device *dev, > struct psb_intel_mode_device *mode_dev) > { > @@ -651,9 +643,7 @@ void oaktrail_hdmi_init(struct drm_device *dev, > &oaktrail_hdmi_connector_funcs, > DRM_MODE_CONNECTOR_DVID); > > - drm_encoder_init(dev, encoder, > - &oaktrail_hdmi_enc_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS); > > gma_connector_attach_encoder(gma_connector, gma_encoder); > > diff --git a/drivers/gpu/drm/gma500/oaktrail_lvds.c b/drivers/gpu/drm/gma500/oaktrail_lvds.c > index 582e09597500..2828360153d1 100644 > --- a/drivers/gpu/drm/gma500/oaktrail_lvds.c > +++ b/drivers/gpu/drm/gma500/oaktrail_lvds.c > @@ -13,6 +13,8 @@ > > #include <asm/intel-mid.h> > > +#include <drm/drm_simple_kms_helper.h> > + > #include "intel_bios.h" > #include "power.h" > #include "psb_drv.h" > @@ -311,8 +313,7 @@ void oaktrail_lvds_init(struct drm_device *dev, > &psb_intel_lvds_connector_funcs, > DRM_MODE_CONNECTOR_LVDS); > > - drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs, > - DRM_MODE_ENCODER_LVDS, NULL); > + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS); > > gma_connector_attach_encoder(gma_connector, gma_encoder); > gma_encoder->type = INTEL_OUTPUT_LVDS; > diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h > index 16c6136f778b..fb601983cef0 100644 > --- a/drivers/gpu/drm/gma500/psb_intel_drv.h > +++ b/drivers/gpu/drm/gma500/psb_intel_drv.h > @@ -252,7 +252,6 @@ extern int psb_intel_lvds_set_property(struct drm_connector *connector, > struct drm_property *property, > uint64_t value); > extern void psb_intel_lvds_destroy(struct drm_connector *connector); > -extern const struct drm_encoder_funcs psb_intel_lvds_enc_funcs; > > /* intel_gmbus.c */ > extern void gma_intel_i2c_reset(struct drm_device *dev); > diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c > index afaebab7bc17..063c66bb946d 100644 > --- a/drivers/gpu/drm/gma500/psb_intel_lvds.c > +++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c > @@ -11,6 +11,8 @@ > #include <linux/i2c.h> > #include <linux/pm_runtime.h> > > +#include <drm/drm_simple_kms_helper.h> > + > #include "intel_bios.h" > #include "power.h" > #include "psb_drv.h" > @@ -621,18 +623,6 @@ const struct drm_connector_funcs psb_intel_lvds_connector_funcs = { > .destroy = psb_intel_lvds_destroy, > }; > > - > -static void psb_intel_lvds_enc_destroy(struct drm_encoder *encoder) > -{ > - drm_encoder_cleanup(encoder); > -} > - > -const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = { > - .destroy = psb_intel_lvds_enc_destroy, > -}; > - > - > - > /** > * psb_intel_lvds_init - setup LVDS connectors on this device > * @dev: drm device > @@ -683,9 +673,7 @@ void psb_intel_lvds_init(struct drm_device *dev, > &psb_intel_lvds_connector_funcs, > DRM_MODE_CONNECTOR_LVDS); > > - drm_encoder_init(dev, encoder, > - &psb_intel_lvds_enc_funcs, > - DRM_MODE_ENCODER_LVDS, NULL); > + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_LVDS); > > gma_connector_attach_encoder(gma_connector, gma_encoder); > gma_encoder->type = INTEL_OUTPUT_LVDS; > diff --git a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c > index 9e8224456ea2..f7e121f4c609 100644 > --- a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c > +++ b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c > @@ -765,12 +765,7 @@ static const struct drm_encoder_helper_funcs tc35876x_encoder_helper_funcs = { > .commit = mdfld_dsi_dpi_commit, > }; > > -static const struct drm_encoder_funcs tc35876x_encoder_funcs = { > - .destroy = drm_encoder_cleanup, > -}; > - > const struct panel_funcs mdfld_tc35876x_funcs = { > - .encoder_funcs = &tc35876x_encoder_funcs, > .encoder_helper_funcs = &tc35876x_encoder_helper_funcs, > .get_config_mode = tc35876x_get_config_mode, > .get_panel_info = tc35876x_get_panel_info, > -- > 2.25.1
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: i386-randconfig-h001-20200307 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu//drm/vkms/vkms_output.c: In function
'vkms_output_init':>> drivers/gpu//drm/vkms/vkms_output.c:70:8: error: implicit declaration
of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
vim +70 drivers/gpu//drm/vkms/vkms_output.c
    34	
    35	int vkms_output_init(struct vkms_device *vkmsdev, int index)
    36	{
    37		struct vkms_output *output = &vkmsdev->output;
    38		struct drm_device *dev = &vkmsdev->drm;
    39		struct drm_connector *connector = &output->connector;
    40		struct drm_encoder *encoder = &output->encoder;
    41		struct drm_crtc *crtc = &output->crtc;
    42		struct drm_plane *primary, *cursor = NULL;
    43		int ret;
    44	
    45		primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index);
    46		if (IS_ERR(primary))
    47			return PTR_ERR(primary);
    48	
    49		if (enable_cursor) {
    50			cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, index);
    51			if (IS_ERR(cursor)) {
    52				ret = PTR_ERR(cursor);
    53				goto err_cursor;
    54			}
    55		}
    56	
    57		ret = vkms_crtc_init(dev, crtc, primary, cursor);
    58		if (ret)
    59			goto err_crtc;
    60	
    61		ret = drm_connector_init(dev, connector, &vkms_connector_funcs,
    62					 DRM_MODE_CONNECTOR_VIRTUAL);
    63		if (ret) {
    64			DRM_ERROR("Failed to init connector\n");
    65			goto err_connector;
    66		}
    67	
    68		drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
    69	
  > 70		ret = drm_simple_encoder_init(dev, encoder,
DRM_MODE_ENCODER_VIRTUAL);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 40866 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200307/9b515771/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: i386-randconfig-h002-20200307 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/virtio/virtgpu_display.c: In function
'vgdev_output_init':>> drivers/gpu/drm/virtio/virtgpu_display.c:276:2: error: implicit
declaration of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 3 include/linux/slab.h:kmalloc_type
   Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 4 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1
include/drm/drm_modeset_helper_vtables.h:drm_crtc_helper_add
   Cyclomatic Complexity 1
include/drm/drm_modeset_helper_vtables.h:drm_encoder_helper_add
   Cyclomatic Complexity 1
include/drm/drm_modeset_helper_vtables.h:drm_connector_helper_add
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_atomic_enable
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_atomic_check
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_atomic_flush
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_enc_mode_set
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_enc_enable
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_enc_disable
   Cyclomatic Complexity 2
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_conn_detect
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:vgdev_atomic_commit_tail
   Cyclomatic Complexity 67 include/asm-generic/getorder.h:get_order
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 2
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_framebuffer_init
   Cyclomatic Complexity 5
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_user_framebuffer_create
   Cyclomatic Complexity 5
drivers/gpu/drm/virtio/virtgpu_display.c:vgdev_output_init
   Cyclomatic Complexity 8
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_conn_mode_valid
   Cyclomatic Complexity 4
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_conn_get_modes
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_conn_destroy
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_atomic_disable
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_mode_set_nofb
   Cyclomatic Complexity 2
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_modeset_init
   Cyclomatic Complexity 2
drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_modeset_fini
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:_GLOBAL__sub_I_00100_0_virtio_gpu_modeset_init
   Cyclomatic Complexity 1
drivers/gpu/drm/virtio/virtgpu_display.c:_GLOBAL__sub_D_00100_1_virtio_gpu_modeset_init
   cc1: some warnings being treated as errors
vim +276 drivers/gpu/drm/virtio/virtgpu_display.c
   243	
   244	static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
   245	{
   246		struct drm_device *dev = vgdev->ddev;
   247		struct virtio_gpu_output *output = vgdev->outputs + index;
   248		struct drm_connector *connector = &output->conn;
   249		struct drm_encoder *encoder = &output->enc;
   250		struct drm_crtc *crtc = &output->crtc;
   251		struct drm_plane *primary, *cursor;
   252	
   253		output->index = index;
   254		if (index == 0) {
   255			output->info.enabled = cpu_to_le32(true);
   256			output->info.r.width = cpu_to_le32(XRES_DEF);
   257			output->info.r.height = cpu_to_le32(YRES_DEF);
   258		}
   259	
   260		primary = virtio_gpu_plane_init(vgdev, DRM_PLANE_TYPE_PRIMARY, index);
   261		if (IS_ERR(primary))
   262			return PTR_ERR(primary);
   263		cursor = virtio_gpu_plane_init(vgdev, DRM_PLANE_TYPE_CURSOR, index);
   264		if (IS_ERR(cursor))
   265			return PTR_ERR(cursor);
   266		drm_crtc_init_with_planes(dev, crtc, primary, cursor,
   267					  &virtio_gpu_crtc_funcs, NULL);
   268		drm_crtc_helper_add(crtc, &virtio_gpu_crtc_helper_funcs);
   269	
   270		drm_connector_init(dev, connector, &virtio_gpu_connector_funcs,
   271				   DRM_MODE_CONNECTOR_VIRTUAL);
   272		drm_connector_helper_add(connector, &virtio_gpu_conn_helper_funcs);
   273		if (vgdev->has_edid)
   274			drm_connector_attach_edid_property(connector);
   275	
 > 276		drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
   277		drm_encoder_helper_add(encoder, &virtio_gpu_enc_helper_funcs);
   278		encoder->possible_crtcs = 1 << index;
   279	
   280		drm_connector_attach_encoder(connector, encoder);
   281		drm_connector_register(connector);
   282		return 0;
   283	}
   284	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 38019 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200307/0e712006/attachment-0001.gz>
Hi Thomas,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20200305]
[also build test ERROR on v5.6-rc4]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next
tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to
specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url:   
https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: x86_64-randconfig-h002-20200307 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
All errors (new ones prefixed by >>):
   drivers/gpu/drm/i2c/tda998x_drv.c: In function
'tda998x_encoder_init':>> drivers/gpu/drm/i2c/tda998x_drv.c:2018:8: error: implicit declaration
of function 'drm_simple_encoder_init'; did you mean
'drm_encoder_init'? [-Werror=implicit-function-declaration]
     ret = drm_simple_encoder_init(drm, &priv->encoder,
           ^~~~~~~~~~~~~~~~~~~~~~~
           drm_encoder_init
   cc1: some warnings being treated as errors
vim +2018 drivers/gpu/drm/i2c/tda998x_drv.c
  2000	
  2001	static int tda998x_encoder_init(struct device *dev, struct drm_device
*drm)
  2002	{
  2003		struct tda998x_priv *priv = dev_get_drvdata(dev);
  2004		u32 crtcs = 0;
  2005		int ret;
  2006	
  2007		if (dev->of_node)
  2008			crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
  2009	
  2010		/* If no CRTCs were found, fall back to our old behaviour */
  2011		if (crtcs == 0) {
  2012			dev_warn(dev, "Falling back to first CRTC\n");
  2013			crtcs = 1 << 0;
  2014		}
  2015	
  2016		priv->encoder.possible_crtcs = crtcs;
  2017	> 2018		ret = drm_simple_encoder_init(drm, &priv->encoder,
  2019					      DRM_MODE_ENCODER_TMDS);
  2020		if (ret)
  2021			goto err_encoder;
  2022	
  2023		ret = drm_bridge_attach(&priv->encoder, &priv->bridge,
NULL, 0);
  2024		if (ret)
  2025			goto err_bridge;
  2026	
  2027		return 0;
  2028	
  2029	err_bridge:
  2030		drm_encoder_cleanup(&priv->encoder);
  2031	err_encoder:
  2032		return ret;
  2033	}
  2034	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 32004 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200307/4106e528/attachment-0001.gz>
On 05/03/2020 16:59, Thomas Zimmermann wrote:> The mediatak driver uses empty implementations for its encoders. Replace > the code with the generic simple encoder. > > Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>Reviewed-by: Matthias Brugger <matthias.bgg at gmail.com>> --- > drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++----------- > drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++----------- > 2 files changed, 6 insertions(+), 22 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c > index 14fbe1c09ce9..9c90c58e5acd 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c > @@ -20,6 +20,7 @@ > #include <drm/drm_bridge.h> > #include <drm/drm_crtc.h> > #include <drm/drm_of.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "mtk_dpi_regs.h" > #include "mtk_drm_ddp_comp.h" > @@ -509,15 +510,6 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi, > return 0; > } > > -static void mtk_dpi_encoder_destroy(struct drm_encoder *encoder) > -{ > - drm_encoder_cleanup(encoder); > -} > - > -static const struct drm_encoder_funcs mtk_dpi_encoder_funcs = { > - .destroy = mtk_dpi_encoder_destroy, > -}; > - > static bool mtk_dpi_encoder_mode_fixup(struct drm_encoder *encoder, > const struct drm_display_mode *mode, > struct drm_display_mode *adjusted_mode) > @@ -596,8 +588,8 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data) > return ret; > } > > - ret = drm_encoder_init(drm_dev, &dpi->encoder, &mtk_dpi_encoder_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + ret = drm_simple_encoder_init(drm_dev, &dpi->encoder, > + DRM_MODE_ENCODER_TMDS); > if (ret) { > dev_err(dev, "Failed to initialize decoder: %d\n", ret); > goto err_unregister; > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > index 0ede69830a9d..a9a25087112f 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -22,6 +22,7 @@ > #include <drm/drm_panel.h> > #include <drm/drm_print.h> > #include <drm/drm_probe_helper.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "mtk_drm_ddp_comp.h" > > @@ -787,15 +788,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) > dsi->enabled = false; > } > > -static void mtk_dsi_encoder_destroy(struct drm_encoder *encoder) > -{ > - drm_encoder_cleanup(encoder); > -} > - > -static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = { > - .destroy = mtk_dsi_encoder_destroy, > -}; > - > static bool mtk_dsi_encoder_mode_fixup(struct drm_encoder *encoder, > const struct drm_display_mode *mode, > struct drm_display_mode *adjusted_mode) > @@ -888,8 +880,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi) > { > int ret; > > - ret = drm_encoder_init(drm, &dsi->encoder, &mtk_dsi_encoder_funcs, > - DRM_MODE_ENCODER_DSI, NULL); > + ret = drm_simple_encoder_init(drm, &dsi->encoder, > + DRM_MODE_ENCODER_DSI); > if (ret) { > DRM_ERROR("Failed to encoder init to drm\n"); > return ret; >
Hi, Thomas: On Thu, 2020-03-05 at 16:59 +0100, Thomas Zimmermann wrote:> The mediatak driver uses empty implementations for its encoders. Replace > the code with the generic simple encoder. >Acked-by: CK Hu <ck.hu at mediatek.com>> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de> > --- > drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++----------- > drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++----------- > 2 files changed, 6 insertions(+), 22 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c > index 14fbe1c09ce9..9c90c58e5acd 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c > @@ -20,6 +20,7 @@ > #include <drm/drm_bridge.h> > #include <drm/drm_crtc.h> > #include <drm/drm_of.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "mtk_dpi_regs.h" > #include "mtk_drm_ddp_comp.h" > @@ -509,15 +510,6 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi, > return 0; > } > > -static void mtk_dpi_encoder_destroy(struct drm_encoder *encoder) > -{ > - drm_encoder_cleanup(encoder); > -} > - > -static const struct drm_encoder_funcs mtk_dpi_encoder_funcs = { > - .destroy = mtk_dpi_encoder_destroy, > -}; > - > static bool mtk_dpi_encoder_mode_fixup(struct drm_encoder *encoder, > const struct drm_display_mode *mode, > struct drm_display_mode *adjusted_mode) > @@ -596,8 +588,8 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data) > return ret; > } > > - ret = drm_encoder_init(drm_dev, &dpi->encoder, &mtk_dpi_encoder_funcs, > - DRM_MODE_ENCODER_TMDS, NULL); > + ret = drm_simple_encoder_init(drm_dev, &dpi->encoder, > + DRM_MODE_ENCODER_TMDS); > if (ret) { > dev_err(dev, "Failed to initialize decoder: %d\n", ret); > goto err_unregister; > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > index 0ede69830a9d..a9a25087112f 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -22,6 +22,7 @@ > #include <drm/drm_panel.h> > #include <drm/drm_print.h> > #include <drm/drm_probe_helper.h> > +#include <drm/drm_simple_kms_helper.h> > > #include "mtk_drm_ddp_comp.h" > > @@ -787,15 +788,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) > dsi->enabled = false; > } > > -static void mtk_dsi_encoder_destroy(struct drm_encoder *encoder) > -{ > - drm_encoder_cleanup(encoder); > -} > - > -static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = { > - .destroy = mtk_dsi_encoder_destroy, > -}; > - > static bool mtk_dsi_encoder_mode_fixup(struct drm_encoder *encoder, > const struct drm_display_mode *mode, > struct drm_display_mode *adjusted_mode) > @@ -888,8 +880,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi) > { > int ret; > > - ret = drm_encoder_init(drm, &dsi->encoder, &mtk_dsi_encoder_funcs, > - DRM_MODE_ENCODER_DSI, NULL); > + ret = drm_simple_encoder_init(drm, &dsi->encoder, > + DRM_MODE_ENCODER_DSI); > if (ret) { > DRM_ERROR("Failed to encoder init to drm\n"); > return ret;
Hi Am 24.03.20 um 12:59 schrieb Rodrigo Siqueira:> Hi Thomas, > > First of all, thanks for your patch! > > I applied all your series, compiled it, and when I tried > `make INSTALL_MOD_PATH=/PATH/ modules_instal` I got the following > message: > > depmod: ERROR: Cycle detected: drm_kms_helper -> drm -> drm_kms_helper > depmod: ERROR: Found 2 modules in dependency cycles! > make: *** [Makefile:1317: _modinst_post] Error 1 > > I cleaned up my local files and tried again, but I got the same error; > If I just use `drm-misc-next` everything is fine. Did I miss something?I figured out that this problem is caused by the patch for the writeback encoder, which is located in the DRM core. I'll drop the patch. Thanks for testing! Best regards Thomas> > Thanks > > On 03/05, Thomas Zimmermann wrote: >> The vkms driver uses an empty implementation for its encoder. Replace >> the code with the generic simple encoder. >> >> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de> >> --- >> drivers/gpu/drm/vkms/vkms_output.c | 8 ++------ >> 1 file changed, 2 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c >> index fb1941a6522c..85afb77e97f0 100644 >> --- a/drivers/gpu/drm/vkms/vkms_output.c >> +++ b/drivers/gpu/drm/vkms/vkms_output.c >> @@ -3,6 +3,7 @@ >> #include "vkms_drv.h" >> #include <drm/drm_atomic_helper.h> >> #include <drm/drm_probe_helper.h> >> +#include <drm/drm_simple_kms_helper.h> >> >> static void vkms_connector_destroy(struct drm_connector *connector) >> { >> @@ -17,10 +18,6 @@ static const struct drm_connector_funcs vkms_connector_funcs = { >> .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, >> }; >> >> -static const struct drm_encoder_funcs vkms_encoder_funcs = { >> - .destroy = drm_encoder_cleanup, >> -}; >> - >> static int vkms_conn_get_modes(struct drm_connector *connector) >> { >> int count; >> @@ -70,8 +67,7 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) >> >> drm_connector_helper_add(connector, &vkms_conn_helper_funcs); >> >> - ret = drm_encoder_init(dev, encoder, &vkms_encoder_funcs, >> - DRM_MODE_ENCODER_VIRTUAL, NULL); >> + ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL); >> if (ret) { >> DRM_ERROR("Failed to init encoder\n"); >> goto err_encoder; >> -- >> 2.25.1 >> > > > _______________________________________________ > dri-devel mailing list > dri-devel at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel >-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N?rnberg, Germany (HRB 36809, AG N?rnberg) Gesch?ftsf?hrer: Felix Imend?rffer -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20200401/34b350c9/attachment.sig>