summaryrefslogtreecommitdiff
path: root/linux/tdfx_drv.c
diff options
context:
space:
mode:
authorRik Faith <faith@alephnull.com>2000-08-04 10:04:55 +0000
committerRik Faith <faith@alephnull.com>2000-08-04 10:04:55 +0000
commitf3ae6786f89a4f63dbba93c5519d3792a1744dd7 (patch)
tree0d9ef964855fc32189fd5553373bb9dcf904ed12 /linux/tdfx_drv.c
parentbcad11818296fa58a356175bc7e13060579012d0 (diff)
Sync with Linux 2.4.0-test6-pre2
Diffstat (limited to 'linux/tdfx_drv.c')
-rw-r--r--linux/tdfx_drv.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c
index 97bd4180..ba8c40ce 100644
--- a/linux/tdfx_drv.c
+++ b/linux/tdfx_drv.c
@@ -31,13 +31,8 @@
*/
#include <linux/config.h>
-#ifndef EXPORT_SYMTAB
-#define EXPORT_SYMTAB
-#endif
#include "drmP.h"
#include "tdfx_drv.h"
-EXPORT_SYMBOL(tdfx_init);
-EXPORT_SYMBOL(tdfx_cleanup);
#define TDFX_NAME "tdfx"
#define TDFX_DESC "3dfx Banshee/Voodoo3+"
@@ -94,7 +89,7 @@ static drm_ioctl_desc_t tdfx_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1},
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1},
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1},
@@ -115,9 +110,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
MODULE_DESCRIPTION("tdfx");
MODULE_PARM(tdfx, "s");
-module_init(tdfx_init);
-module_exit(tdfx_cleanup);
-
#ifndef MODULE
/* tdfx_options is called by the kernel to parse command-line options
* passed via the boot-loader (e.g., LILO). It calls the insmod option
@@ -230,7 +222,7 @@ static int tdfx_takedown(drm_device_t *dev)
}
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
}
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
/* Clear AGP information */
if (dev->agp) {
drm_agp_mem_t *temp;
@@ -306,7 +298,7 @@ static int tdfx_takedown(drm_device_t *dev)
/* tdfx_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-int tdfx_init(void)
+static int tdfx_init(void)
{
int retcode;
drm_device_t *dev = &tdfx_device;
@@ -330,7 +322,7 @@ int tdfx_init(void)
drm_mem_init();
drm_proc_init(dev);
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
dev->agp = drm_agp_init();
#endif
if((retcode = drm_ctxbitmap_init(dev))) {
@@ -354,7 +346,7 @@ int tdfx_init(void)
/* tdfx_cleanup is called via cleanup_module at module unload time. */
-void tdfx_cleanup(void)
+static void tdfx_cleanup(void)
{
drm_device_t *dev = &tdfx_device;
@@ -368,7 +360,7 @@ void tdfx_cleanup(void)
}
drm_ctxbitmap_cleanup(dev);
tdfx_takedown(dev);
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
if (dev->agp) {
drm_agp_uninit();
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
@@ -377,6 +369,10 @@ void tdfx_cleanup(void)
#endif
}
+module_init(tdfx_init);
+module_exit(tdfx_cleanup);
+
+
int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -418,7 +414,9 @@ int tdfx_open(struct inode *inode, struct file *filp)
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_open_helper(inode, filp, dev))) {
- MOD_INC_USE_COUNT;
+#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++) {
@@ -433,12 +431,17 @@ int tdfx_open(struct inode *inode, struct file *filp)
int tdfx_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("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) {
@@ -447,13 +450,17 @@ int tdfx_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);
+ unlock_kernel();
return tdfx_takedown(dev);
}
spin_unlock(&dev->count_lock);
}
+
+ unlock_kernel();
return retcode;
}