drm/vmwgfx: Get rid of the device-private suspended member
authorThomas Hellstrom <thellstrom@vmware.com>
Thu, 22 Mar 2018 09:30:19 +0000 (10:30 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 22 Mar 2018 11:08:23 +0000 (12:08 +0100)
It was used to early block fbdev dirty processing. Replace it with an
unprotected check of the par->dirty.active field. While this might
race with the vmw_fb_off() function, we do a protected check later so
the race will at worst lead to grabbing and releasing a couple of locks.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c

index c66f32a6a9d9b0869527d895426241e8b02f0ce8..61a03ac90f8c60104ca2b8e705780d6bb24daf3e 100644 (file)
@@ -1449,7 +1449,6 @@ static int vmw_pm_freeze(struct device *kdev)
                DRM_ERROR("Failed to freeze modesetting.\n");
                return ret;
        }
-       dev_priv->suspended = true;
        if (dev_priv->enable_fb)
                vmw_fb_off(dev_priv);
 
@@ -1471,7 +1470,6 @@ static int vmw_pm_freeze(struct device *kdev)
                        vmw_kms_resume(dev);
                if (dev_priv->enable_fb)
                        vmw_fb_on(dev_priv);
-               dev_priv->suspended = false;
                vmw_fb_refresh(dev_priv);
                return -EBUSY;
        }
@@ -1512,7 +1510,6 @@ static int vmw_pm_restore(struct device *kdev)
        if (dev_priv->enable_fb)
                vmw_fb_on(dev_priv);
 
-       dev_priv->suspended = false;
        vmw_fb_refresh(dev_priv);
 
        return 0;
index 0bf28a6528bfbee9dfbcd6c6f188b71121d2211b..fb2f3276ce82c5b6640db4400b96610b46e745e0 100644 (file)
@@ -497,7 +497,6 @@ struct vmw_private {
        struct vmw_master *active_master;
        struct vmw_master fbdev_master;
        struct notifier_block pm_nb;
-       bool suspended;
        bool refuse_hibernation;
        bool suspend_locked;
 
index e85c1868ef12f65fe156df001d2193872b01c4dc..be40cff3e1f6a2d9fe3d7fd7a5c1922f32a99ed2 100644 (file)
@@ -187,7 +187,7 @@ static void vmw_fb_dirty_flush(struct work_struct *work)
        struct vmw_dma_buffer *vbo = par->vmw_bo;
        void *virtual;
 
-       if (vmw_priv->suspended)
+       if (!READ_ONCE(par->dirty.active))
                return;
 
        mutex_lock(&par->bo_mutex);