aboutsummaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorJesse Barnes <jesse.barnes@intel.com>2007-11-01 12:50:03 -0700
committerJesse Barnes <jesse.barnes@intel.com>2007-11-01 12:50:03 -0700
commit00d60265570c866261c09fd3397d5853a1ce196a (patch)
treea3d4757f0754a2c4393e3c997c73c320264df6d9 /linux-core
parent91aae7e683786a48547872b0a5fa92b2232e02c0 (diff)
Cleanup vblank_init and fix drm_irq_install
The vblank_init function wanted a couple of cleanups. Also, drm_irq_install wasn't checking the new return value of irq_postinstall. If it returns a failure, assume IRQs didn't get set up and take appropriate action.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_irq.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index e917e7eb..4aa58d77 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -85,7 +85,7 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
{
int i, ret = -ENOMEM;
- setup_timer(&dev->vblank_disable_timer, vblank_disable_fn,\
+ setup_timer(&dev->vblank_disable_timer, vblank_disable_fn,
(unsigned long)dev);
spin_lock_init(&dev->vbl_lock);
atomic_set(&dev->vbl_signal_pending, 0);
@@ -111,18 +111,16 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
if (!dev->vblank_refcount)
goto err;
- dev->last_vblank = drm_calloc(1, sizeof(u32) * num_crtcs,
- DRM_MEM_DRIVER);
+ dev->last_vblank = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER);
if (!dev->last_vblank)
goto err;
- dev->vblank_premodeset = drm_calloc(1, sizeof(u32) * num_crtcs,
+ dev->vblank_premodeset = drm_calloc(num_crtcs, sizeof(u32),
DRM_MEM_DRIVER);
if (!dev->vblank_premodeset)
goto err;
- dev->vblank_offset = drm_calloc(1, sizeof(u32) * num_crtcs,
- DRM_MEM_DRIVER);
+ dev->vblank_offset = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER);
if (!dev->vblank_offset)
goto err;
@@ -210,6 +208,11 @@ int drm_irq_install(struct drm_device * dev)
/* After installing handler */
ret = dev->driver->irq_postinstall(dev);
+ if (ret < 0) {
+ mutex_lock(&dev->struct_mutex);
+ dev->irq_enabled = 0;
+ mutex_unlock(&dev->struct_mutex);
+ }
return ret;
}