drm/arm/hdlcd: Use drm_mode_config_helper_suspend/resume()
authorNoralf Trønnes <noralf@tronnes.org>
Fri, 8 Dec 2017 19:37:34 +0000 (20:37 +0100)
committerLiviu Dudau <Liviu.Dudau@arm.com>
Tue, 31 Jul 2018 15:31:49 +0000 (16:31 +0100)
Replace driver's code with the generic helpers that do the same thing
including the NULL check.

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
drivers/gpu/drm/arm/hdlcd_drv.c
drivers/gpu/drm/arm/hdlcd_drv.h

index feaa8bc3d7b760a58e2b4e32011ef252a22d85cd..9800a9e388efe8e84d6fd1737cd9d344e08d7ed8 100644 (file)
@@ -27,6 +27,7 @@
 #include <drm/drm_fb_cma_helper.h>
 #include <drm/drm_gem_cma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_modeset_helper.h>
 #include <drm/drm_of.h>
 
 #include "hdlcd_drv.h"
@@ -427,35 +428,15 @@ MODULE_DEVICE_TABLE(of, hdlcd_of_match);
 static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
 {
        struct drm_device *drm = dev_get_drvdata(dev);
-       struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
 
-       if (!hdlcd)
-               return 0;
-
-       drm_kms_helper_poll_disable(drm);
-       drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 1);
-
-       hdlcd->state = drm_atomic_helper_suspend(drm);
-       if (IS_ERR(hdlcd->state)) {
-               drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
-               drm_kms_helper_poll_enable(drm);
-               return PTR_ERR(hdlcd->state);
-       }
-
-       return 0;
+       return drm_mode_config_helper_suspend(drm);
 }
 
 static int __maybe_unused hdlcd_pm_resume(struct device *dev)
 {
        struct drm_device *drm = dev_get_drvdata(dev);
-       struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
-
-       if (!hdlcd)
-               return 0;
 
-       drm_atomic_helper_resume(drm, hdlcd->state);
-       drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
-       drm_kms_helper_poll_enable(drm);
+       drm_mode_config_helper_resume(drm);
 
        return 0;
 }
index 56f34dfff64065640284e5eee100e628f4a59204..58d75d7e1b2054abc477b3e4ab591526bdd82412 100644 (file)
@@ -12,7 +12,6 @@ struct hdlcd_drm_private {
        struct drm_fbdev_cma            *fbdev;
        struct drm_crtc                 crtc;
        struct drm_plane                *plane;
-       struct drm_atomic_state         *state;
 #ifdef CONFIG_DEBUG_FS
        atomic_t buffer_underrun_count;
        atomic_t bus_error_count;