From 4791dc885619b1a6460c1fcf48f648945feea4d3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 18 Feb 2006 02:53:36 +0000 Subject: major realigment of DRM CVS with kernel code, makes integration much easier --- linux-core/Makefile | 13 +++++--- linux-core/ati_pcigart.c | 10 +++--- linux-core/drmP.h | 4 +-- linux-core/drm_agpsupport.c | 7 +++-- linux-core/drm_auth.c | 5 +-- linux-core/drm_bufs.c | 76 +++++++++++++++++++++------------------------ linux-core/drm_context.c | 5 +-- linux-core/drm_drv.c | 2 +- linux-core/drm_fops.c | 19 +++++++----- linux-core/drm_lock.c | 15 ++++++--- linux-core/drm_os_linux.h | 15 +++++---- linux-core/drm_pci.c | 16 +++++----- linux-core/drm_stub.c | 5 +-- linux-core/drm_sysfs.c | 4 +-- linux-core/drm_vm.c | 2 +- linux-core/i810_dma.c | 9 +++--- linux-core/i915_drv.c | 4 +-- linux-core/i915_ioc32.c | 15 +++++---- linux-core/via_dmablit.c | 6 ++-- 19 files changed, 123 insertions(+), 109 deletions(-) (limited to 'linux-core') diff --git a/linux-core/Makefile b/linux-core/Makefile index ab3609ba..9bb578cd 100644 --- a/linux-core/Makefile +++ b/linux-core/Makefile @@ -44,10 +44,17 @@ LINUXDIR := $(shell if [ -e /lib/modules/$(RUNNING_REL)/source ]; then \ endif ifndef O -O := $(LINUXDIR) +O := $(shell if [ -e /lib/modules/$(RUNNING_REL)/build ]; then \ + echo /lib/modules/$(RUNNING_REL)/build; \ + else echo ""; fi) +#O := $(LINUXDIR) endif +ifdef ARCH +MACHINE := $(ARCH) +else MACHINE := $(shell uname -m) +endif # Modules for all architectures MODULE_LIST := drm.o tdfx.o r128.o radeon.o mga.o sis.o savage.o via.o \ @@ -61,7 +68,7 @@ endif ifneq (,$(findstring sparc64,$(MACHINE))) ARCHSPARC64 := 1 -MODULE_LIST += ffb.o +#MODULE_LIST += ffb.o endif DRM_MODULES ?= $(MODULE_LIST) @@ -370,7 +377,6 @@ endif # These require AGP support -ifdef CONFIG_AGP ifneq (,$(findstring i810,$(DRM_MODULES))) CONFIG_DRM_I810 := m endif @@ -380,7 +386,6 @@ endif ifneq (,$(findstring i915,$(DRM_MODULES))) CONFIG_DRM_I915 := m endif -endif include $(DRMSRCDIR)/Makefile.kernel diff --git a/linux-core/ati_pcigart.c b/linux-core/ati_pcigart.c index a7b05041..6e4353b5 100644 --- a/linux-core/ati_pcigart.c +++ b/linux-core/ati_pcigart.c @@ -91,7 +91,7 @@ static void drm_ati_free_pcigart_table(void *address) free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER); } -int drm_ati_pcigart_cleanup(drm_device_t * dev, drm_ati_pcigart_info *gart_info) +int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info) { drm_sg_mem_t *entry = dev->sg; unsigned long pages; @@ -125,7 +125,8 @@ int drm_ati_pcigart_cleanup(drm_device_t * dev, drm_ati_pcigart_info *gart_info) } - if (gart_info->gart_table_location == DRM_ATI_GART_MAIN && gart_info->addr) { + if (gart_info->gart_table_location == DRM_ATI_GART_MAIN + && gart_info->addr) { drm_ati_free_pcigart_table(gart_info->addr); gart_info->addr=0; } @@ -147,8 +148,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info *gart_info) goto done; } - if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) - { + if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); address = drm_ati_alloc_pcigart_table(); @@ -224,5 +224,3 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info *gart_info) return ret; } EXPORT_SYMBOL(drm_ati_pcigart_init); - - diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 54091a86..f27f3bc6 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -555,7 +555,7 @@ struct drm_driver { int (*context_dtor) (struct drm_device * dev, int context); int (*kernel_context_switch) (struct drm_device * dev, int old, int new); - int (*kernel_context_switch_unlock) (struct drm_device * dev); + void (*kernel_context_switch_unlock) (struct drm_device * dev); int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); int (*dri_library_name) (struct drm_device * dev, char * buf); @@ -859,8 +859,6 @@ extern int drm_newctx(struct inode *inode, struct file *filp, extern int drm_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_context_switch_complete(drm_device_t * dev, int new); - extern int drm_ctxbitmap_init(drm_device_t * dev); extern void drm_ctxbitmap_cleanup(drm_device_t * dev); extern void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle); diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c index 572d7a0d..dce27cdf 100644 --- a/linux-core/drm_agpsupport.c +++ b/linux-core/drm_agpsupport.c @@ -88,7 +88,7 @@ int drm_agp_info_ioctl(struct inode *inode, struct file *filp, } /** - * Acquire the AGP device + * Acquire the AGP device. * * \param dev DRM device that is to acquire AGP. * \return zero on success or a negative number on failure. @@ -144,7 +144,7 @@ int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, } /** - * Release the AGP device + * Release the AGP device. * * \param dev DRM device that is to release AGP. * \return zero on success or a negative number on failure. @@ -519,7 +519,8 @@ DRM_AGP_MEM *drm_agp_allocate_memory(size_t pages, u32 type) return agp_allocate_memory(pages, type); } #else -DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type) +DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, + size_t pages, u32 type) { return agp_allocate_memory(bridge, pages, type); } diff --git a/linux-core/drm_auth.c b/linux-core/drm_auth.c index e3293089..591c33c1 100644 --- a/linux-core/drm_auth.c +++ b/linux-core/drm_auth.c @@ -87,7 +87,8 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) * associated the magic number hash key in drm_device::magiclist, while holding * the drm_device::struct_sem lock. */ -static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, drm_magic_t magic) +static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, + drm_magic_t magic) { int hash; drm_magic_entry_t *entry; @@ -174,7 +175,7 @@ int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { static drm_magic_t sequence = 0; - static spinlock_t lock = SPIN_LOCK_UNLOCKED; + static DEFINE_SPINLOCK(lock); drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; drm_auth_t auth; diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c index c6dc2776..a91eac16 100644 --- a/linux-core/drm_bufs.c +++ b/linux-core/drm_bufs.c @@ -65,7 +65,6 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t *dev, return NULL; } - /* * Used to allocate 32-bit handles for mappings. */ @@ -73,7 +72,8 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t *dev, #define END_RANGE 0x40000000 #ifdef _LP64 -static __inline__ unsigned int HandleID(unsigned long lhandle, drm_device_t *dev) +static __inline__ unsigned int HandleID(unsigned long lhandle, + drm_device_t *dev) { static unsigned int map32_handle = START_RANGE; unsigned int hash; @@ -83,12 +83,12 @@ static __inline__ unsigned int HandleID(unsigned long lhandle, drm_device_t *dev map32_handle += PAGE_SIZE; if (map32_handle > END_RANGE) map32_handle = START_RANGE; - } else + } else hash = lhandle; while (1) { drm_map_list_t *_entry; - list_for_each_entry(_entry, &dev->maplist->head,head) { + list_for_each_entry(_entry, &dev->maplist->head, head) { if (_entry->user_token == hash) break; } @@ -116,7 +116,7 @@ static __inline__ unsigned int HandleID(unsigned long lhandle, drm_device_t *dev * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where * applicable and if supported by the kernel. */ -int drm_addmap_core(drm_device_t * dev, unsigned int offset, +static int drm_addmap_core(drm_device_t * dev, unsigned int offset, unsigned int size, drm_map_type_t type, drm_map_flags_t flags, drm_map_list_t ** maplist) { @@ -269,8 +269,8 @@ int drm_addmap_core(drm_device_t * dev, unsigned int offset, } map->offset += (unsigned long)dev->sg->virtual; break; - case _DRM_CONSISTENT: { - /* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G. + case _DRM_CONSISTENT: + /* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G, * As we're limiting the address to 2^32-1 (or less), * casting it down to 32 bits is no problem, but we * need to point to a 64bit variable first. */ @@ -283,7 +283,6 @@ int drm_addmap_core(drm_device_t * dev, unsigned int offset, map->offset = (unsigned long)dmah->busaddr; kfree(dmah); break; - } default: drm_free(map, sizeof(*map), DRM_MEM_MAPS); return -EINVAL; @@ -301,7 +300,7 @@ int drm_addmap_core(drm_device_t * dev, unsigned int offset, list_add(&list->head, &dev->maplist->head); /* Assign a 32-bit handle */ /* We do it here so that dev->struct_sem protects the increment */ - list->user_token = HandleID(map->type==_DRM_SHM + list->user_token = HandleID(map->type == _DRM_SHM ? (unsigned long)map->handle : map->offset, dev); up(&dev->struct_sem); @@ -338,22 +337,24 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp, if (!(filp->f_mode & 3)) return -EACCES; /* Require read/write */ - if (copy_from_user(& map, argp, sizeof(map))) { + if (copy_from_user(&map, argp, sizeof(map))) { return -EFAULT; } if (!(capable(CAP_SYS_ADMIN) || map.type == _DRM_AGP)) return -EPERM; - err = drm_addmap_core( dev, map.offset, map.size, map.type, map.flags, - &maplist); + err = drm_addmap_core(dev, map.offset, map.size, map.type, map.flags, + &maplist); if (err) return err; if (copy_to_user(argp, maplist->map, sizeof(drm_map_t))) return -EFAULT; - if (put_user((void *)maplist->user_token, &argp->handle)) + + /* avoid a warning on 64-bit, this casting isn't very nice, but the API is set so too late */ + if (put_user((void *)(unsigned long)maplist->user_token, &argp->handle)) return -EFAULT; return 0; } @@ -405,9 +406,8 @@ int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map) case _DRM_FRAME_BUFFER: if (drm_core_has_MTRR(dev) && map->mtrr >= 0) { int retcode; - retcode = mtrr_del(map->mtrr, map->offset, - map->size); - DRM_DEBUG ("mtrr_del=%d\n", retcode); + retcode = mtrr_del(map->mtrr, map->offset, map->size); + DRM_DEBUG("mtrr_del=%d\n", retcode); } break; case _DRM_SHM: @@ -469,7 +469,7 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head); if (r_list->map && - r_list->user_token == (unsigned long) request.handle && + r_list->user_token == (unsigned long)request.handle && r_list->map->flags & _DRM_REMOVABLE) { map = r_list->map; break; @@ -874,7 +874,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) buf->filp = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = drm_alloc(dev->driver->dev_priv_size, + buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ @@ -1040,7 +1040,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) buf->offset = (dma->byte_count + offset); buf->bus_address = agp_offset + offset; - buf->address = (void *)(agp_offset + offset + buf->address = (void *)(agp_offset + offset + (unsigned long)dev->sg->virtual); buf->next = NULL; buf->waiting = 0; @@ -1049,8 +1049,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) buf->filp = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = drm_alloc(dev->driver->dev_priv_size, - DRM_MEM_BUFS); + buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1107,7 +1106,6 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) return 0; } - int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) { drm_device_dma_t *dma = dev->dma; @@ -1127,7 +1125,7 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) if (!drm_core_check_feature(dev, DRIVER_FB_DMA)) return -EINVAL; - + if (!dma) return -EINVAL; @@ -1292,7 +1290,6 @@ int drm_addbufs(struct inode *inode, struct file *filp, drm_device_t *dev = priv->head->dev; int ret; - if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) return -EINVAL; @@ -1301,25 +1298,23 @@ int drm_addbufs(struct inode *inode, struct file *filp, return -EFAULT; #if __OS_HAS_AGP - if (request.flags & _DRM_AGP_BUFFER) { - ret = drm_addbufs_agp(dev, & request); - } + if (request.flags & _DRM_AGP_BUFFER) + ret = drm_addbufs_agp(dev, &request); else #endif if (request.flags & _DRM_SG_BUFFER) - ret = drm_addbufs_sg(dev, & request); - else if (request.flags & _DRM_FB_BUFFER) - ret = drm_addbufs_fb(dev, & request); - else - ret = drm_addbufs_pci(dev, & request); + ret = drm_addbufs_sg(dev, &request); + else if (request.flags & _DRM_FB_BUFFER) + ret = drm_addbufs_fb(dev, &request); + else + ret = drm_addbufs_pci(dev, &request); if (ret == 0) { - if (copy_to_user( (void __user *) arg, &request, + if (copy_to_user((void __user *) arg, &request, sizeof(request))) { ret = -EFAULT; } } - return ret; } @@ -1566,10 +1561,10 @@ int drm_mapbufs(struct inode *inode, struct file *filp, if (request.count >= dma->buf_count) { if ((drm_core_has_AGP(dev) && (dma->flags & _DRM_DMA_USE_AGP)) - || (drm_core_check_feature(dev, DRIVER_SG) - && (dma->flags & _DRM_DMA_USE_SG)) - || (drm_core_check_feature(dev, DRIVER_FB_DMA) - && (dma->flags & _DRM_DMA_USE_FB))) { + || (drm_core_check_feature(dev, DRIVER_SG) + && (dma->flags & _DRM_DMA_USE_SG)) + || (drm_core_check_feature(dev, DRIVER_FB_DMA) + && (dma->flags & _DRM_DMA_USE_FB))) { drm_map_t *map = dev->agp_buffer_map; unsigned long token = dev->agp_buffer_token; @@ -1658,13 +1653,12 @@ int drm_mapbufs(struct inode *inode, struct file *filp, * * \todo Can be made faster. */ -int drm_order( unsigned long size ) +int drm_order(unsigned long size) { int order; unsigned long tmp; - for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) - ; + for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) ; if (size & (size - 1)) ++order; diff --git a/linux-core/drm_context.c b/linux-core/drm_context.c index 1fcd125e..748a2a61 100644 --- a/linux-core/drm_context.c +++ b/linux-core/drm_context.c @@ -235,7 +235,8 @@ int drm_getsareactx(struct inode *inode, struct file *filp, request.handle = NULL; list_for_each_entry(_entry, &dev->maplist->head,head) { if (_entry->map == map) { - request.handle = (void *)(unsigned long)_entry->user_token; + request.handle = + (void *)(unsigned long)_entry->user_token; break; } } @@ -341,7 +342,7 @@ static int drm_context_switch(drm_device_t * dev, int old, int new) * hardware lock is held, clears the drm_device::context_flag and wakes up * drm_device::context_wait. */ -int drm_context_switch_complete(drm_device_t * dev, int new) +static int drm_context_switch_complete(drm_device_t * dev, int new) { dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ dev->last_switch = jiffies; diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index e422888c..dab88784 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -57,7 +57,7 @@ static int drm_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /** Ioctl table */ -drm_ioctl_desc_t drm_ioctls[] = { +static drm_ioctl_desc_t drm_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = {drm_version, 0}, [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = {drm_getunique, 0}, [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = {drm_getmagic, 0}, diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c index f2de90ae..a1962135 100644 --- a/linux-core/drm_fops.c +++ b/linux-core/drm_fops.c @@ -34,20 +34,24 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include - #include "drmP.h" #include "drm_sarea.h" +#include -static int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t * dev); +static int drm_open_helper(struct inode *inode, struct file *filp, + drm_device_t * dev); static int drm_setup(drm_device_t * dev) { drm_local_map_t *map; int i; + int ret; - if (dev->driver->firstopen) - dev->driver->firstopen(dev); + if (dev->driver->firstopen) { + ret = dev->driver->firstopen(dev); + if (ret != 0) + return ret; + } /* prebuild the SAREA */ i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM, _DRM_CONTAINS_LOCK, &map); @@ -223,7 +227,8 @@ static int drm_cpu_valid(void) * Creates and initializes a drm_file structure for the file private data in \p * filp and add it into the double linked list in \p dev. */ -static int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t * dev) +static int drm_open_helper(struct inode *inode, struct file *filp, + drm_device_t * dev) { int minor = iminor(inode); drm_file_t *priv; @@ -325,7 +330,7 @@ EXPORT_SYMBOL(drm_fasync); * If the hardware lock is held then free it, and take it again for the kernel * context since it's necessary to reclaim buffers. Unlink the file private * data from its list and free it. Decreases the open count and if it reaches - * zero calls takedown(). + * zero calls drm_lastclose(). */ int drm_release(struct inode *inode, struct file *filp) { diff --git a/linux-core/drm_lock.c b/linux-core/drm_lock.c index b8431698..b909a6fb 100644 --- a/linux-core/drm_lock.c +++ b/linux-core/drm_lock.c @@ -36,7 +36,8 @@ #include "drmP.h" static int drm_lock_transfer(drm_device_t * dev, - __volatile__ unsigned int *lock, unsigned int context); + __volatile__ unsigned int *lock, + unsigned int context); static int drm_notifier(void *priv); /** @@ -125,8 +126,8 @@ int drm_lock(struct inode *inode, struct file *filp, } } - if (dev->driver->kernel_context_switch - && dev->last_context != lock.context) { + if (dev->driver->kernel_context_switch && + dev->last_context != lock.context) { dev->driver->kernel_context_switch(dev, dev->last_context, lock.context); } @@ -163,8 +164,11 @@ int drm_unlock(struct inode *inode, struct file *filp, atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]); + /* kernel_context_switch isn't used by any of the x86 drm + * modules but is required by the Sparc driver. + */ if (dev->driver->kernel_context_switch_unlock) - dev->driver->kernel_context_switch_unlock(dev); + dev->driver->kernel_context_switch_unlock(dev, &lock); else { drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); @@ -229,7 +233,8 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context) * Marks the lock as held by the given context, via the \p cmpxchg instruction. */ static int drm_lock_transfer(drm_device_t * dev, - __volatile__ unsigned int *lock, unsigned int context) + __volatile__ unsigned int *lock, + unsigned int context) { unsigned int old, new, prev; diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h index d3fb67e6..42700978 100644 --- a/linux-core/drm_os_linux.h +++ b/linux-core/drm_os_linux.h @@ -16,18 +16,21 @@ #define DRM_SUSER(p) capable(CAP_SYS_ADMIN) #define DRM_UDELAY(d) udelay(d) #if LINUX_VERSION_CODE <= 0x020608 /* KERNEL_VERSION(2,6,8) */ +#ifndef __iomem +#define __iomem +#endif /** Read a byte from a MMIO region */ -#define DRM_READ8(map, offset) readb(((unsigned long)(map)->handle) + (offset)) +#define DRM_READ8(map, offset) readb(((void __iomem *)(map)->handle) + (offset)) /** Read a word from a MMIO region */ -#define DRM_READ16(map, offset) readw(((unsigned long)(map)->handle) + (offset)) +#define DRM_READ16(map, offset) readw(((void __iomem *)(map)->handle) + (offset)) /** Read a dword from a MMIO region */ -#define DRM_READ32(map, offset) readl(((unsigned long)(map)->handle) + (offset)) +#define DRM_READ32(map, offset) readl(((void __iomem *)(map)->handle) + (offset)) /** Write a byte into a MMIO region */ -#define DRM_WRITE8(map, offset, val) writeb(val, ((unsigned long)(map)->handle) + (offset)) +#define DRM_WRITE8(map, offset, val) writeb(val, ((void __iomem *)(map)->handle) + (offset)) /** Write a word into a MMIO region */ -#define DRM_WRITE16(map, offset, val) writew(val, ((unsigned long)(map)->handle) + (offset)) +#define DRM_WRITE16(map, offset, val) writew(val, ((void __iomem *)(map)->handle) + (offset)) /** Write a dword into a MMIO region */ -#define DRM_WRITE32(map, offset, val) writel(val, ((unsigned long)(map)->handle) + (offset)) +#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) #else /** Read a byte from a MMIO region */ #define DRM_READ8(map, offset) readb((map)->handle + (offset)) diff --git a/linux-core/drm_pci.c b/linux-core/drm_pci.c index dd9b0c8c..0d3c8b23 100644 --- a/linux-core/drm_pci.c +++ b/linux-core/drm_pci.c @@ -54,7 +54,7 @@ drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align, unsigned long addr; size_t sz; #endif -#if DRM_DEBUG_MEMORY +#ifdef DRM_DEBUG_MEMORY int area = DRM_MEM_DMA; spin_lock(&drm_mem_lock); @@ -85,7 +85,7 @@ drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align, dmah->size = size; dmah->vaddr = pci_alloc_consistent(dev->pdev, size, &dmah->busaddr); -#if DRM_DEBUG_MEMORY +#ifdef DRM_DEBUG_MEMORY if (dmah->vaddr == NULL) { spin_lock(&drm_mem_lock); ++drm_mem_stats[area].fail_count; @@ -126,21 +126,20 @@ EXPORT_SYMBOL(drm_pci_alloc); * * This function is for internal use in the Linux-specific DRM core code. */ -void -__drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah) +void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah) { #if 0 unsigned long addr; size_t sz; #endif -#if DRM_DEBUG_MEMORY +#ifdef DRM_DEBUG_MEMORY int area = DRM_MEM_DMA; int alloc_count; int free_count; #endif if (!dmah->vaddr) { -#if DRM_DEBUG_MEMORY +#ifdef DRM_DEBUG_MEMORY DRM_MEM_ERROR(area, "Attempt to free address 0\n"); #endif } else { @@ -156,7 +155,7 @@ __drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah) dmah->busaddr); } -#if DRM_DEBUG_MEMORY +#ifdef DRM_DEBUG_MEMORY spin_lock(&drm_mem_lock); free_count = ++drm_mem_stats[area].free_count; alloc_count = drm_mem_stats[area].succeed_count; @@ -175,8 +174,7 @@ __drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah) /** * \brief Free a PCI consistent memory block. */ -void -drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah) +void drm_pci_free(drm_device_t * dev, drm_dma_handle_t *dmah) { __drm_pci_free(dev, dmah); kfree(dmah); diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c index eb64798e..cabef261 100644 --- a/linux-core/drm_stub.c +++ b/linux-core/drm_stub.c @@ -54,7 +54,7 @@ drm_head_t **drm_heads; struct drm_sysfs_class *drm_class; struct proc_dir_entry *drm_proc_root; -static int fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, +static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver) { @@ -216,7 +216,8 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, pci_request_regions(pdev, driver->pci_driver.name); pci_enable_device(pdev); } - if ((ret = fill_in_dev(dev, pdev, ent, driver))) { + if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) { + printk(KERN_ERR "DRM: fill_in_dev failed\n"); goto err_g1; } if ((ret = drm_get_head(dev, &dev->primary))) diff --git a/linux-core/drm_sysfs.c b/linux-core/drm_sysfs.c index a1faf783..df75d7b0 100644 --- a/linux-core/drm_sysfs.c +++ b/linux-core/drm_sysfs.c @@ -144,8 +144,8 @@ static struct class_device_attribute class_device_attrs[] = { * Note: the struct drm_sysfs_class passed to this function must have previously been * created with a call to drm_sysfs_create(). */ -struct class_device *drm_sysfs_device_add( - struct drm_sysfs_class *cs, drm_head_t * head) +struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, + drm_head_t * head) { struct simple_dev *s_dev = NULL; int i, retval; diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index 6c0ab57a..b92552e6 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -38,8 +38,8 @@ #include #endif -static void drm_vm_close(struct vm_area_struct *vma); static void drm_vm_open(struct vm_area_struct *vma); +static void drm_vm_close(struct vm_area_struct *vma); /** * \c nopage method for AGP virtual memory. diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c index d91b6654..193a6fd1 100644 --- a/linux-core/i810_dma.c +++ b/linux-core/i810_dma.c @@ -130,10 +130,9 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) buf_priv->currently_mapped = I810_BUF_MAPPED; unlock_kernel(); - if (remap_pfn_range(vma, vma->vm_start, + if (io_remap_pfn_range(vma, vma->vm_start, VM_OFFSET(vma) >> PAGE_SHIFT, - vma->vm_end - vma->vm_start, - vma->vm_page_prot)) + vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; return 0; } @@ -1144,8 +1143,8 @@ static int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, return retcode; } -static int i810_copybuf(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static int i810_copybuf(struct inode *inode, + struct file *filp, unsigned int cmd, unsigned long arg) { /* Never copy - 2.4.x doesn't need it */ return 0; diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c index a28bce7e..c6e25f9b 100644 --- a/linux-core/i915_drv.c +++ b/linux-core/i915_drv.c @@ -1,6 +1,6 @@ /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*- */ -/************************************************************************** +/* * * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -25,7 +25,7 @@ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - **************************************************************************/ + */ #include "drmP.h" #include "drm.h" diff --git a/linux-core/i915_ioc32.c b/linux-core/i915_ioc32.c index fe009e1b..396f5c21 100644 --- a/linux-core/i915_ioc32.c +++ b/linux-core/i915_ioc32.c @@ -51,7 +51,8 @@ static int compat_i915_batchbuffer(struct file *file, unsigned int cmd, drm_i915_batchbuffer32_t batchbuffer32; drm_i915_batchbuffer_t __user *batchbuffer; - if (copy_from_user(&batchbuffer32, (void __user *)arg, sizeof(batchbuffer32))) + if (copy_from_user + (&batchbuffer32, (void __user *)arg, sizeof(batchbuffer32))) return -EFAULT; batchbuffer = compat_alloc_user_space(sizeof(*batchbuffer)); @@ -60,13 +61,15 @@ static int compat_i915_batchbuffer(struct file *file, unsigned int cmd, || __put_user(batchbuffer32.used, &batchbuffer->used) || __put_user(batchbuffer32.DR1, &batchbuffer->DR1) || __put_user(batchbuffer32.DR4, &batchbuffer->DR4) - || __put_user(batchbuffer32.num_cliprects, &batchbuffer->num_cliprects) + || __put_user(batchbuffer32.num_cliprects, + &batchbuffer->num_cliprects) || __put_user((int __user *)(unsigned long)batchbuffer32.cliprects, &batchbuffer->cliprects)) return -EFAULT; return drm_ioctl(file->f_dentry->d_inode, file, - DRM_IOCTL_I915_BATCHBUFFER, (unsigned long) batchbuffer); + DRM_IOCTL_I915_BATCHBUFFER, + (unsigned long) batchbuffer); } typedef struct _drm_i915_cmdbuffer32 { @@ -84,7 +87,8 @@ static int compat_i915_cmdbuffer(struct file *file, unsigned int cmd, drm_i915_cmdbuffer32_t cmdbuffer32; drm_i915_cmdbuffer_t __user *cmdbuffer; - if (copy_from_user(&cmdbuffer32, (void __user *)arg, sizeof(cmdbuffer32))) + if (copy_from_user + (&cmdbuffer32, (void __user *)arg, sizeof(cmdbuffer32))) return -EFAULT; cmdbuffer = compat_alloc_user_space(sizeof(*cmdbuffer)); @@ -197,8 +201,7 @@ drm_ioctl_compat_t *i915_compat_ioctls[] = { * \param arg user argument. * \return zero on success or negative number on failure. */ -long i915_compat_ioctl(struct file *filp, unsigned int cmd, - unsigned long arg) +long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { unsigned int nr = DRM_IOCTL_NR(cmd); drm_ioctl_compat_t *fn = NULL; diff --git a/linux-core/via_dmablit.c b/linux-core/via_dmablit.c index 9e2f1009..4a3a7524 100644 --- a/linux-core/via_dmablit.c +++ b/linux-core/via_dmablit.c @@ -39,6 +39,8 @@ #include "via_drv.h" #include "via_dmablit.h" +#include + #define VIA_PGDN(x) (((unsigned long)(x)) & PAGE_MASK) #define VIA_PGOFF(x) (((unsigned long)(x)) & ~PAGE_MASK) #define VIA_PFN(x) ((unsigned long)(x) >> PAGE_SHIFT) @@ -106,7 +108,7 @@ via_map_blit_for_device(struct pci_dev *pdev, int num_desc = 0; int cur_line; dma_addr_t next = 0 | VIA_DMA_DPR_EC; - drm_via_descriptor_t *desc_ptr = 0; + drm_via_descriptor_t *desc_ptr = NULL; if (mode == 1) desc_ptr = vsg->desc_pages[cur_descriptor_page]; @@ -585,7 +587,7 @@ via_build_sg_info(drm_device_t *dev, drm_via_sg_info_t *vsg, drm_via_dmablit_t * int ret = 0; vsg->direction = (draw) ? DMA_TO_DEVICE : DMA_FROM_DEVICE; - vsg->bounce_buffer = 0; + vsg->bounce_buffer = NULL; vsg->state = dr_via_sg_init; -- cgit v1.2.3