diff mbox

[1/6] drm: exynos: use crtc helper drm_crtc_from_index()

Message ID 1483961145-18453-2-git-send-email-shawnguo@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Guo Jan. 9, 2017, 11:25 a.m. UTC
From: Shawn Guo <shawn.guo@linaro.org>

Use drm_crtc_from_index() to find drm_crtc for given index, so that we
do not need to maintain a pointer array in struct exynos_drm_private.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Inki Dae <inki.dae@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c |  6 ------
 drivers/gpu/drm/exynos/exynos_drm_drv.h  | 10 ++--------
 2 files changed, 2 insertions(+), 14 deletions(-)

Comments

Sean Paul Jan. 18, 2017, 3:06 p.m. UTC | #1
On Mon, Jan 9, 2017 at 6:25 AM, Shawn Guo <shawnguo@kernel.org> wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
>
> Use drm_crtc_from_index() to find drm_crtc for given index, so that we
> do not need to maintain a pointer array in struct exynos_drm_private.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

Applied to drm-misc-next

Thanks!

Sean


> Cc: Inki Dae <inki.dae@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c |  6 ------
>  drivers/gpu/drm/exynos/exynos_drm_drv.h  | 10 ++--------
>  2 files changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 2530bf57716a..309c8ee52524 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -109,9 +109,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
>  static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
>  {
>         struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> -       struct exynos_drm_private *private = crtc->dev->dev_private;
> -
> -       private->crtc[exynos_crtc->pipe] = NULL;
>
>         drm_crtc_cleanup(crtc);
>         kfree(exynos_crtc);
> @@ -134,7 +131,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
>                                         void *ctx)
>  {
>         struct exynos_drm_crtc *exynos_crtc;
> -       struct exynos_drm_private *private = drm_dev->dev_private;
>         struct drm_crtc *crtc;
>         int ret;
>
> @@ -149,8 +145,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
>
>         crtc = &exynos_crtc->base;
>
> -       private->crtc[pipe] = crtc;
> -
>         ret = drm_crtc_init_with_planes(drm_dev, crtc, plane, NULL,
>                                         &exynos_crtc_funcs, NULL);
>         if (ret < 0)
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> index 80c4d5b81689..cf6e08cb35a7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> @@ -211,12 +211,6 @@ struct drm_exynos_file_private {
>  struct exynos_drm_private {
>         struct drm_fb_helper *fb_helper;
>
> -       /*
> -        * created crtc object would be contained at this array and
> -        * this array is used to be aware of which crtc did it request vblank.
> -        */
> -       struct drm_crtc *crtc[MAX_CRTC];
> -
>         struct device *dma_dev;
>         void *mapping;
>
> @@ -231,9 +225,9 @@ struct exynos_drm_private {
>  static inline struct exynos_drm_crtc *
>  exynos_drm_crtc_from_pipe(struct drm_device *dev, int pipe)
>  {
> -       struct exynos_drm_private *private = dev->dev_private;
> +       struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
>
> -       return to_exynos_crtc(private->crtc[pipe]);
> +       return to_exynos_crtc(crtc);
>  }
>
>  static inline struct device *to_dma_dev(struct drm_device *dev)
> --
> 1.9.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 2530bf57716a..309c8ee52524 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -109,9 +109,6 @@  static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 {
 	struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-	struct exynos_drm_private *private = crtc->dev->dev_private;
-
-	private->crtc[exynos_crtc->pipe] = NULL;
 
 	drm_crtc_cleanup(crtc);
 	kfree(exynos_crtc);
@@ -134,7 +131,6 @@  struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 					void *ctx)
 {
 	struct exynos_drm_crtc *exynos_crtc;
-	struct exynos_drm_private *private = drm_dev->dev_private;
 	struct drm_crtc *crtc;
 	int ret;
 
@@ -149,8 +145,6 @@  struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 
 	crtc = &exynos_crtc->base;
 
-	private->crtc[pipe] = crtc;
-
 	ret = drm_crtc_init_with_planes(drm_dev, crtc, plane, NULL,
 					&exynos_crtc_funcs, NULL);
 	if (ret < 0)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 80c4d5b81689..cf6e08cb35a7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -211,12 +211,6 @@  struct drm_exynos_file_private {
 struct exynos_drm_private {
 	struct drm_fb_helper *fb_helper;
 
-	/*
-	 * created crtc object would be contained at this array and
-	 * this array is used to be aware of which crtc did it request vblank.
-	 */
-	struct drm_crtc *crtc[MAX_CRTC];
-
 	struct device *dma_dev;
 	void *mapping;
 
@@ -231,9 +225,9 @@  struct exynos_drm_private {
 static inline struct exynos_drm_crtc *
 exynos_drm_crtc_from_pipe(struct drm_device *dev, int pipe)
 {
-	struct exynos_drm_private *private = dev->dev_private;
+	struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
 
-	return to_exynos_crtc(private->crtc[pipe]);
+	return to_exynos_crtc(crtc);
 }
 
 static inline struct device *to_dma_dev(struct drm_device *dev)