From: Gareth Hughes Date: Sun, 18 Mar 2001 23:54:41 +0000 (+0000) Subject: __REALLY_HAVE_MTRR, vmalloc_32 fixes from Jeff Wiedemeier. X-Git-Tag: libdrm-1_0_0~991 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2ad4d9bebd052e5b7c9a90c4a813830bd1b72f8;p=platform%2Fupstream%2Flibdrm.git __REALLY_HAVE_MTRR, vmalloc_32 fixes from Jeff Wiedemeier. --- diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c index 1d54032..63cfb0d 100644 --- a/linux-core/drm_bufs.c +++ b/linux-core/drm_bufs.c @@ -30,6 +30,7 @@ */ #define __NO_VERSION__ +#include #include "drmP.h" #ifndef __HAVE_PCI_DMA @@ -109,7 +110,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp, return -EINVAL; } #endif -#ifdef __REALLY_HAVE_MTRR +#if __REALLY_HAVE_MTRR if ( map->type == _DRM_FRAME_BUFFER || (map->flags & _DRM_WRITE_COMBINING) ) { map->mtrr = mtrr_add( map->offset, map->size, @@ -171,7 +172,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp, * isn't in use. */ -int DRM(rmmap)(struct inode *inode, struct file *filp, +int DRM(rmmap)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; @@ -183,7 +184,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp, drm_map_t request; int found_maps = 0; - if (copy_from_user(&request, (drm_map_t *)arg, + if (copy_from_user(&request, (drm_map_t *)arg, sizeof(request))) { return -EFAULT; } @@ -221,7 +222,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp, switch (map->type) { case _DRM_REGISTERS: case _DRM_FRAME_BUFFER: -#ifdef __REALLY_HAVE_MTRR +#if __REALLY_HAVE_MTRR if (map->mtrr >= 0) { int retcode; retcode = mtrr_del(map->mtrr, diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index 123eea2..fb51926 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -156,7 +156,7 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma) } } /* We were the only map that was found */ - if(found_maps == 1 && + if(found_maps == 1 && map->flags & _DRM_REMOVABLE) { /* Check to see if we are in the maplist, if we are not, then * we delete this mappings information. @@ -172,7 +172,7 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma) switch (map->type) { case _DRM_REGISTERS: case _DRM_FRAME_BUFFER: -#ifdef __REALLY_HAVE_MTRR +#if __REALLY_HAVE_MTRR if (map->mtrr >= 0) { int retcode; retcode = mtrr_del(map->mtrr, diff --git a/linux/drm_bufs.h b/linux/drm_bufs.h index 1d54032..63cfb0d 100644 --- a/linux/drm_bufs.h +++ b/linux/drm_bufs.h @@ -30,6 +30,7 @@ */ #define __NO_VERSION__ +#include #include "drmP.h" #ifndef __HAVE_PCI_DMA @@ -109,7 +110,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp, return -EINVAL; } #endif -#ifdef __REALLY_HAVE_MTRR +#if __REALLY_HAVE_MTRR if ( map->type == _DRM_FRAME_BUFFER || (map->flags & _DRM_WRITE_COMBINING) ) { map->mtrr = mtrr_add( map->offset, map->size, @@ -171,7 +172,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp, * isn't in use. */ -int DRM(rmmap)(struct inode *inode, struct file *filp, +int DRM(rmmap)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; @@ -183,7 +184,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp, drm_map_t request; int found_maps = 0; - if (copy_from_user(&request, (drm_map_t *)arg, + if (copy_from_user(&request, (drm_map_t *)arg, sizeof(request))) { return -EFAULT; } @@ -221,7 +222,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp, switch (map->type) { case _DRM_REGISTERS: case _DRM_FRAME_BUFFER: -#ifdef __REALLY_HAVE_MTRR +#if __REALLY_HAVE_MTRR if (map->mtrr >= 0) { int retcode; retcode = mtrr_del(map->mtrr, diff --git a/linux/drm_vm.h b/linux/drm_vm.h index 123eea2..fb51926 100644 --- a/linux/drm_vm.h +++ b/linux/drm_vm.h @@ -156,7 +156,7 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma) } } /* We were the only map that was found */ - if(found_maps == 1 && + if(found_maps == 1 && map->flags & _DRM_REMOVABLE) { /* Check to see if we are in the maplist, if we are not, then * we delete this mappings information. @@ -172,7 +172,7 @@ void DRM(vm_shm_close)(struct vm_area_struct *vma) switch (map->type) { case _DRM_REGISTERS: case _DRM_FRAME_BUFFER: -#ifdef __REALLY_HAVE_MTRR +#if __REALLY_HAVE_MTRR if (map->mtrr >= 0) { int retcode; retcode = mtrr_del(map->mtrr,