summaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/mga_drv.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-27 23:20:03 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-27 23:20:03 +0000
commit89eba5eb77bbf92ffed6686c951cc35f4027e71f (patch)
treeb56887b1753ca2573002bc7f60e5f3e47c33b116 /drivers/char/drm/mga_drv.c
parentf7ff3f5a67747c7714c3db772d05965a0c033705 (diff)
Merge with Linux 2.4.0-test5-pre5.
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;
}