From 6bdabcb9945fcd7bfe8424c60f506a147348e6be Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 28 Jun 2017 14:40:58 +0200
Subject: [PATCH] staging/vboxvideo: Use various drm_fb_helper funcs instead of
DIY code
Besides being a nice cleanup, this fixes vobxvideo not building when
fbdev support is disabled in the Kconfig.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/staging/vboxvideo/vbox_drv.c | 13 ++++++-------
drivers/staging/vboxvideo/vbox_drv.h | 1 -
drivers/staging/vboxvideo/vbox_fb.c | 16 +---------------
3 files changed, 7 insertions(+), 23 deletions(-)
@@ -63,25 +63,24 @@ static void vbox_pci_remove(struct pci_dev *pdev)
static int vbox_drm_freeze(struct drm_device *dev)
{
+ struct vbox_private *vbox = dev->dev_private;
+
drm_kms_helper_poll_disable(dev);
pci_save_state(dev->pdev);
- console_lock();
- vbox_fbdev_set_suspend(dev, 1);
- console_unlock();
+ drm_fb_helper_set_suspend_unlocked(&vbox->fbdev->helper, true);
return 0;
}
static int vbox_drm_thaw(struct drm_device *dev)
{
+ struct vbox_private *vbox = dev->dev_private;
+
drm_mode_config_reset(dev);
drm_helper_resume_force_mode(dev);
-
- console_lock();
- vbox_fbdev_set_suspend(dev, 0);
- console_unlock();
+ drm_fb_helper_set_suspend_unlocked(&vbox->fbdev->helper, false);
return 0;
}
@@ -198,7 +198,6 @@ int vbox_framebuffer_init(struct drm_device *dev,
int vbox_fbdev_init(struct drm_device *dev);
void vbox_fbdev_fini(struct drm_device *dev);
-void vbox_fbdev_set_suspend(struct drm_device *dev, int state);
void vbox_fbdev_set_base(struct vbox_private *vbox, unsigned long gpu_addr);
struct vbox_bo {
@@ -341,15 +341,8 @@ void vbox_fbdev_fini(struct drm_device *dev)
struct vbox_private *vbox = dev->dev_private;
struct vbox_fbdev *fbdev = vbox->fbdev;
struct vbox_framebuffer *afb = &fbdev->afb;
- struct fb_info *info;
- if (fbdev->helper.fbdev) {
- info = fbdev->helper.fbdev;
- unregister_framebuffer(info);
- if (info->cmap.len)
- fb_dealloc_cmap(&info->cmap);
- framebuffer_release(info);
- }
+ drm_fb_helper_unregister_fbi(&fbdev->helper);
if (afb->obj) {
struct vbox_bo *bo = gem_to_vbox_bo(afb->obj);
@@ -410,13 +403,6 @@ int vbox_fbdev_init(struct drm_device *dev)
return ret;
}
-void vbox_fbdev_set_suspend(struct drm_device *dev, int state)
-{
- struct vbox_private *vbox = dev->dev_private;
-
- fb_set_suspend(vbox->fbdev->helper.fbdev, state);
-}
-
void vbox_fbdev_set_base(struct vbox_private *vbox, unsigned long gpu_addr)
{
struct fb_info *fbdev = vbox->fbdev->helper.fbdev;
--
2.13.0