[PATCH 15/16] drm/armada: Use drm_crtc_vblank_*() API

Thierry Reding thierry.reding at gmail.com
Thu Sep 24 09:35:37 PDT 2015


From: Thierry Reding <treding at nvidia.com>

Non-legacy drivers should only use this API to allow per-CRTC data to be
eventually moved into struct drm_crtc.

Cc: Russell King <rmk+kernel at arm.linux.org.uk>
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
 drivers/gpu/drm/armada/armada_crtc.c | 17 ++++++++---------
 drivers/gpu/drm/armada/armada_drv.c  |  4 ++--
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 01ffe9bffe38..f15efaaff572 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -180,7 +180,7 @@ static int armada_drm_crtc_queue_frame_work(struct armada_crtc *dcrtc,
 	unsigned long flags;
 	int ret;
 
-	ret = drm_vblank_get(dev, dcrtc->num);
+	ret = drm_crtc_vblank_get(&dcrtc->crtc);
 	if (ret) {
 		DRM_ERROR("failed to acquire vblank counter\n");
 		return ret;
@@ -194,14 +194,13 @@ static int armada_drm_crtc_queue_frame_work(struct armada_crtc *dcrtc,
 	spin_unlock_irqrestore(&dev->event_lock, flags);
 
 	if (ret)
-		drm_vblank_put(dev, dcrtc->num);
+		drm_crtc_vblank_put(&dcrtc->crtc);
 
 	return ret;
 }
 
 static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc)
 {
-	struct drm_device *dev = dcrtc->crtc.dev;
 	struct armada_frame_work *work = dcrtc->frame_work;
 
 	dcrtc->frame_work = NULL;
@@ -209,9 +208,9 @@ static void armada_drm_crtc_complete_frame_work(struct armada_crtc *dcrtc)
 	armada_drm_crtc_update_regs(dcrtc, work->regs);
 
 	if (work->event)
-		drm_send_vblank_event(dev, dcrtc->num, work->event);
+		drm_crtc_send_vblank_event(&dcrtc->crtc, work->event);
 
-	drm_vblank_put(dev, dcrtc->num);
+	drm_crtc_vblank_put(&dcrtc->crtc);
 
 	/* Finally, queue the process-half of the cleanup. */
 	__armada_drm_queue_unref_work(dcrtc->crtc.dev, work->old_fb);
@@ -365,13 +364,13 @@ static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat)
 		DRM_ERROR("graphics underflow on crtc %u\n", dcrtc->num);
 
 	if (stat & VSYNC_IRQ)
-		drm_handle_vblank(dcrtc->crtc.dev, dcrtc->num);
+		drm_crtc_handle_vblank(&dcrtc->crtc);
 
 	spin_lock(&dcrtc->irq_lock);
 
 	list_for_each_entry_safe(e, n, &dcrtc->vbl_list, node) {
 		list_del_init(&e->node);
-		drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
+		drm_crtc_vblank_put(&dcrtc->crtc);
 		e->fn(dcrtc, e->data);
 	}
 
@@ -546,9 +545,9 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
 
 	if (interlaced ^ dcrtc->interlaced) {
 		if (adj->flags & DRM_MODE_FLAG_INTERLACE)
-			drm_vblank_get(dcrtc->crtc.dev, dcrtc->num);
+			drm_crtc_vblank_get(&dcrtc->crtc);
 		else
-			drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
+			drm_crtc_vblank_put(&dcrtc->crtc);
 		dcrtc->interlaced = interlaced;
 	}
 
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index a438886fcdb6..01a861e3f605 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -239,7 +239,7 @@ void armada_drm_vbl_event_add(struct armada_crtc *dcrtc,
 	if (list_empty(&evt->node)) {
 		list_add_tail(&evt->node, &dcrtc->vbl_list);
 
-		drm_vblank_get(dcrtc->crtc.dev, dcrtc->num);
+		drm_crtc_vblank_get(&dcrtc->crtc);
 	}
 	spin_unlock_irqrestore(&dcrtc->irq_lock, flags);
 }
@@ -249,7 +249,7 @@ void armada_drm_vbl_event_remove(struct armada_crtc *dcrtc,
 {
 	if (!list_empty(&evt->node)) {
 		list_del_init(&evt->node);
-		drm_vblank_put(dcrtc->crtc.dev, dcrtc->num);
+		drm_crtc_vblank_put(&dcrtc->crtc);
 	}
 }
 
-- 
2.5.0



More information about the dri-devel mailing list