patch-2.4.0-test6 linux/drivers/char/drm/r128_drv.c
Next file: linux/drivers/char/drm/tdfx_context.c
Previous file: linux/drivers/char/drm/r128_context.c
Back to the patch index
Back to the overall index
- Lines: 88
- Date:
Tue Aug 8 09:27:34 2000
- Orig file:
v2.4.0-test5/linux/drivers/char/drm/r128_drv.c
- Orig date:
Thu Jul 27 17:38:00 2000
diff -u --recursive --new-file v2.4.0-test5/linux/drivers/char/drm/r128_drv.c linux/drivers/char/drm/r128_drv.c
@@ -32,8 +32,6 @@
#include <linux/config.h>
#include "drmP.h"
#include "r128_drv.h"
-#include <linux/sched.h>
-#include <linux/smp_lock.h>
#define R128_NAME "r128"
#define R128_DESC "ATI Rage 128"
@@ -46,8 +44,8 @@
drm_ctx_t r128_res_ctx;
static struct file_operations r128_fops = {
-#if LINUX_VERSION_CODE >= 0x020322
- /* This started being used approx. 2.3.34 */
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
owner: THIS_MODULE,
#endif
open: r128_open,
@@ -325,7 +323,7 @@
/* r128_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-int r128_init(void)
+static int r128_init(void)
{
int retcode;
drm_device_t *dev = &r128_device;
@@ -389,7 +387,7 @@
/* r128_cleanup is called via cleanup_module at module unload time. */
-void r128_cleanup(void)
+static void r128_cleanup(void)
{
drm_device_t *dev = &r128_device;
@@ -457,6 +455,9 @@
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_open_helper(inode, filp, dev))) {
+#if LINUX_VERSION_CODE < 0x020333
+ MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
+#endif
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -466,8 +467,6 @@
spin_unlock(&dev->count_lock);
}
- unlock_kernel();
-
return retcode;
}
@@ -478,10 +477,12 @@
int retcode = 0;
lock_kernel();
- dev = priv->dev;
+ dev = priv->dev;
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_release(inode, filp))) {
- MOD_DEC_USE_COUNT;
+#if LINUX_VERSION_CODE < 0x020333
+ MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
+#endif
atomic_inc(&dev->total_close);
spin_lock(&dev->count_lock);
if (!--dev->open_count) {
@@ -494,10 +495,12 @@
return -EBUSY;
}
spin_unlock(&dev->count_lock);
- retcode = r128_takedown(dev);
- } else
- spin_unlock(&dev->count_lock);
+ unlock_kernel();
+ return r128_takedown(dev);
+ }
+ spin_unlock(&dev->count_lock);
}
+
unlock_kernel();
return retcode;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)