[v3,RESEND,06/24] drm/exynos: add exynos_drm_crtc_init function

Submitted by Andrzej Hajda on March 25, 2019, 7:13 a.m.

Details

Message ID 20190325071349.22600-7-a.hajda@samsung.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Andrzej Hajda March 25, 2019, 7:13 a.m.
Since exynos_drm_crtc is a struct which maps 1:1 to underlying device it
is better to put it directly into device's context instead of allocating
it separately. Another benefit is possibility of initialisation of
its fields directly, without expanding exynos_drm_crtc_create which is
already overloaded with number of arguments.
As a first step of the transition initialisation function should be
created.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 10 ++++++++++
 drivers/gpu/drm/exynos/exynos_drm_crtc.h |  2 ++
 2 files changed, 12 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 1eebfa3fa8da..4ff1e0ff2255 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -172,6 +172,16 @@  static const struct drm_crtc_funcs exynos_crtc_funcs = {
 	.disable_vblank = exynos_drm_crtc_disable_vblank,
 };
 
+int exynos_drm_crtc_init(struct exynos_drm_crtc *exynos_crtc,
+			 struct drm_device *drm_dev)
+{
+	struct drm_crtc *crtc = &exynos_crtc->base;
+
+	drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs);
+	return drm_crtc_init_with_planes(drm_dev, crtc, NULL, NULL,
+					 &exynos_crtc_funcs, NULL);
+}
+
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 					struct drm_plane *plane,
 					enum exynos_drm_output_type type,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index dec446109e6c..9e35a9e02332 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -18,6 +18,8 @@ 
 
 #include "exynos_drm_drv.h"
 
+int exynos_drm_crtc_init(struct exynos_drm_crtc *exynos_crtc,
+			 struct drm_device *drm_dev);
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 					struct drm_plane *plane,
 					enum exynos_drm_output_type out_type,