summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/i810_dma.c15
-rw-r--r--linux-core/i810_drv.c2
-rw-r--r--linux-core/i810_drv.h1
-rw-r--r--linux-core/i830_dma.c16
-rw-r--r--linux-core/i830_drv.c2
-rw-r--r--linux-core/i830_drv.h1
6 files changed, 29 insertions, 8 deletions
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index ab33cb19..1ce3e7de 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -110,7 +110,7 @@ static int i810_freelist_put(drm_device_t * dev, drm_buf_t * buf)
return 0;
}
-int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
+static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev;
@@ -138,24 +138,35 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
return 0;
}
+static struct file_operations i810_buffer_fops = {
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = i810_mmap_buffers,
+ .fasync = drm_fasync,
+};
+
static int i810_map_buffer(drm_buf_t * buf, struct file *filp)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->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 6ffa167d..24a5a50d 100644
--- a/linux-core/i810_drv.c
+++ b/linux-core/i810_drv.c
@@ -113,7 +113,7 @@ static struct drm_driver driver = {
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
- .mmap = i810_mmap_buffers,
+ .mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
diff --git a/linux-core/i810_drv.h b/linux-core/i810_drv.h
index 76f2749c..70f4788f 100644
--- a/linux-core/i810_drv.h
+++ b/linux-core/i810_drv.h
@@ -124,7 +124,6 @@ extern int i810_flush_ioctl(struct inode *inode, struct file *filp,
extern void i810_reclaim_buffers(drm_device_t *dev, struct file *filp);
extern int i810_getage(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
-extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
/* Obsolete:
*/
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index 1ff1b5a2..454d82a3 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -111,7 +111,8 @@ static int i830_freelist_put(drm_device_t * dev, drm_buf_t * buf)
return 0;
}
-int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
+
+static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev;
@@ -139,12 +140,21 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
return 0;
}
+static struct file_operations i830_buffer_fops = {
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = i830_mmap_buffers,
+ .fasync = drm_fasync,
+};
+
static int i830_map_buffer(drm_buf_t * buf, struct file *filp)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->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;
@@ -152,11 +162,13 @@ static int i830_map_buffer(drm_buf_t * buf, struct file *filp)
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 0846da6c..0b4a24e4 100644
--- a/linux-core/i830_drv.c
+++ b/linux-core/i830_drv.c
@@ -123,7 +123,7 @@ static struct drm_driver driver = {
.open = drm_open,
.release = drm_release,
.ioctl = drm_ioctl,
- .mmap = i830_mmap_buffers,
+ .mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
},
diff --git a/linux-core/i830_drv.h b/linux-core/i830_drv.h
index d520bba4..553f8d48 100644
--- a/linux-core/i830_drv.h
+++ b/linux-core/i830_drv.h
@@ -132,7 +132,6 @@ extern int i830_flush_ioctl(struct inode *inode, struct file *filp,
extern void i830_reclaim_buffers(drm_device_t *dev, struct file *filp);
extern int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg);
-extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
extern int i830_copybuf(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i830_docopy(struct inode *inode, struct file *filp,