drm: shmobile: use vblank hooks in struct drm_crtc_funcs
authorShawn Guo <shawn.guo@linaro.org>
Tue, 7 Feb 2017 09:16:30 +0000 (17:16 +0800)
committerShawn Guo <shawn.guo@linaro.org>
Thu, 9 Feb 2017 08:10:16 +0000 (16:10 +0800)
The vblank hooks in struct drm_driver are deprecated and only meant for
legacy drivers.  For modern drivers with DRIVER_MODESET flag, the hooks
in struct drm_crtc_funcs should be used instead.

As the result, shmob_drm_crtc_enable_vblank() becomes a static function,
although it gets moved around a bit to save forward declaration.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1486458995-31018-19-git-send-email-shawnguo@kernel.org
drivers/gpu/drm/shmobile/shmob_drm_crtc.c
drivers/gpu/drm/shmobile/shmob_drm_crtc.h
drivers/gpu/drm/shmobile/shmob_drm_drv.c

index 44547655169535991142cc6b164871f38c8c6146..8244890e6d53212133895e165d75c861ef8c1002 100644 (file)
@@ -476,10 +476,45 @@ static int shmob_drm_crtc_page_flip(struct drm_crtc *crtc,
        return 0;
 }
 
+static void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev,
+                                        bool enable)
+{
+       unsigned long flags;
+       u32 ldintr;
+
+       /* Be careful not to acknowledge any pending interrupt. */
+       spin_lock_irqsave(&sdev->irq_lock, flags);
+       ldintr = lcdc_read(sdev, LDINTR) | LDINTR_STATUS_MASK;
+       if (enable)
+               ldintr |= LDINTR_VEE;
+       else
+               ldintr &= ~LDINTR_VEE;
+       lcdc_write(sdev, LDINTR, ldintr);
+       spin_unlock_irqrestore(&sdev->irq_lock, flags);
+}
+
+static int shmob_drm_enable_vblank(struct drm_crtc *crtc)
+{
+       struct shmob_drm_device *sdev = crtc->dev->dev_private;
+
+       shmob_drm_crtc_enable_vblank(sdev, true);
+
+       return 0;
+}
+
+static void shmob_drm_disable_vblank(struct drm_crtc *crtc)
+{
+       struct shmob_drm_device *sdev = crtc->dev->dev_private;
+
+       shmob_drm_crtc_enable_vblank(sdev, false);
+}
+
 static const struct drm_crtc_funcs crtc_funcs = {
        .destroy = drm_crtc_cleanup,
        .set_config = drm_crtc_helper_set_config,
        .page_flip = shmob_drm_crtc_page_flip,
+       .enable_vblank = shmob_drm_enable_vblank,
+       .disable_vblank = shmob_drm_disable_vblank,
 };
 
 int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
@@ -594,22 +629,6 @@ int shmob_drm_encoder_create(struct shmob_drm_device *sdev)
        return 0;
 }
 
-void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev, bool enable)
-{
-       unsigned long flags;
-       u32 ldintr;
-
-       /* Be careful not to acknowledge any pending interrupt. */
-       spin_lock_irqsave(&sdev->irq_lock, flags);
-       ldintr = lcdc_read(sdev, LDINTR) | LDINTR_STATUS_MASK;
-       if (enable)
-               ldintr |= LDINTR_VEE;
-       else
-               ldintr &= ~LDINTR_VEE;
-       lcdc_write(sdev, LDINTR, ldintr);
-       spin_unlock_irqrestore(&sdev->irq_lock, flags);
-}
-
 /* -----------------------------------------------------------------------------
  * Connector
  */
index 818b31549ddcb9b2806a4c48a3f5a6cbf439c108..f152973df11c9859d36df6366ad4e34aea213291 100644 (file)
@@ -47,7 +47,6 @@ struct shmob_drm_connector {
 };
 
 int shmob_drm_crtc_create(struct shmob_drm_device *sdev);
-void shmob_drm_crtc_enable_vblank(struct shmob_drm_device *sdev, bool enable);
 void shmob_drm_crtc_finish_page_flip(struct shmob_drm_crtc *scrtc);
 void shmob_drm_crtc_suspend(struct shmob_drm_crtc *scrtc);
 void shmob_drm_crtc_resume(struct shmob_drm_crtc *scrtc);
index d6b0545d252d28286fb45fc2055e7ee22f9f419e..34fefa0ba0f092cd40ce9850cf26441f588144c4 100644 (file)
@@ -23,7 +23,6 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 
-#include "shmob_drm_crtc.h"
 #include "shmob_drm_drv.h"
 #include "shmob_drm_kms.h"
 #include "shmob_drm_plane.h"
@@ -222,22 +221,6 @@ static irqreturn_t shmob_drm_irq(int irq, void *arg)
        return IRQ_HANDLED;
 }
 
-static int shmob_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-       struct shmob_drm_device *sdev = dev->dev_private;
-
-       shmob_drm_crtc_enable_vblank(sdev, true);
-
-       return 0;
-}
-
-static void shmob_drm_disable_vblank(struct drm_device *dev, unsigned int pipe)
-{
-       struct shmob_drm_device *sdev = dev->dev_private;
-
-       shmob_drm_crtc_enable_vblank(sdev, false);
-}
-
 static const struct file_operations shmob_drm_fops = {
        .owner          = THIS_MODULE,
        .open           = drm_open,
@@ -256,8 +239,6 @@ static struct drm_driver shmob_drm_driver = {
        .load                   = shmob_drm_load,
        .unload                 = shmob_drm_unload,
        .irq_handler            = shmob_drm_irq,
-       .enable_vblank          = shmob_drm_enable_vblank,
-       .disable_vblank         = shmob_drm_disable_vblank,
        .gem_free_object_unlocked = drm_gem_cma_free_object,
        .gem_vm_ops             = &drm_gem_cma_vm_ops,
        .prime_handle_to_fd     = drm_gem_prime_handle_to_fd,