summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Config.in11
-rw-r--r--drivers/char/drm/Makefile114
-rw-r--r--drivers/char/drm/auth.c2
-rw-r--r--drivers/char/drm/bufs.c2
-rw-r--r--drivers/char/drm/drmP.h18
-rw-r--r--drivers/char/drm/ffb_drv.c5
-rw-r--r--drivers/char/drm/gamma_drv.c26
-rw-r--r--drivers/char/drm/gamma_drv.h2
-rw-r--r--drivers/char/drm/i810_drv.c16
-rw-r--r--drivers/char/drm/i810_drv.h2
-rw-r--r--drivers/char/drm/memory.c2
-rw-r--r--drivers/char/drm/mga_drv.c14
-rw-r--r--drivers/char/drm/mga_drv.h2
-rw-r--r--drivers/char/drm/proc.c6
-rw-r--r--drivers/char/drm/r128_bufs.c4
-rw-r--r--drivers/char/drm/r128_drv.c24
-rw-r--r--drivers/char/drm/r128_drv.h2
-rw-r--r--drivers/char/drm/tdfx_drv.c31
-rw-r--r--drivers/char/drm/tdfx_drv.h2
-rw-r--r--drivers/char/drm/vm.c2
20 files changed, 119 insertions, 168 deletions
diff --git a/drivers/char/Config.in b/drivers/char/Config.in
index ae79962f4..f41c3d48b 100644
--- a/drivers/char/Config.in
+++ b/drivers/char/Config.in
@@ -257,15 +257,6 @@ if [ "$CONFIG_FTAPE" != "n" ]; then
fi
endmenu
-bool 'Direct Rendering Manager (XFree86 DRI support)' CONFIG_DRM
-if [ "$CONFIG_DRM" = "y" ]; then
- tristate ' 3dfx Banshee/Voodoo3+' CONFIG_DRM_TDFX
- tristate ' 3dlabs GMX 2000' CONFIG_DRM_GAMMA
- tristate ' ATI Rage 128' CONFIG_DRM_R128
- tristate ' Intel I810' CONFIG_DRM_I810
- tristate ' Matrox g200/g400' CONFIG_DRM_MGA
-fi
-
tristate '/dev/agpgart (AGP Support)' CONFIG_AGP $CONFIG_DRM_AGP
if [ "$CONFIG_AGP" != "n" ]; then
bool ' Intel 440LX/BX/GX support' CONFIG_AGP_INTEL
@@ -276,6 +267,8 @@ if [ "$CONFIG_AGP" != "n" ]; then
bool ' ALI M1541 support' CONFIG_AGP_ALI
fi
+source drivers/char/drm/Config.in
+
if [ "$CONFIG_HOTPLUG" = "y" -a "$CONFIG_PCMCIA" != "n" ]; then
source drivers/char/pcmcia/Config.in
fi
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
index 3bb727c27..5ae783f3e 100644
--- a/drivers/char/drm/Makefile
+++ b/drivers/char/drm/Makefile
@@ -2,88 +2,76 @@
# Makefile for the drm device driver. This driver provides support for
# the Direct Rendering Infrastructure (DRI) in XFree86 4.x.
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# Note 2! The CFLAGS definitions are now inherited from the
-# parent makes..
-#
-
-O_OBJS :=
-OX_OBJS :=
-M_OBJS :=
-MX_OBJS :=
-
-# Object file lists.
-
-obj-y :=
-obj-m :=
-obj-n :=
-obj- :=
-SUB_DIRS :=
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS)
+O_TARGET = drm.o
+
+export-objs = drm_syms.o
+list-multi = drm.o gamma.o tdfx.o r128.o ffb.o mga.o i810.o
+drm-objs = init.o memory.o proc.o auth.o context.o \
+ drawable.o bufs.o lists.o lock.o ioctl.o \
+ fops.o vm.o dma.o ctxbitmap.o drm_syms.o
+gamma-objs = gamma_drv.o gamma_dma.o
+tdfx-objs = tdfx_drv.o tdfx_context.o
+r128-objs = r128_drv.o r128_context.o r128_dma.o r128_bufs.o
+ffb-objs = ffb_drv.o ffb_context.o
+mga-objs = mga_drv.o mga_context.o mga_dma.o mga_bufs.o mga_state.o
+i810-objs = i810_drv.o i810_context.o i810_dma.o i810_bufs.o
+
+ifeq ($(CONFIG_AGP), y)
+ drm-objs += agpsupport.o
+else
+ ifeq ($(CONFIG_AGP), m)
+ drm-objs += agpsupport.o
+ endif
+endif
-O_TARGET := drm.o
-module-list := gamma.o tdfx.o r128.o ffb.o mga.o i810.o
-export-objs := $(patsubst %.o,%_drv.o,$(module-list))
+obj-$(CONFIG_DRM) += drm.o
+obj-$(CONFIG_DRM_GAMMA) += gamma.o
+obj-$(CONFIG_DRM_TDFX) += tdfx.o
+obj-$(CONFIG_DRM_R128) += r128.o
+obj-$(CONFIG_DRM_FFB) += ffb.o
+obj-$(CONFIG_DRM_MGA) += mga.o
+obj-$(CONFIG_DRM_I810) += i810.o
-lib-objs := init.o memory.o proc.o auth.o context.o drawable.o bufs.o
-lib-objs += lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o
-ifneq ($(CONFIG_AGP),)
- lib-objs += agpsupport.o
-endif
+# Extract lists of the multi-part drivers.
+# The 'int-*' lists are the intermediate files used to build the multi's.
+multi-y := $(filter $(list-multi), $(obj-y))
+multi-m := $(filter $(list-multi), $(obj-m))
+int-y := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs)))
+int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
-gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o
-tdfx-objs := $(lib-objs) tdfx_drv.o tdfx_context.o
-r128-objs := $(lib-objs) r128_drv.o r128_dma.o r128_context.o r128_bufs.o
-ffb-objs := $(lib-objs) ffb_drv.o ffb_context.o
-mga-objs := $(lib-objs) mga_drv.o mga_dma.o mga_context.o mga_bufs.o \
- mga_state.o
-i810-objs := $(lib-objs) i810_drv.o i810_dma.o i810_context.o i810_bufs.o
-
-obj-$(CONFIG_DRM_GAMMA) += gamma.o $(gamma-objs)
-obj-$(CONFIG_DRM_TDFX) += tdfx.o $(tdfx-objs)
-obj-$(CONFIG_DRM_R128) += r128.o $(r128-objs)
-obj-$(CONFIG_DRM_FFB) += ffb.o $(ffb-objs)
-
-ifneq ($CONFIG_AGP),)
-obj-$(CONFIG_DRM_MGA) += mga.o $(mga-objs)
-obj-$(CONFIG_DRM_I810) += i810.o $(i810-objs)
-endif
+# Files that are both resident and modular: remove from modular.
+obj-m := $(filter-out $(obj-y), $(obj-m))
+int-m := $(filter-out $(int-y), $(int-m))
-# Take module names out of obj-y and int-m
-
-obj-y := $(filter-out $(module-list), $(obj-y))
-int-m := $(filter-out $(module-list), $(obj-m))
+# Take multi-part drivers out of obj-y and put components in.
+obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y)
# Translate to Rules.make lists.
-
-O_OBJS := $(filter-out $(export-objs), $(obj-y))
-OX_OBJS := $(filter $(export-objs), $(obj-y))
-M_OBJS := $(sort $(filter $(module-list), $(obj-m)))
-MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m)))
-MIX_OBJS := $(sort $(filter $(export-objs), $(int-m)))
+O_OBJS := $(filter-out $(export-objs), $(obj-y))
+OX_OBJS := $(filter $(export-objs), $(obj-y))
+M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m)))
+MX_OBJS := $(sort $(filter $(export-objs), $(obj-m)))
+MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m)))
+MIX_OBJS := $(sort $(filter $(export-objs), $(int-m)))
include $(TOPDIR)/Rules.make
gamma.o: $(gamma-objs)
- $(LD) $(LD_RFLAG) -r -o $@ $(gamma-objs)
+ $(LD) -r -o $@ $(gamma-objs)
tdfx.o: $(tdfx-objs)
- $(LD) $(LD_RFLAG) -r -o $@ $(tdfx-objs)
+ $(LD) -r -o $@ $(tdfx-objs)
mga.o: $(mga-objs)
- $(LD) $(LD_RFLAG) -r -o $@ $(mga-objs)
+ $(LD) -r -o $@ $(mga-objs)
i810.o: $(i810-objs)
- $(LD) $(LD_RFLAG) -r -o $@ $(i810-objs)
+ $(LD) -r -o $@ $(i810-objs)
r128.o: $(r128-objs)
- $(LD) $(LD_RFLAG) -r -o $@ $(r128-objs)
+ $(LD) -r -o $@ $(r128-objs)
ffb.o: $(ffb-objs)
- $(LD) $(LD_RFLAG) -r -o $@ $(ffb-objs)
+ $(LD) -r -o $@ $(ffb-objs)
diff --git a/drivers/char/drm/auth.c b/drivers/char/drm/auth.c
index 9f81c5391..3ee85388e 100644
--- a/drivers/char/drm/auth.c
+++ b/drivers/char/drm/auth.c
@@ -45,6 +45,8 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
down(&dev->struct_sem);
for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
+ if (pt->priv->authenticated)
+ continue;
if (pt->magic == magic) {
retval = pt->priv;
break;
diff --git a/drivers/char/drm/bufs.c b/drivers/char/drm/bufs.c
index fd3b12488..c00f051a8 100644
--- a/drivers/char/drm/bufs.c
+++ b/drivers/char/drm/bufs.c
@@ -106,7 +106,7 @@ int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd,
dev->lock.hw_lock = map->handle; /* Pointer to lock */
}
break;
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
case _DRM_AGP:
map->offset = map->offset + dev->agp->base;
break;
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index d8791bf95..afc4fd43e 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -51,9 +51,6 @@
#include <asm/mtrr.h>
#endif
#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
-#define DRM_AGP
-#endif
-#ifdef DRM_AGP
#include <linux/types.h>
#include <linux/agp_backend.h>
#endif
@@ -410,7 +407,7 @@ typedef struct drm_device_dma {
wait_queue_head_t waiting; /* Processes waiting on free bufs */
} drm_device_dma_t;
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
typedef struct drm_agp_mem {
unsigned long handle;
agp_memory *memory;
@@ -499,9 +496,9 @@ typedef struct drm_device {
/* Context support */
int irq; /* Interrupt used by board */
- __volatile__ int context_flag; /* Context swapping flag */
- __volatile__ int interrupt_flag;/* Interruption handler flag */
- __volatile__ int dma_flag; /* DMA dispatch flag */
+ __volatile__ long context_flag; /* Context swapping flag */
+ __volatile__ long interrupt_flag; /* Interruption handler flag */
+ __volatile__ long dma_flag; /* DMA dispatch flag */
struct timer_list timer; /* Timer for delaying ctx switch */
wait_queue_head_t context_wait; /* Processes waiting on ctx switch */
int last_checked; /* Last context checked for DMA */
@@ -524,7 +521,7 @@ typedef struct drm_device {
wait_queue_head_t buf_readers; /* Processes waiting to read */
wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
drm_agp_head_t *agp;
#endif
unsigned long *ctx_bitmap;
@@ -601,7 +598,7 @@ extern void drm_free_pages(unsigned long address, int order,
extern void *drm_ioremap(unsigned long offset, unsigned long size);
extern void drm_ioremapfree(void *pt, unsigned long size);
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
extern agp_memory *drm_alloc_agp(int pages, u32 type);
extern int drm_free_agp(agp_memory *handle, int pages);
extern int drm_bind_agp(agp_memory *handle, unsigned int start);
@@ -644,7 +641,6 @@ extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid);
extern int drm_context_switch(drm_device_t *dev, int old, int new);
extern int drm_context_switch_complete(drm_device_t *dev, int new);
-extern void drm_wakeup(drm_device_t *dev, drm_buf_t *buf);
extern void drm_clear_next_buffer(drm_device_t *dev);
extern int drm_select_queue(drm_device_t *dev,
void (*wrapper)(unsigned long));
@@ -725,7 +721,7 @@ extern void drm_ctxbitmap_cleanup(drm_device_t *dev);
extern int drm_ctxbitmap_next(drm_device_t *dev);
extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
/* AGP/GART support (agpsupport.c) */
extern drm_agp_head_t *drm_agp_init(void);
extern void drm_agp_uninit(void);
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c
index 10594dd2e..d81685230 100644
--- a/drivers/char/drm/ffb_drv.c
+++ b/drivers/char/drm/ffb_drv.c
@@ -1,4 +1,4 @@
-/* $Id: ffb_drv.c,v 1.4 2000/07/13 08:06:39 davem Exp $
+/* $Id: ffb_drv.c,v 1.5 2000/07/26 01:03:57 davem Exp $
* ffb_drv.c: Creator/Creator3D direct rendering driver.
*
* Copyright (C) 2000 David S. Miller (davem@redhat.com)
@@ -163,6 +163,9 @@ static int ffb_takedown(drm_device_t *dev)
- PAGE_SHIFT,
DRM_MEM_SAREA);
break;
+
+ default:
+ break;
};
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
diff --git a/drivers/char/drm/gamma_drv.c b/drivers/char/drm/gamma_drv.c
index 2450d3a7b..850cc5118 100644
--- a/drivers/char/drm/gamma_drv.c
+++ b/drivers/char/drm/gamma_drv.c
@@ -30,15 +30,11 @@
*/
#include <linux/config.h>
-#ifndef EXPORT_SYMTAB
-#define EXPORT_SYMTAB
-#endif
-#include "drmP.h"
-#include "gamma_drv.h"
+#include <linux/sched.h>
#include <linux/pci.h>
#include <linux/smp_lock.h> /* For (un)lock_kernel */
-EXPORT_SYMBOL(gamma_init);
-EXPORT_SYMBOL(gamma_cleanup);
+#include "drmP.h"
+#include "gamma_drv.h"
#ifndef PCI_DEVICE_ID_3DLABS_GAMMA
#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008
@@ -122,10 +118,6 @@ MODULE_PARM(gamma, "s");
MODULE_PARM(devices, "i");
MODULE_PARM_DESC(devices,
"devices=x, where x is the number of MX chips on card\n");
-
-module_init(gamma_init);
-module_exit(gamma_cleanup);
-
#ifndef MODULE
/* gamma_options is called by the kernel to parse command-line options
* passed via the boot-loader (e.g., LILO). It calls the insmod option
@@ -406,6 +398,10 @@ void gamma_cleanup(void)
gamma_takedown(dev);
}
+module_init(gamma_init);
+module_exit(gamma_cleanup);
+
+
int gamma_version(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -447,7 +443,6 @@ int gamma_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;
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -462,13 +457,14 @@ int gamma_open(struct inode *inode, struct file *filp)
int gamma_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;
- DRM_DEBUG("open_count = %d\n", dev->open_count);
lock_kernel();
+ dev = priv->dev;
+
+ DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_release(inode, filp))) {
- MOD_DEC_USE_COUNT;
atomic_inc(&dev->total_close);
spin_lock(&dev->count_lock);
if (!--dev->open_count) {
diff --git a/drivers/char/drm/gamma_drv.h b/drivers/char/drm/gamma_drv.h
index 2cfbf6c8d..e9ce39589 100644
--- a/drivers/char/drm/gamma_drv.h
+++ b/drivers/char/drm/gamma_drv.h
@@ -33,8 +33,6 @@
#define _GAMMA_DRV_H_
/* gamma_drv.c */
-extern int gamma_init(void);
-extern void gamma_cleanup(void);
extern int gamma_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int gamma_open(struct inode *inode, struct file *filp);
diff --git a/drivers/char/drm/i810_drv.c b/drivers/char/drm/i810_drv.c
index f212f2bf2..eaa71a66b 100644
--- a/drivers/char/drm/i810_drv.c
+++ b/drivers/char/drm/i810_drv.c
@@ -30,18 +30,11 @@
*/
#include <linux/config.h>
-#ifndef EXPORT_SYMTAB
-#define EXPORT_SYMTAB
-#endif
#include "drmP.h"
#include "i810_drv.h"
#include <linux/sched.h>
#include <linux/smp_lock.h>
-
-EXPORT_SYMBOL(i810_init);
-EXPORT_SYMBOL(i810_cleanup);
-
#define I810_NAME "i810"
#define I810_DESC "Intel I810"
#define I810_DATE "20000719"
@@ -134,9 +127,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
MODULE_DESCRIPTION("Intel I810");
MODULE_PARM(i810, "s");
-module_init(i810_init);
-module_exit(i810_cleanup);
-
#ifndef MODULE
/* i810_options is called by the kernel to parse command-line options
* passed via the boot-loader (e.g., LILO). It calls the insmod option
@@ -430,6 +420,10 @@ void i810_cleanup(void)
}
}
+module_init(i810_init);
+module_exit(i810_cleanup);
+
+
int i810_version(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -471,7 +465,6 @@ int i810_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;
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -552,7 +545,6 @@ int i810_release(struct inode *inode, struct file *filp)
up(&dev->struct_sem);
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
- MOD_DEC_USE_COUNT;
atomic_inc(&dev->total_close);
spin_lock(&dev->count_lock);
if (!--dev->open_count) {
diff --git a/drivers/char/drm/i810_drv.h b/drivers/char/drm/i810_drv.h
index f5411c0bc..1c9574017 100644
--- a/drivers/char/drm/i810_drv.h
+++ b/drivers/char/drm/i810_drv.h
@@ -77,8 +77,6 @@ typedef struct drm_i810_private {
} drm_i810_private_t;
/* i810_drv.c */
-extern int i810_init(void);
-extern void i810_cleanup(void);
extern int i810_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i810_open(struct inode *inode, struct file *filp);
diff --git a/drivers/char/drm/memory.c b/drivers/char/drm/memory.c
index f342bb4fe..e1f462bdd 100644
--- a/drivers/char/drm/memory.c
+++ b/drivers/char/drm/memory.c
@@ -330,7 +330,7 @@ void drm_ioremapfree(void *pt, unsigned long size)
}
}
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
agp_memory *drm_alloc_agp(int pages, u32 type)
{
agp_memory *handle;
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index a3072c39e..45653aa56 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -31,15 +31,10 @@
*/
#include <linux/config.h>
-#ifndef EXPORT_SYMTAB
-#define EXPORT_SYMTAB
-#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);
#define MGA_NAME "mga"
#define MGA_DESC "Matrox g200/g400"
@@ -133,9 +128,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
MODULE_DESCRIPTION("Matrox g200/g400");
MODULE_PARM(mga, "s");
-module_init(mga_init);
-module_exit(mga_cleanup);
-
#ifndef MODULE
/* mga_options is called by the kernel to parse command-line options passed
* via the boot-loader (e.g., LILO). It calls the insmod option routine,
@@ -444,6 +436,10 @@ void mga_cleanup(void)
}
}
+module_init(mga_init);
+module_exit(mga_cleanup);
+
+
int mga_version(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -485,7 +481,6 @@ int mga_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;
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -566,7 +561,6 @@ int mga_release(struct inode *inode, struct file *filp)
up(&dev->struct_sem);
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
- MOD_DEC_USE_COUNT;
atomic_inc(&dev->total_close);
spin_lock(&dev->count_lock);
if (!--dev->open_count) {
diff --git a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h
index f217acb97..fe9e3dbe9 100644
--- a/drivers/char/drm/mga_drv.h
+++ b/drivers/char/drm/mga_drv.h
@@ -102,8 +102,6 @@ typedef struct _drm_mga_private {
} drm_mga_private_t;
/* mga_drv.c */
-extern int mga_init(void);
-extern void mga_cleanup(void);
extern int mga_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int mga_open(struct inode *inode, struct file *filp);
diff --git a/drivers/char/drm/proc.c b/drivers/char/drm/proc.c
index 24dfe5f35..ca062a09b 100644
--- a/drivers/char/drm/proc.c
+++ b/drivers/char/drm/proc.c
@@ -521,9 +521,9 @@ static int _drm_histo_info(char *buf, char **start, off_t offset, int len,
} else {
DRM_PROC_PRINT("lock none\n");
}
- DRM_PROC_PRINT("context_flag 0x%08x\n", dev->context_flag);
- DRM_PROC_PRINT("interrupt_flag 0x%08x\n", dev->interrupt_flag);
- DRM_PROC_PRINT("dma_flag 0x%08x\n", dev->dma_flag);
+ DRM_PROC_PRINT("context_flag 0x%08lx\n", dev->context_flag);
+ DRM_PROC_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag);
+ DRM_PROC_PRINT("dma_flag 0x%08lx\n", dev->dma_flag);
DRM_PROC_PRINT("queue_count %10d\n", dev->queue_count);
DRM_PROC_PRINT("last_context %10d\n", dev->last_context);
diff --git a/drivers/char/drm/r128_bufs.c b/drivers/char/drm/r128_bufs.c
index e8ff4df43..d02fc5e00 100644
--- a/drivers/char/drm/r128_bufs.c
+++ b/drivers/char/drm/r128_bufs.c
@@ -36,7 +36,7 @@
#include "linux/un.h"
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
int r128_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -199,7 +199,7 @@ int r128_addbufs(struct inode *inode, struct file *filp, unsigned int cmd,
sizeof(request),
-EFAULT);
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
if (request.flags & _DRM_AGP_BUFFER)
return r128_addbufs_agp(inode, filp, cmd, arg);
else
diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c
index 3e3ace345..27b16614c 100644
--- a/drivers/char/drm/r128_drv.c
+++ b/drivers/char/drm/r128_drv.c
@@ -30,15 +30,10 @@
*/
#include <linux/config.h>
-#ifndef EXPORT_SYMTAB
-#define EXPORT_SYMTAB
-#endif
#include "drmP.h"
#include "r128_drv.h"
#include <linux/sched.h>
#include <linux/smp_lock.h>
-EXPORT_SYMBOL(r128_init);
-EXPORT_SYMBOL(r128_cleanup);
#define R128_NAME "r128"
#define R128_DESC "ATI Rage 128"
@@ -101,7 +96,7 @@ static drm_ioctl_desc_t r128_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_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 },
@@ -129,9 +124,6 @@ MODULE_AUTHOR("VA Linux Systems, Inc.");
MODULE_DESCRIPTION("r128");
MODULE_PARM(r128, "s");
-module_init(r128_init);
-module_exit(r128_cleanup);
-
#ifndef MODULE
/* r128_options is called by the kernel to parse command-line options
* passed via the boot-loader (e.g., LILO). It calls the insmod option
@@ -246,7 +238,7 @@ static int r128_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 *entry;
@@ -358,7 +350,7 @@ int r128_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();
if (dev->agp == NULL) {
DRM_ERROR("Cannot initialize agpgart module.\n");
@@ -411,7 +403,7 @@ void r128_cleanup(void)
}
drm_ctxbitmap_cleanup(dev);
r128_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);
@@ -420,6 +412,10 @@ void r128_cleanup(void)
#endif
}
+module_init(r128_init);
+module_exit(r128_cleanup);
+
+
int r128_version(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -461,7 +457,6 @@ int r128_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;
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -470,6 +465,9 @@ int r128_open(struct inode *inode, struct file *filp)
}
spin_unlock(&dev->count_lock);
}
+
+ unlock_kernel();
+
return retcode;
}
diff --git a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h
index 81390bb8b..5b15dddfb 100644
--- a/drivers/char/drm/r128_drv.h
+++ b/drivers/char/drm/r128_drv.h
@@ -69,8 +69,6 @@ typedef struct drm_r128_buf_priv {
} drm_r128_buf_priv_t;
/* r128_drv.c */
-extern int r128_init(void);
-extern void r128_cleanup(void);
extern int r128_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int r128_open(struct inode *inode, struct file *filp);
diff --git a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c
index 97bd4180b..85f88044d 100644
--- a/drivers/char/drm/tdfx_drv.c
+++ b/drivers/char/drm/tdfx_drv.c
@@ -31,13 +31,10 @@
*/
#include <linux/config.h>
-#ifndef EXPORT_SYMTAB
-#define EXPORT_SYMTAB
-#endif
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
#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 +91,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 +112,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 +224,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;
@@ -330,7 +324,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))) {
@@ -368,7 +362,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 +371,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 +416,6 @@ 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;
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -433,12 +430,14 @@ 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;
atomic_inc(&dev->total_close);
spin_lock(&dev->count_lock);
if (!--dev->open_count) {
@@ -454,6 +453,8 @@ int tdfx_release(struct inode *inode, struct file *filp)
}
spin_unlock(&dev->count_lock);
}
+
+ unlock_kernel();
return retcode;
}
diff --git a/drivers/char/drm/tdfx_drv.h b/drivers/char/drm/tdfx_drv.h
index 6bfcef1d0..bee840e19 100644
--- a/drivers/char/drm/tdfx_drv.h
+++ b/drivers/char/drm/tdfx_drv.h
@@ -34,8 +34,6 @@
#define _TDFX_DRV_H_
/* tdfx_drv.c */
-extern int tdfx_init(void);
-extern void tdfx_cleanup(void);
extern int tdfx_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int tdfx_open(struct inode *inode, struct file *filp);
diff --git a/drivers/char/drm/vm.c b/drivers/char/drm/vm.c
index 8469097a7..01487f965 100644
--- a/drivers/char/drm/vm.c
+++ b/drivers/char/drm/vm.c
@@ -147,7 +147,6 @@ void drm_vm_open(struct vm_area_struct *vma)
DRM_DEBUG("0x%08lx,0x%08lx\n",
vma->vm_start, vma->vm_end - vma->vm_start);
atomic_inc(&dev->vma_count);
- MOD_INC_USE_COUNT;
#if DRM_DEBUG_CODE
vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
@@ -172,7 +171,6 @@ void drm_vm_close(struct vm_area_struct *vma)
DRM_DEBUG("0x%08lx,0x%08lx\n",
vma->vm_start, vma->vm_end - vma->vm_start);
- MOD_DEC_USE_COUNT;
atomic_dec(&dev->vma_count);
#if DRM_DEBUG_CODE