summaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/mga_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/mga_drv.c')
-rw-r--r--drivers/char/drm/mga_drv.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index 30c8880fb..a3072c39e 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -36,6 +36,8 @@
#endif
#include "drmP.h"
#include "mga_drv.h"
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
EXPORT_SYMBOL(mga_init);
EXPORT_SYMBOL(mga_cleanup);
@@ -498,9 +500,11 @@ int mga_open(struct inode *inode, struct file *filp)
int mga_release(struct inode *inode, struct file *filp)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev;
int retcode = 0;
+ lock_kernel();
+ dev = priv->dev;
DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
current->pid, dev->device, dev->open_count);
@@ -571,12 +575,14 @@ int mga_release(struct inode *inode, struct file *filp)
atomic_read(&dev->ioctl_count),
dev->blocked);
spin_unlock(&dev->count_lock);
+ unlock_kernel();
return -EBUSY;
}
spin_unlock(&dev->count_lock);
- return mga_takedown(dev);
- }
- spin_unlock(&dev->count_lock);
+ retcode = mga_takedown(dev);
+ } else
+ spin_unlock(&dev->count_lock);
+ unlock_kernel();
return retcode;
}