drm: Avoid calling vblank function is vblank wasn't initialized
authorJerome Glisse <jglisse@redhat.com>
Thu, 7 Jan 2010 14:39:13 +0000 (15:39 +0100)
committerDave Airlie <airlied@redhat.com>
Fri, 8 Jan 2010 03:12:09 +0000 (13:12 +1000)
In some case vblank might not be initialized and we shouldn't
try to use associated function. This patch make sure this is
the case. It also export drm_vblank_cleanup so driver can cleanup
vblank if for any reason IRQ/MSI is not working.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_irq.c

index 7998ee66b3179889273a87b3c1198ce3d0b41d70..b98384dbd9a7ace015a358c6085b01dc5de0a620 100644 (file)
@@ -115,6 +115,7 @@ void drm_vblank_cleanup(struct drm_device *dev)
 
        dev->num_crtcs = 0;
 }
+EXPORT_SYMBOL(drm_vblank_cleanup);
 
 int drm_vblank_init(struct drm_device *dev, int num_crtcs)
 {
@@ -163,7 +164,6 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
        }
 
        dev->vblank_disable_allowed = 0;
-
        return 0;
 
 err:
@@ -493,6 +493,9 @@ EXPORT_SYMBOL(drm_vblank_off);
  */
 void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)
 {
+       /* vblank is not initialized (IRQ not installed ?) */
+       if (!dev->num_crtcs)
+               return;
        /*
         * To avoid all the problems that might happen if interrupts
         * were enabled/disabled around or between these calls, we just