Commit bc5ca1f0 authored by Dave Airlie's avatar Dave Airlie

drm: move fops into drivers

move the drm file operations into the driver.

From: Jon Smirl <jonsmirl@gmail.com>
Approved-by: default avatarDave Airlie <airlied@linux.ie>
parent b717ce0f
...@@ -587,6 +587,7 @@ struct drm_driver { ...@@ -587,6 +587,7 @@ struct drm_driver {
int dev_priv_size; int dev_priv_size;
drm_ioctl_desc_t *ioctls; drm_ioctl_desc_t *ioctls;
int num_ioctls; int num_ioctls;
struct file_operations fops;
struct pci_driver pci_driver; struct pci_driver pci_driver;
}; };
/** /**
...@@ -715,9 +716,6 @@ typedef struct drm_device { ...@@ -715,9 +716,6 @@ typedef struct drm_device {
drm_sigdata_t sigdata; /**< For block_all_signals */ drm_sigdata_t sigdata; /**< For block_all_signals */
sigset_t sigmask; sigset_t sigmask;
struct file_operations *fops; /**< file operations */
struct proc_dir_entry *dev_root; /**< proc directory entry */
struct drm_driver *driver; struct drm_driver *driver;
drm_local_map_t *agp_buffer_map; drm_local_map_t *agp_buffer_map;
} drm_device_t; } drm_device_t;
......
...@@ -55,18 +55,6 @@ ...@@ -55,18 +55,6 @@
#include "drmP.h" #include "drmP.h"
#include "drm_core.h" #include "drm_core.h"
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 */ /** Ioctl table */
drm_ioctl_desc_t drm_ioctls[] = { drm_ioctl_desc_t drm_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { drm_version, 0, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { drm_version, 0, 0 },
...@@ -382,7 +370,6 @@ int drm_fill_in_dev(drm_device_t *dev, struct pci_dev *pdev, const struct pci_de ...@@ -382,7 +370,6 @@ int drm_fill_in_dev(drm_device_t *dev, struct pci_dev *pdev, const struct pci_de
sema_init( &dev->struct_sem, 1 ); sema_init( &dev->struct_sem, 1 );
sema_init( &dev->ctxlist_sem, 1 ); sema_init( &dev->ctxlist_sem, 1 );
dev->fops = &drm_fops;
dev->pdev = pdev; dev->pdev = pdev;
#ifdef __alpha__ #ifdef __alpha__
......
...@@ -149,6 +149,7 @@ unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait) ...@@ -149,6 +149,7 @@ unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
{ {
return 0; return 0;
} }
EXPORT_SYMBOL(drm_poll);
/** No-op. */ /** No-op. */
......
...@@ -79,7 +79,7 @@ static int stub_open(struct inode *inode, struct file *filp) ...@@ -79,7 +79,7 @@ static int stub_open(struct inode *inode, struct file *filp)
return -ENODEV; return -ENODEV;
old_fops = filp->f_op; old_fops = filp->f_op;
filp->f_op = fops_get(dev->fops); filp->f_op = fops_get(&dev->driver->fops);
if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) { if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) {
fops_put(filp->f_op); fops_put(filp->f_op);
filp->f_op = fops_get(old_fops); filp->f_op = fops_get(old_fops);
......
...@@ -667,3 +667,4 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma) ...@@ -667,3 +667,4 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
drm_vm_open(vma); drm_vm_open(vma);
return 0; return 0;
} }
EXPORT_SYMBOL(drm_mmap);
...@@ -107,6 +107,15 @@ static struct drm_driver driver = { ...@@ -107,6 +107,15 @@ static struct drm_driver driver = {
.version = version, .version = version,
.ioctls = ioctls, .ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls), .num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
.mmap = i810_mmap_buffers,
.poll = drm_poll,
.fasync = drm_fasync,
},
.pci_driver = { .pci_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.id_table = pciidlist, .id_table = pciidlist,
......
...@@ -116,6 +116,15 @@ static struct drm_driver driver = { ...@@ -116,6 +116,15 @@ static struct drm_driver driver = {
.version = version, .version = version,
.ioctls = ioctls, .ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls), .num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
.mmap = i830_mmap_buffers,
.poll = drm_poll,
.fasync = drm_fasync,
},
.pci_driver = { .pci_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.id_table = pciidlist, .id_table = pciidlist,
......
...@@ -83,6 +83,15 @@ static struct drm_driver driver = { ...@@ -83,6 +83,15 @@ static struct drm_driver driver = {
.version = version, .version = version,
.ioctls = ioctls, .ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls), .num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
.pci_driver = { .pci_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.id_table = pciidlist, .id_table = pciidlist,
......
...@@ -104,6 +104,15 @@ static struct drm_driver driver = { ...@@ -104,6 +104,15 @@ static struct drm_driver driver = {
.ioctls = ioctls, .ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls), .num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = mga_dma_buffers, .dma_ioctl = mga_dma_buffers,
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
.pci_driver = { .pci_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.id_table = pciidlist, .id_table = pciidlist,
......
...@@ -113,6 +113,15 @@ static struct drm_driver driver = { ...@@ -113,6 +113,15 @@ static struct drm_driver driver = {
.ioctls = ioctls, .ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls), .num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = r128_cce_buffers, .dma_ioctl = r128_cce_buffers,
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
.pci_driver = { .pci_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.id_table = pciidlist, .id_table = pciidlist,
......
...@@ -151,6 +151,15 @@ static struct drm_driver driver = { ...@@ -151,6 +151,15 @@ static struct drm_driver driver = {
.ioctls = ioctls, .ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls), .num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = radeon_cp_buffers, .dma_ioctl = radeon_cp_buffers,
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
.pci_driver = { .pci_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.id_table = pciidlist, .id_table = pciidlist,
......
...@@ -83,6 +83,15 @@ static struct drm_driver driver = { ...@@ -83,6 +83,15 @@ static struct drm_driver driver = {
.version = version, .version = version,
.ioctls = ioctls, .ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls), .num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
.pci_driver = { .pci_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.id_table = pciidlist, .id_table = pciidlist,
......
...@@ -74,6 +74,15 @@ static struct drm_driver driver = { ...@@ -74,6 +74,15 @@ static struct drm_driver driver = {
.get_reg_ofs = drm_core_get_reg_ofs, .get_reg_ofs = drm_core_get_reg_ofs,
.postinit = postinit, .postinit = postinit,
.version = version, .version = version,
.fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
.pci_driver = { .pci_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.id_table = pciidlist, .id_table = pciidlist,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment