summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drmP.h20
-rw-r--r--linux-core/drm_drv.c15
-rw-r--r--linux-core/drm_fops.c25
-rw-r--r--linux-core/drm_stub.c2
-rw-r--r--linux-core/drm_vm.c1
-rw-r--r--linux-core/ffb_drv.c8
-rw-r--r--linux-core/i810_dma.c14
-rw-r--r--linux-core/i810_drv.c8
-rw-r--r--linux-core/i830_dma.c14
-rw-r--r--linux-core/i830_drv.c8
-rw-r--r--linux-core/i915_drv.c8
-rw-r--r--linux-core/mach64_drv.c8
-rw-r--r--linux-core/mga_drv.c8
-rw-r--r--linux-core/r128_drv.c8
-rw-r--r--linux-core/radeon_drv.c8
-rw-r--r--linux-core/savage_drv.c8
-rw-r--r--linux-core/sis_drv.c8
-rw-r--r--linux-core/tdfx_drv.c8
18 files changed, 101 insertions, 78 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index b1b23b58..d694d661 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -523,11 +523,6 @@ typedef struct drm_vbl_sig {
struct drm_device;
struct drm_driver_fn {
- u32 driver_features;
- int dev_priv_size;
- int permanent_maps;
- drm_ioctl_desc_t *ioctls;
- int num_ioctls;
int (*preinit)(struct drm_device *, unsigned long flags);
void (*prerelease)(struct drm_device *, struct file *filp);
void (*pretakedown)(struct drm_device *);
@@ -558,6 +553,13 @@ struct drm_driver_fn {
unsigned long (*get_reg_ofs)(struct drm_device *dev);
void (*set_version)(struct drm_device *dev, drm_set_version_t *sv);
int (*version)(drm_version_t *version);
+/* variables */
+ u32 driver_features;
+ int dev_priv_size;
+ int permanent_maps;
+ drm_ioctl_desc_t *ioctls;
+ int num_ioctls;
+ struct file_operations fops;
};
@@ -691,8 +693,6 @@ typedef struct drm_device {
drm_sigdata_t sigdata; /**< For block_all_signals */
sigset_t sigmask;
- struct file_operations *fops; /**< file operations */
-
struct drm_driver_fn *fn_tbl;
drm_local_map_t *agp_buffer_map;
} drm_device_t;
@@ -757,13 +757,11 @@ extern int drm_unlock(struct inode *inode, struct file *filp,
extern int drm_fill_in_dev(drm_device_t *dev, struct pci_dev *pdev,
const struct pci_device_id *ent, struct drm_driver_fn *driver_fn);
extern int drm_fb_loaded;
-extern struct file_operations drm_fops;
/* Device support (drm_fops.h) */
extern int drm_open_helper(struct inode *inode, struct file *filp,
drm_device_t *dev);
-extern int drm_flush(struct file *filp);
-extern int drm_fasync(int fd, struct file *filp, int on);
+extern int drm_fasync(int fd, struct file *filp, int on);
/* Mapping support (drm_vm.h) */
extern void drm_vm_open(struct vm_area_struct *vma);
@@ -772,8 +770,6 @@ extern void drm_vm_shm_close(struct vm_area_struct *vma);
extern int drm_mmap_dma(struct file *filp,
struct vm_area_struct *vma);
extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
-extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
-extern ssize_t drm_read(struct file *filp, char __user *buf, size_t count, loff_t *off);
/* Memory management support (drm_memory.h) */
#include "drm_memory.h"
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 669b1a25..c9958815 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -76,18 +76,6 @@ __setup( DRIVER_NAME "=", DRM_OPTIONS_FUNC );
int drm_fb_loaded = 0;
-struct file_operations drm_fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .flush = drm_flush,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .fasync = drm_fasync,
- .poll = drm_poll,
- .read = drm_read,
-};
-
/** Ioctl table */
drm_ioctl_desc_t drm_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { drm_version, 0, 0 },
@@ -384,7 +372,6 @@ int drm_fill_in_dev(drm_device_t *dev, struct pci_dev *pdev, const struct pci_de
sema_init( &dev->ctxlist_sem, 1 );
dev->name = DRIVER_NAME;
- dev->fops = &drm_fops;
dev->pdev = pdev;
#ifdef __alpha__
@@ -630,7 +617,7 @@ void __exit drm_exit (struct pci_driver *driver)
minor = &drm_minors[i];
dev = minor->dev;
DRM_DEBUG("fb loaded release minor %d\n", dev->minor);
- if ((minor->class == DRM_MINOR_PRIMARY) && (dev->fops == &drm_fops)) {
+ if (minor->class == DRM_MINOR_PRIMARY) {
/* release the pci driver */
if (dev->pdev)
pci_dev_put(dev->pdev);
diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c
index 89f64527..0ee303df 100644
--- a/linux-core/drm_fops.c
+++ b/linux-core/drm_fops.c
@@ -116,18 +116,6 @@ out_free:
}
/** No-op. */
-int drm_flush(struct file *filp)
-{
- drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
-
- DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
- current->pid, (long)old_encode_dev(dev->device), dev->open_count);
- return 0;
-}
-EXPORT_SYMBOL(drm_flush);
-
-/** No-op. */
int drm_fasync(int fd, struct file *filp, int on)
{
drm_file_t *priv = filp->private_data;
@@ -140,16 +128,3 @@ int drm_fasync(int fd, struct file *filp, int on)
return 0;
}
EXPORT_SYMBOL(drm_fasync);
-
-/** No-op. */
-unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
-{
- return 0;
-}
-
-
-/** No-op. */
-ssize_t drm_read(struct file *filp, char __user *buf, size_t count, loff_t *off)
-{
- return 0;
-}
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 00188b8c..6333d25d 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -77,7 +77,7 @@ static int stub_open(struct inode *inode, struct file *filp)
return -ENODEV;
old_fops = filp->f_op;
- filp->f_op = fops_get(dev->fops);
+ filp->f_op = fops_get(&dev->fn_tbl->fops);
if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) {
fops_put(filp->f_op);
filp->f_op = fops_get(old_fops);
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index 0895a5bc..e9ec7fac 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -670,3 +670,4 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
drm_vm_open(vma);
return 0;
}
+EXPORT_SYMBOL(drm_mmap);
diff --git a/linux-core/ffb_drv.c b/linux-core/ffb_drv.c
index 15a79738..3799e011 100644
--- a/linux-core/ffb_drv.c
+++ b/linux-core/ffb_drv.c
@@ -321,6 +321,14 @@ static struct drm_driver_fn ffb_driver_fn = {
.reclaim_buffers = drm_core_reclaim_buffers,
.postinit = postinit,
.version = version,
+ fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index 56632aed..fce012b7 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -109,15 +109,6 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf)
return 0;
}
-static struct file_operations i810_buffer_fops = {
- .open = drm_open,
- .flush = drm_flush,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = i810_mmap_buffers,
- .fasync = drm_fasync,
-};
-
int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
{
drm_file_t *priv = filp->private_data;
@@ -151,22 +142,19 @@ static int i810_map_buffer(drm_buf_t *buf, struct file *filp)
drm_device_t *dev = priv->dev;
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
drm_i810_private_t *dev_priv = dev->dev_private;
- struct file_operations *old_fops;
int retcode = 0;
if (buf_priv->currently_mapped == I810_BUF_MAPPED)
return -EINVAL;
down_write( &current->mm->mmap_sem );
- old_fops = filp->f_op;
- filp->f_op = &i810_buffer_fops;
dev_priv->mmap_buffer = buf;
buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total,
PROT_READ|PROT_WRITE,
MAP_SHARED,
buf->bus_address);
dev_priv->mmap_buffer = NULL;
- filp->f_op = old_fops;
+
if ((unsigned long)buf_priv->virtual > -1024UL) {
/* Real error */
DRM_ERROR("mmap error\n");
diff --git a/linux-core/i810_drv.c b/linux-core/i810_drv.c
index 60b3177e..b42df4c1 100644
--- a/linux-core/i810_drv.c
+++ b/linux-core/i810_drv.c
@@ -107,6 +107,14 @@ static struct drm_driver_fn driver_fn = {
.version = version,
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = i810_mmap_buffers,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index 9f2c22e2..835f675e 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -110,15 +110,6 @@ static int i830_freelist_put(drm_device_t *dev, drm_buf_t *buf)
return 0;
}
-static struct file_operations i830_buffer_fops = {
- .open = drm_open,
- .flush = drm_flush,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = i830_mmap_buffers,
- .fasync = drm_fasync,
-};
-
int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
{
drm_file_t *priv = filp->private_data;
@@ -152,20 +143,17 @@ static int i830_map_buffer(drm_buf_t *buf, struct file *filp)
drm_device_t *dev = priv->dev;
drm_i830_buf_priv_t *buf_priv = buf->dev_private;
drm_i830_private_t *dev_priv = dev->dev_private;
- struct file_operations *old_fops;
unsigned long virtual;
int retcode = 0;
if(buf_priv->currently_mapped == I830_BUF_MAPPED) return -EINVAL;
down_write( &current->mm->mmap_sem );
- old_fops = filp->f_op;
- filp->f_op = &i830_buffer_fops;
dev_priv->mmap_buffer = buf;
virtual = do_mmap(filp, 0, buf->total, PROT_READ|PROT_WRITE,
MAP_SHARED, buf->bus_address);
dev_priv->mmap_buffer = NULL;
- filp->f_op = old_fops;
+
if (IS_ERR((void *)virtual)) { /* ugh */
/* Real error */
DRM_ERROR("mmap error\n");
diff --git a/linux-core/i830_drv.c b/linux-core/i830_drv.c
index b2aacc61..55d38c1b 100644
--- a/linux-core/i830_drv.c
+++ b/linux-core/i830_drv.c
@@ -116,6 +116,14 @@ static struct drm_driver_fn driver_fn = {
.version = version,
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = i830_mmap_buffers,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c
index 464a44de..6daeb738 100644
--- a/linux-core/i915_drv.c
+++ b/linux-core/i915_drv.c
@@ -83,6 +83,14 @@ static struct drm_driver_fn driver_fn = {
.version = version,
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/mach64_drv.c b/linux-core/mach64_drv.c
index fb9b6b94..3a65dc1c 100644
--- a/linux-core/mach64_drv.c
+++ b/linux-core/mach64_drv.c
@@ -99,6 +99,14 @@ static struct drm_driver_fn driver_fn = {
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = mach64_dma_buffers,
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c
index 7371bb8c..8787204c 100644
--- a/linux-core/mga_drv.c
+++ b/linux-core/mga_drv.c
@@ -103,6 +103,14 @@ static struct drm_driver_fn driver_fn = {
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = mga_dma_buffers,
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c
index cdf6ea72..9c95518f 100644
--- a/linux-core/r128_drv.c
+++ b/linux-core/r128_drv.c
@@ -113,6 +113,14 @@ static struct drm_driver_fn driver_fn = {
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = r128_cce_buffers,
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/radeon_drv.c b/linux-core/radeon_drv.c
index e73d1744..43c5c7ef 100644
--- a/linux-core/radeon_drv.c
+++ b/linux-core/radeon_drv.c
@@ -154,6 +154,14 @@ static struct drm_driver_fn driver_fn = {
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = radeon_cp_buffers,
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/savage_drv.c b/linux-core/savage_drv.c
index 6304ae20..9f02f81f 100644
--- a/linux-core/savage_drv.c
+++ b/linux-core/savage_drv.c
@@ -292,6 +292,14 @@ static struct drm_driver_fn driver_fn = {
.version = version,
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/sis_drv.c b/linux-core/sis_drv.c
index 79a0d079..d455dbc5 100644
--- a/linux-core/sis_drv.c
+++ b/linux-core/sis_drv.c
@@ -83,6 +83,14 @@ static struct drm_driver_fn driver_fn = {
.version = version,
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c
index 7ea192ca..db00fa5a 100644
--- a/linux-core/tdfx_drv.c
+++ b/linux-core/tdfx_drv.c
@@ -74,6 +74,14 @@ static struct drm_driver_fn driver_fn = {
.get_reg_ofs = drm_core_get_reg_ofs,
.postinit = postinit,
.version = version,
+ .fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)