diff options
author | Dave Airlie <airlied@linux.ie> | 2007-12-10 15:53:59 +1000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2007-12-10 15:53:59 +1000 |
commit | 814f695135f21aadeba77a3114df505d81a8d433 (patch) | |
tree | 277da7e1c5dce9318591158435d2e367f3e495d3 /linux-core | |
parent | e51b3c8ff4bb88bc0f57473b7c3fe7fcd6b1a916 (diff) | |
parent | cfa21b22b43c7113107b5eb086b5f4d4ec36dc0a (diff) |
Merge branch 'master' into r500-support
Diffstat (limited to 'linux-core')
30 files changed, 156 insertions, 156 deletions
diff --git a/linux-core/ati_pcigart.c b/linux-core/ati_pcigart.c index 7241c2a8..e6187365 100644 --- a/linux-core/ati_pcigart.c +++ b/linux-core/ati_pcigart.c @@ -81,7 +81,7 @@ static void drm_ati_free_pcigart_table(void *address, int order) free_pages((unsigned long)address, order); } -int drm_ati_pcigart_cleanup(struct drm_device *dev, struct ati_pcigart_info *gart_info) +int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) { struct drm_sg_mem *entry = dev->sg; unsigned long pages; @@ -132,7 +132,7 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct ati_pcigart_info *gar } EXPORT_SYMBOL(drm_ati_pcigart_cleanup); -int drm_ati_pcigart_init(struct drm_device *dev, struct ati_pcigart_info *gart_info) +int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) { struct drm_sg_mem *entry = dev->sg; void *address = NULL; diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 356131eb..dbf2a924 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -66,8 +66,8 @@ #ifdef CONFIG_MTRR #include <asm/mtrr.h> #endif -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) #include <asm/agp.h> +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) #include <linux/types.h> #include <linux/agp_backend.h> #endif @@ -85,6 +85,7 @@ #include "drm_hashtab.h" #include "drm_internal.h" +struct drm_device; struct drm_file; /* If you want the memory alloc debug functionality, change define below */ @@ -162,6 +163,12 @@ struct drm_file; #define DRM_OBJECT_HASH_ORDER 12 #define DRM_FILE_PAGE_OFFSET_START ((0xFFFFFFFFUL >> PAGE_SHIFT) + 1) #define DRM_FILE_PAGE_OFFSET_SIZE ((0xFFFFFFFFUL >> PAGE_SHIFT) * 16) +/* + * This should be small enough to allow the use of kmalloc for hash tables + * instead of vmalloc. + */ + +#define DRM_FILE_HASH_ORDER 8 #define DRM_MM_INIT_MAX_PAGES 256 /*@}*/ @@ -202,7 +209,7 @@ struct drm_file; #if DRM_DEBUG_CODE #define DRM_DEBUG(fmt, arg...) \ do { \ - if ( drm_debug ) \ + if ( drm_debug ) \ printk(KERN_DEBUG \ "[" DRM_NAME ":%s] " fmt , \ __FUNCTION__ , ##arg); \ @@ -276,9 +283,6 @@ do { \ return -EFAULT; \ } -struct drm_device; -struct drm_file; - /** * Ioctl function type. * @@ -394,14 +398,9 @@ struct drm_buf_entry { struct drm_freelist freelist; }; -/* - * This should be small enough to allow the use of kmalloc for hash tables - * instead of vmalloc. - */ -#define DRM_FILE_HASH_ORDER 8 enum drm_ref_type { - _DRM_REF_USE=0, + _DRM_REF_USE = 0, _DRM_REF_TYPE1, _DRM_NO_REF_TYPES }; @@ -504,14 +503,14 @@ struct drm_agp_mem { /** * AGP data. * - * \sa drm_agp_init)() and drm_device::agp. + * \sa drm_agp_init() and drm_device::agp. */ struct drm_agp_head { DRM_AGP_KERN agp_info; /**< AGP device information */ struct list_head memory; unsigned long mode; /**< AGP mode */ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) - struct agp_bridge_data *bridge; + struct agp_bridge_data *bridge; #endif int enabled; /**< whether the AGP bus as been enabled */ int acquired; /**< whether the AGP device has been acquired */ @@ -595,7 +594,7 @@ struct drm_vbl_sig { #define DRM_ATI_GART_PCIE 2 #define DRM_ATI_GART_IGP 3 -struct ati_pcigart_info { +struct drm_ati_pcigart_info { int gart_table_location; int gart_reg_if; void *addr; @@ -625,14 +624,14 @@ struct drm_driver { int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); void (*dma_ready) (struct drm_device *); int (*dma_quiescent) (struct drm_device *); - int (*context_ctor) (struct drm_device * dev, int context); - int (*context_dtor) (struct drm_device * dev, int context); - int (*kernel_context_switch) (struct drm_device * dev, int old, + int (*context_ctor) (struct drm_device *dev, int context); + int (*context_dtor) (struct drm_device *dev, int context); + int (*kernel_context_switch) (struct drm_device *dev, int old, int new); - void (*kernel_context_switch_unlock) (struct drm_device * dev); - int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); - int (*vblank_wait2) (struct drm_device * dev, unsigned int *sequence); - int (*dri_library_name) (struct drm_device * dev, char * buf); + void (*kernel_context_switch_unlock) (struct drm_device *dev); + int (*vblank_wait) (struct drm_device *dev, unsigned int *sequence); + int (*vblank_wait2) (struct drm_device *dev, unsigned int *sequence); + int (*dri_library_name) (struct drm_device *dev, char * buf); /** * Called by \c drm_device_is_agp. Typically used to determine if a @@ -645,22 +644,23 @@ struct drm_driver { * card is absolutely \b not AGP (return of 0), absolutely \b is AGP * (return of 1), or may or may not be AGP (return of 2). */ - int (*device_is_agp) (struct drm_device * dev); + int (*device_is_agp) (struct drm_device *dev); /* these have to be filled in */ irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); - void (*irq_preinstall) (struct drm_device * dev); - void (*irq_postinstall) (struct drm_device * dev); - void (*irq_uninstall) (struct drm_device * dev); + void (*irq_preinstall) (struct drm_device *dev); + void (*irq_postinstall) (struct drm_device *dev); + void (*irq_uninstall) (struct drm_device *dev); void (*reclaim_buffers) (struct drm_device *dev, struct drm_file *file_priv); void (*reclaim_buffers_locked) (struct drm_device *dev, struct drm_file *file_priv); void (*reclaim_buffers_idlelocked) (struct drm_device *dev, struct drm_file *file_priv); - unsigned long (*get_map_ofs) (struct drm_map * map); - unsigned long (*get_reg_ofs) (struct drm_device * dev); - void (*set_version) (struct drm_device * dev, struct drm_set_version * sv); + unsigned long (*get_map_ofs) (struct drm_map *map); + unsigned long (*get_reg_ofs) (struct drm_device *dev); + void (*set_version) (struct drm_device *dev, + struct drm_set_version *sv); struct drm_fence_driver *fence_driver; struct drm_bo_driver *bo_driver; @@ -1157,8 +1157,8 @@ extern int drm_sg_free(struct drm_device *dev, void *data, struct drm_file *file_priv); /* ATI PCIGART support (ati_pcigart.h) */ -extern int drm_ati_pcigart_init(struct drm_device *dev, struct ati_pcigart_info *gart_info); -extern int drm_ati_pcigart_cleanup(struct drm_device *dev, struct ati_pcigart_info *gart_info); +extern int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info); +extern int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info); extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, size_t align, dma_addr_t maxaddr); @@ -1169,7 +1169,7 @@ extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah); struct drm_sysfs_class; extern struct class *drm_sysfs_create(struct module *owner, char *name); extern void drm_sysfs_destroy(void); -extern int drm_sysfs_device_add(struct drm_device *dev, struct drm_head * head); +extern int drm_sysfs_device_add(struct drm_device *dev, struct drm_head *head); extern void drm_sysfs_device_remove(struct drm_device *dev); /* @@ -1209,7 +1209,7 @@ static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, static __inline__ int drm_device_is_agp(struct drm_device *dev) { if ( dev->driver->device_is_agp != NULL ) { - int err = (*dev->driver->device_is_agp)( dev ); + int err = (*dev->driver->device_is_agp)(dev); if (err != 2) { return err; diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c index 438899e8..e8bfaea4 100644 --- a/linux-core/drm_agpsupport.c +++ b/linux-core/drm_agpsupport.c @@ -48,7 +48,7 @@ * Verifies the AGP device has been initialized and acquired and fills in the * drm_agp_info structure with the information in drm_agp_head::agp_info. */ -int drm_agp_info(struct drm_device * dev, struct drm_agp_info *info) +int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info) { DRM_AGP_KERN *kern; @@ -130,7 +130,7 @@ EXPORT_SYMBOL(drm_agp_acquire); int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { - return drm_agp_acquire( (struct drm_device *) file_priv->head->dev ); + return drm_agp_acquire((struct drm_device *) file_priv->head->dev); } /** @@ -426,7 +426,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) if (!(head->bridge = agp_backend_acquire(dev->pdev))) { drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS); return NULL; - } + } agp_copy_info(head->bridge, &head->agp_info); agp_backend_release(head->bridge); } else { @@ -652,7 +652,7 @@ struct drm_ttm_backend *drm_agp_init_ttm(struct drm_device *dev) EXPORT_SYMBOL(drm_agp_init_ttm); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) -void drm_agp_flush_chipset(struct drm_device *dev) +void drm_agp_chipset_flush(struct drm_device *dev) { agp_flush_chipset(dev->agp->bridge); } diff --git a/linux-core/drm_auth.c b/linux-core/drm_auth.c index e35e8b6d..c904a91d 100644 --- a/linux-core/drm_auth.c +++ b/linux-core/drm_auth.c @@ -83,7 +83,7 @@ static int drm_add_magic(struct drm_device * dev, struct drm_file * priv, return -ENOMEM; memset(entry, 0, sizeof(*entry)); entry->priv = priv; - entry->hash_item.key = (unsigned long) magic; + entry->hash_item.key = (unsigned long)magic; mutex_lock(&dev->struct_mutex); drm_ht_insert_item(&dev->magiclist, &entry->hash_item); list_add_tail(&entry->head, &dev->magicfree); @@ -109,7 +109,7 @@ static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic) DRM_DEBUG("%d\n", magic); mutex_lock(&dev->struct_mutex); - if (drm_ht_find_item(&dev->magiclist, (unsigned long) magic, &hash)) { + if (drm_ht_find_item(&dev->magiclist, (unsigned long)magic, &hash)) { mutex_unlock(&dev->struct_mutex); return -EINVAL; } diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c index 65818c6f..75c75c2f 100644 --- a/linux-core/drm_bufs.c +++ b/linux-core/drm_bufs.c @@ -173,12 +173,17 @@ static int drm_addmap_core(struct drm_device *dev, unsigned int offset, if (drm_core_has_MTRR(dev)) { if (map->type == _DRM_FRAME_BUFFER || (map->flags & _DRM_WRITE_COMBINING)) { - map->mtrr = mtrr_add(map->offset, map->size, - MTRR_TYPE_WRCOMB, 1); + map->mtrr = mtrr_add(map->offset, map->size, + MTRR_TYPE_WRCOMB, 1); } } - if (map->type == _DRM_REGISTERS) + if (map->type == _DRM_REGISTERS) { map->handle = ioremap(map->offset, map->size); + if (!map->handle) { + drm_free(map, sizeof(*map), DRM_MEM_MAPS); + return -ENOMEM; + } + } break; case _DRM_SHM: list = drm_find_matching_map(dev, map); @@ -387,9 +392,9 @@ int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map) } } - if (!found) { + if (!found) return -EINVAL; - } + /* List has wrapped around to the head pointer, or it's empty and we * didn't find anything. */ @@ -494,7 +499,8 @@ int drm_rmmap_ioctl(struct drm_device *dev, void *data, * * Frees any pages and buffers associated with the given entry. */ -static void drm_cleanup_buf_error(struct drm_device *dev, struct drm_buf_entry * entry) +static void drm_cleanup_buf_error(struct drm_device *dev, + struct drm_buf_entry *entry) { int i; @@ -529,7 +535,7 @@ static void drm_cleanup_buf_error(struct drm_device *dev, struct drm_buf_entry * #if __OS_HAS_AGP /** - * Add AGP buffers for DMA transfers + * Add AGP buffers for DMA transfers. * * \param dev struct drm_device to which the buffers are to be added. * \param request pointer to a struct drm_buf_desc describing the request. @@ -539,7 +545,7 @@ static void drm_cleanup_buf_error(struct drm_device *dev, struct drm_buf_entry * * reallocates the buffer list of the same size order to accommodate the new * buffers. */ -int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request) +int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *request) { struct drm_device_dma *dma = dev->dma; struct drm_buf_entry *entry; @@ -709,7 +715,7 @@ int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request) EXPORT_SYMBOL(drm_addbufs_agp); #endif /* __OS_HAS_AGP */ -int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request) +int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request) { struct drm_device_dma *dma = dev->dma; int count; @@ -935,7 +941,7 @@ int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request) } EXPORT_SYMBOL(drm_addbufs_pci); -static int drm_addbufs_sg(struct drm_device *dev, struct drm_buf_desc * request) +static int drm_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *request) { struct drm_device_dma *dma = dev->dma; struct drm_buf_entry *entry; diff --git a/linux-core/drm_dma.c b/linux-core/drm_dma.c index c4c4c694..f7bff0ac 100644 --- a/linux-core/drm_dma.c +++ b/linux-core/drm_dma.c @@ -43,7 +43,7 @@ * * Allocate and initialize a drm_device_dma structure. */ -int drm_dma_setup(struct drm_device * dev) +int drm_dma_setup(struct drm_device *dev) { int i; @@ -67,7 +67,7 @@ int drm_dma_setup(struct drm_device * dev) * Free all pages associated with DMA buffers, the buffers and pages lists, and * finally the drm_device::dma structure itself. */ -void drm_dma_takedown(struct drm_device * dev) +void drm_dma_takedown(struct drm_device *dev) { struct drm_device_dma *dma = dev->dma; int i, j; @@ -129,7 +129,7 @@ void drm_dma_takedown(struct drm_device * dev) * * Resets the fields of \p buf. */ -void drm_free_buffer(struct drm_device * dev, struct drm_buf * buf) +void drm_free_buffer(struct drm_device *dev, struct drm_buf *buf) { if (!buf) return; diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index bba84143..343d5f32 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -185,8 +185,8 @@ int drm_lastclose(struct drm_device * dev) if (dev->unique) { drm_free(dev->unique, strlen(dev->unique) + 1, DRM_MEM_DRIVER); - dev->unique=NULL; - dev->unique_len=0; + dev->unique = NULL; + dev->unique_len = 0; } if (dev->irq_enabled) @@ -246,8 +246,10 @@ int drm_lastclose(struct drm_device * dev) } list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) { - drm_rmmap_locked(dev, r_list->map); - r_list = NULL; + if (!(r_list->map->flags & _DRM_DRIVER)) { + drm_rmmap_locked(dev, r_list->map); + r_list = NULL; + } } if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) { @@ -392,15 +394,6 @@ static void drm_cleanup(struct drm_device * dev) drm_lastclose(dev); drm_fence_manager_takedown(dev); - drm_ht_remove(&dev->map_hash); - drm_mm_takedown(&dev->offset_manager); - drm_ht_remove(&dev->object_hash); - - if (!drm_fb_loaded) - pci_disable_device(dev->pdev); - - drm_ctxbitmap_cleanup(dev); - if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && dev->agp && dev->agp->agp_mtrr >= 0) { int retval; @@ -417,6 +410,14 @@ static void drm_cleanup(struct drm_device * dev) if (dev->driver->unload) dev->driver->unload(dev); + if (!drm_fb_loaded) + pci_disable_device(dev->pdev); + + drm_ctxbitmap_cleanup(dev); + drm_ht_remove(&dev->map_hash); + drm_mm_takedown(&dev->offset_manager); + drm_ht_remove(&dev->object_hash); + drm_put_head(&dev->primary); if (drm_put_dev(dev)) DRM_ERROR("Cannot unload module\n"); diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c index 6923ce86..0e1c486c 100644 --- a/linux-core/drm_fops.c +++ b/linux-core/drm_fops.c @@ -85,7 +85,6 @@ static int drm_setup(struct drm_device * dev) dev->queue_reserved = 0; dev->queue_slots = 0; dev->queuelist = NULL; - dev->irq_enabled = 0; dev->context_flag = 0; dev->interrupt_flag = 0; dev->dma_flag = 0; @@ -153,7 +152,7 @@ int drm_open(struct inode *inode, struct file *filp) spin_unlock(&dev->count_lock); } - out: +out: mutex_lock(&dev->struct_mutex); BUG_ON((dev->dev_mapping != NULL) && (dev->dev_mapping != inode->i_mapping)); @@ -237,7 +236,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, int minor = iminor(inode); struct drm_file *priv; int ret; - int i,j; + int i, j; if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */ @@ -265,14 +264,15 @@ static int drm_open_helper(struct inode *inode, struct file *filp, INIT_LIST_HEAD(&priv->lhead); INIT_LIST_HEAD(&priv->refd_objects); - for (i=0; i<_DRM_NO_REF_TYPES; ++i) { - ret = drm_ht_create(&priv->refd_object_hash[i], DRM_FILE_HASH_ORDER); + for (i = 0; i < _DRM_NO_REF_TYPES; ++i) { + ret = drm_ht_create(&priv->refd_object_hash[i], + DRM_FILE_HASH_ORDER); if (ret) break; } if (ret) { - for(j = 0; j < i; ++j) + for (j = 0; j < i; ++j) drm_ht_remove(&priv->refd_object_hash[j]); goto out_free; } @@ -341,8 +341,9 @@ static void drm_object_release(struct file *filp) /* * Free leftover ref objects created by me. Note that we cannot use - * list_for_each() here, as the struct_mutex may be temporarily released - * by the remove_() functions, and thus the lists may be altered. + * list_for_each() here, as the struct_mutex may be temporarily + * released by the remove_() functions, and thus the lists may be + * altered. * Also, a drm_remove_ref_object() will not remove it * from the list unless its refcount is 1. */ @@ -354,9 +355,8 @@ static void drm_object_release(struct file *filp) head = &priv->refd_objects; } - for(i = 0; i < _DRM_NO_REF_TYPES; ++i) { + for (i = 0; i < _DRM_NO_REF_TYPES; ++i) drm_ht_remove(&priv->refd_object_hash[i]); - } } /** diff --git a/linux-core/drm_hashtab.c b/linux-core/drm_hashtab.c index dacc83be..f5a4f849 100644 --- a/linux-core/drm_hashtab.c +++ b/linux-core/drm_hashtab.c @@ -36,7 +36,7 @@ #include "drm_hashtab.h" #include <linux/hash.h> -int drm_ht_create(struct drm_open_hash * ht, unsigned int order) +int drm_ht_create(struct drm_open_hash *ht, unsigned int order) { unsigned int i; @@ -63,7 +63,7 @@ int drm_ht_create(struct drm_open_hash * ht, unsigned int order) return 0; } -void drm_ht_verbose_list(struct drm_open_hash * ht, unsigned long key) +void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key) { struct drm_hash_item *entry; struct hlist_head *h_list; @@ -80,7 +80,7 @@ void drm_ht_verbose_list(struct drm_open_hash * ht, unsigned long key) } } -static struct hlist_node *drm_ht_find_key(struct drm_open_hash * ht, +static struct hlist_node *drm_ht_find_key(struct drm_open_hash *ht, unsigned long key) { struct drm_hash_item *entry; @@ -100,7 +100,7 @@ static struct hlist_node *drm_ht_find_key(struct drm_open_hash * ht, return NULL; } -int drm_ht_insert_item(struct drm_open_hash * ht, struct drm_hash_item * item) +int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item) { struct drm_hash_item *entry; struct hlist_head *h_list; @@ -131,7 +131,8 @@ int drm_ht_insert_item(struct drm_open_hash * ht, struct drm_hash_item * item) * Just insert an item and return any "bits" bit key that hasn't been * used before. */ -int drm_ht_just_insert_please(struct drm_open_hash * ht, struct drm_hash_item * item, +int drm_ht_just_insert_please(struct drm_open_hash *ht, + struct drm_hash_item *item, unsigned long seed, int bits, int shift, unsigned long add) { @@ -155,8 +156,8 @@ int drm_ht_just_insert_please(struct drm_open_hash * ht, struct drm_hash_item * return 0; } -int drm_ht_find_item(struct drm_open_hash * ht, unsigned long key, - struct drm_hash_item ** item) +int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key, + struct drm_hash_item **item) { struct hlist_node *list; @@ -168,7 +169,7 @@ int drm_ht_find_item(struct drm_open_hash * ht, unsigned long key, return 0; } -int drm_ht_remove_key(struct drm_open_hash * ht, unsigned long key) +int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key) { struct hlist_node *list; @@ -181,14 +182,14 @@ int drm_ht_remove_key(struct drm_open_hash * ht, unsigned long key) return -EINVAL; } -int drm_ht_remove_item(struct drm_open_hash * ht, struct drm_hash_item * item) +int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item) { hlist_del_init(&item->head); ht->fill--; return 0; } -void drm_ht_remove(struct drm_open_hash * ht) +void drm_ht_remove(struct drm_open_hash *ht) { if (ht->table) { if (ht->use_vmalloc) diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c index 395f7b4e..3df163db 100644 --- a/linux-core/drm_ioctl.c +++ b/linux-core/drm_ioctl.c @@ -98,12 +98,14 @@ int drm_setunique(struct drm_device *dev, void *data, dev->unique[dev->unique_len] = '\0'; - dev->devname = drm_alloc(strlen(dev->driver->pci_driver.name) + strlen(dev->unique) + 2, - DRM_MEM_DRIVER); + dev->devname = + drm_alloc(strlen(dev->driver->pci_driver.name) + + strlen(dev->unique) + 2, DRM_MEM_DRIVER); if (!dev->devname) return -ENOMEM; - sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, dev->unique); + sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, + dev->unique); /* Return error if the busid submitted doesn't match the device's actual * busid. @@ -142,12 +144,14 @@ static int drm_set_busid(struct drm_device * dev) if (len > dev->unique_len) DRM_ERROR("buffer overflow"); - dev->devname = drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + 2, - DRM_MEM_DRIVER); + dev->devname = + drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + + 2, DRM_MEM_DRIVER); if (dev->devname == NULL) return -ENOMEM; - sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, dev->unique); + sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, + dev->unique); return 0; } diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c index 25166b6f..314c2329 100644 --- a/linux-core/drm_irq.c +++ b/linux-core/drm_irq.c @@ -396,7 +396,7 @@ EXPORT_SYMBOL(drm_vbl_send_signals); */ static void drm_locked_tasklet_func(unsigned long data) { - struct drm_device *dev = (struct drm_device*)data; + struct drm_device *dev = (struct drm_device *)data; unsigned long irqflags; spin_lock_irqsave(&dev->tasklet_lock, irqflags); @@ -433,7 +433,7 @@ static void drm_locked_tasklet_func(unsigned long data) * context, it must not make any assumptions about this. Also, the HW lock will * be held with the kernel context or any client context. */ -void drm_locked_tasklet(struct drm_device *dev, void (*func)(struct drm_device*)) +void drm_locked_tasklet(struct drm_device *dev, void (*func)(struct drm_device *)) { unsigned long irqflags; static DECLARE_TASKLET(drm_tasklet, drm_locked_tasklet_func, 0); diff --git a/linux-core/drm_memory.c b/linux-core/drm_memory.c index f68a3a3e..402a680f 100644 --- a/linux-core/drm_memory.c +++ b/linux-core/drm_memory.c @@ -45,13 +45,13 @@ static struct { .lock = SPIN_LOCK_UNLOCKED }; -static inline size_t drm_size_align(size_t size) { - +static inline size_t drm_size_align(size_t size) +{ size_t tmpSize = 4; if (size > PAGE_SIZE) return PAGE_ALIGN(size); - while(tmpSize < size) + while (tmpSize < size) tmpSize <<= 1; return (size_t) tmpSize; diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h index 5590c491..63e425b5 100644 --- a/linux-core/drm_memory.h +++ b/linux-core/drm_memory.h @@ -42,7 +42,6 @@ * drm_memory.h. */ -/* Need the 4-argument version of vmap(). */ #if __OS_HAS_AGP #include <linux/vmalloc.h> diff --git a/linux-core/drm_pci.c b/linux-core/drm_pci.c index a608eed3..7569286c 100644 --- a/linux-core/drm_pci.c +++ b/linux-core/drm_pci.c @@ -123,7 +123,7 @@ EXPORT_SYMBOL(drm_pci_alloc); * * This function is for internal use in the Linux-specific DRM core code. */ -void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t *dmah) +void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah) { unsigned long addr; size_t sz; @@ -167,7 +167,7 @@ void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t *dmah) /** * \brief Free a PCI consistent memory block */ -void drm_pci_free(struct drm_device * dev, drm_dma_handle_t *dmah) +void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah) { __drm_pci_free(dev, dmah); kfree(dmah); diff --git a/linux-core/drm_proc.c b/linux-core/drm_proc.c index 08bf99d6..3012c5b0 100644 --- a/linux-core/drm_proc.c +++ b/linux-core/drm_proc.c @@ -239,10 +239,10 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request, else type = types[map->type]; DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", - i, - map->offset, - map->size, type, map->flags, - (unsigned long) r_list->user_token); + i, + map->offset, + map->size, type, map->flags, + (unsigned long) r_list->user_token); if (map->mtrr < 0) { DRM_PROC_PRINT("none\n"); diff --git a/linux-core/drm_regman.c b/linux-core/drm_regman.c index f49a25cb..aa117323 100644 --- a/linux-core/drm_regman.c +++ b/linux-core/drm_regman.c @@ -109,11 +109,10 @@ int drm_regs_alloc(struct drm_reg_manager *manager, */ return -EBUSY; - out: +out: *reg = entry; return 0; } - EXPORT_SYMBOL(drm_regs_alloc); void drm_regs_fence(struct drm_reg_manager *manager, @@ -156,7 +155,6 @@ void drm_regs_fence(struct drm_reg_manager *manager, } } } - EXPORT_SYMBOL(drm_regs_fence); void drm_regs_free(struct drm_reg_manager *manager) @@ -180,7 +178,6 @@ void drm_regs_free(struct drm_reg_manager *manager) manager->reg_destroy(entry); } } - EXPORT_SYMBOL(drm_regs_free); void drm_regs_add(struct drm_reg_manager *manager, struct drm_reg *reg) @@ -188,7 +185,6 @@ void drm_regs_add(struct drm_reg_manager *manager, struct drm_reg *reg) reg->fence = NULL; list_add_tail(®->head, &manager->free); } - EXPORT_SYMBOL(drm_regs_add); void drm_regs_init(struct drm_reg_manager *manager, @@ -201,5 +197,4 @@ void drm_regs_init(struct drm_reg_manager *manager, manager->reg_reusable = reg_reusable; manager->reg_destroy = reg_destroy; } - EXPORT_SYMBOL(drm_regs_init); diff --git a/linux-core/drm_sman.c b/linux-core/drm_sman.c index 118e82ae..8421a939 100644 --- a/linux-core/drm_sman.c +++ b/linux-core/drm_sman.c @@ -264,7 +264,8 @@ int drm_sman_free_key(struct drm_sman *sman, unsigned int key) if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) return -EINVAL; - memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item, user_hash); + memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item, + user_hash); drm_sman_free(memblock_item); return 0; } diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c index 401704f7..00a24521 100644 --- a/linux-core/drm_stub.c +++ b/linux-core/drm_stub.c @@ -55,8 +55,8 @@ struct class *drm_class; struct proc_dir_entry *drm_proc_root; static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev, - const struct pci_device_id *ent, - struct drm_driver *driver) + const struct pci_device_id *ent, + struct drm_driver *driver) { int retcode; @@ -84,6 +84,7 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev, dev->hose = pdev->sysdata; #endif dev->irq = pdev->irq; + dev->irq_enabled = 0; if (drm_ht_create(&dev->map_hash, DRM_MAP_HASH_ORDER)) { return -ENOMEM; @@ -218,7 +219,7 @@ err_g1: * Try and register, if we fail to register, backout previous work. */ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, - struct drm_driver *driver) + struct drm_driver *driver) { struct drm_device *dev; int ret; @@ -318,7 +319,7 @@ int drm_put_head(struct drm_head * head) drm_proc_cleanup(minor, drm_proc_root, head->dev_root); drm_sysfs_device_remove(head->dev); - *head = (struct drm_head){.dev = NULL}; + *head = (struct drm_head) {.dev = NULL}; drm_heads[minor] = NULL; return 0; diff --git a/linux-core/drm_sysfs.c b/linux-core/drm_sysfs.c index caec120a..3aaac11b 100644 --- a/linux-core/drm_sysfs.c +++ b/linux-core/drm_sysfs.c @@ -162,12 +162,7 @@ int drm_sysfs_device_add(struct drm_device *dev, struct drm_head *head) dev->dev.parent = &dev->pdev->dev; dev->dev.class = drm_class; dev->dev.release = drm_sysfs_device_release; - /* - * This will actually add the major:minor file so that udev - * will create the device node. We don't want to do that just - * yet... - */ - /* dev->dev.devt = head->device; */ + dev->dev.devt = head->device; snprintf(dev->dev.bus_id, BUS_ID_SIZE, "card%d", head->minor); err = device_register(&dev->dev); diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c index 777dd2ca..3540571f 100644 --- a/linux-core/drm_ttm.c +++ b/linux-core/drm_ttm.c @@ -239,9 +239,6 @@ struct page *drm_ttm_get_page(struct drm_ttm *ttm, int index) } EXPORT_SYMBOL(drm_ttm_get_page); - - - int drm_ttm_set_user(struct drm_ttm *ttm, struct task_struct *tsk, int write, @@ -278,8 +275,6 @@ int drm_ttm_set_user(struct drm_ttm *ttm, return 0; } - - int drm_ttm_populate(struct drm_ttm *ttm) { struct page *page; diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index 42e1f27a..f2681cc9 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -263,7 +263,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) dmah.size = map->size; __drm_pci_free(dev, &dmah); break; - case _DRM_TTM: + case _DRM_TTM: BUG_ON(1); break; } @@ -632,9 +632,9 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); #endif if (io_remap_pfn_range(vma, vma->vm_start, - (map->offset + offset) >> PAGE_SHIFT, - vma->vm_end - vma->vm_start, - vma->vm_page_prot)) + (map->offset + offset) >> PAGE_SHIFT, + vma->vm_end - vma->vm_start, + vma->vm_page_prot)) return -EAGAIN; DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," " offset = 0x%lx\n", diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c index 949355aa..c085fbc9 100644 --- a/linux-core/i810_dma.c +++ b/linux-core/i810_dma.c @@ -1271,7 +1271,7 @@ int i810_driver_dma_quiescent(struct drm_device * dev) } struct drm_ioctl_desc i810_ioctls[] = { - DRM_IOCTL_DEF(DRM_I810_INIT, i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_I810_INIT, i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_I810_VERTEX, i810_dma_vertex, DRM_AUTH), DRM_IOCTL_DEF(DRM_I810_CLEAR, i810_clear_bufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_I810_FLUSH, i810_flush_ioctl, DRM_AUTH), diff --git a/linux-core/i915_buffer.c b/linux-core/i915_buffer.c index fb063ee7..b000a725 100644 --- a/linux-core/i915_buffer.c +++ b/linux-core/i915_buffer.c @@ -277,7 +277,7 @@ void i915_flush_ttm(struct drm_ttm *ttm) return; DRM_MEMORYBARRIER(); - for (i = ttm->num_pages-1; i >= 0; i--) + for (i = ttm->num_pages - 1; i >= 0; i--) drm_cache_flush_page(drm_ttm_get_page(ttm, i)); DRM_MEMORYBARRIER(); } diff --git a/linux-core/i915_compat.c b/linux-core/i915_compat.c index e119a992..58fb8418 100644 --- a/linux-core/i915_compat.c +++ b/linux-core/i915_compat.c @@ -84,7 +84,8 @@ static void intel_i965_g33_setup_chipset_flush(struct pci_dev *pdev) intel_alloc_chipset_flush_resource(pdev); - pci_write_config_dword(pdev, I965_IFPADDR + 4, (i9xx_private.ifp_resource.start >> 32)); + pci_write_config_dword(pdev, I965_IFPADDR + 4, + upper_32_bits(i9xx_private.ifp_resource.start)); pci_write_config_dword(pdev, I965_IFPADDR, (i9xx_private.ifp_resource.start & 0xffffffff) | 0x1); } else { u64 l64; diff --git a/linux-core/i915_ioc32.c b/linux-core/i915_ioc32.c index 7e733d33..11dee035 100644 --- a/linux-core/i915_ioc32.c +++ b/linux-core/i915_ioc32.c @@ -45,7 +45,7 @@ typedef struct _drm_i915_batchbuffer32 { } drm_i915_batchbuffer32_t; static int compat_i915_batchbuffer(struct file *file, unsigned int cmd, - unsigned long arg) + unsigned long arg) { drm_i915_batchbuffer32_t batchbuffer32; drm_i915_batchbuffer_t __user *batchbuffer; @@ -81,7 +81,7 @@ typedef struct _drm_i915_cmdbuffer32 { } drm_i915_cmdbuffer32_t; static int compat_i915_cmdbuffer(struct file *file, unsigned int cmd, - unsigned long arg) + unsigned long arg) { drm_i915_cmdbuffer32_t cmdbuffer32; drm_i915_cmdbuffer_t __user *cmdbuffer; @@ -111,7 +111,7 @@ typedef struct drm_i915_irq_emit32 { } drm_i915_irq_emit32_t; static int compat_i915_irq_emit(struct file *file, unsigned int cmd, - unsigned long arg) + unsigned long arg) { drm_i915_irq_emit32_t req32; drm_i915_irq_emit_t __user *request; @@ -134,7 +134,7 @@ typedef struct drm_i915_getparam32 { } drm_i915_getparam32_t; static int compat_i915_getparam(struct file *file, unsigned int cmd, - unsigned long arg) + unsigned long arg) { drm_i915_getparam32_t req32; drm_i915_getparam_t __user *request; @@ -161,7 +161,7 @@ typedef struct drm_i915_mem_alloc32 { } drm_i915_mem_alloc32_t; static int compat_i915_alloc(struct file *file, unsigned int cmd, - unsigned long arg) + unsigned long arg) { drm_i915_mem_alloc32_t req32; drm_i915_mem_alloc_t __user *request; diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c index e3d26a08..bab90aa5 100644 --- a/linux-core/mga_drv.c +++ b/linux-core/mga_drv.c @@ -142,8 +142,8 @@ static int mga_driver_device_is_agp(struct drm_device * dev) */ if ((pdev->device == 0x0525) && pdev->bus->self - && (pdev->bus->self->vendor == 0x3388) - && (pdev->bus->self->device == 0x0021) ) { + && (pdev->bus->self->vendor == 0x3388) + && (pdev->bus->self->device == 0x0021)) { return 0; } diff --git a/linux-core/radeon_ioc32.c b/linux-core/radeon_ioc32.c index bc8aa35a..a842c743 100644 --- a/linux-core/radeon_ioc32.c +++ b/linux-core/radeon_ioc32.c @@ -136,7 +136,7 @@ typedef struct drm_radeon_stipple32 { static int compat_radeon_cp_stipple(struct file *file, unsigned int cmd, unsigned long arg) { - drm_radeon_stipple32_t __user *argp = (void __user *) arg; + drm_radeon_stipple32_t __user *argp = (void __user *)arg; drm_radeon_stipple_t __user *request; u32 mask; @@ -176,7 +176,7 @@ static int compat_radeon_cp_texture(struct file *file, unsigned int cmd, drm_radeon_tex_image32_t img32; drm_radeon_tex_image_t __user *image; - if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) + if (copy_from_user(&req32, (void __user *)arg, sizeof(req32))) return -EFAULT; if (req32.image == 0) return -EINVAL; @@ -223,7 +223,7 @@ static int compat_radeon_cp_vertex2(struct file *file, unsigned int cmd, drm_radeon_vertex2_32_t req32; drm_radeon_vertex2_t __user *request; - if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) + if (copy_from_user(&req32, (void __user *)arg, sizeof(req32))) return -EFAULT; request = compat_alloc_user_space(sizeof(*request)); @@ -255,7 +255,7 @@ static int compat_radeon_cp_cmdbuf(struct file *file, unsigned int cmd, drm_radeon_cmd_buffer32_t req32; drm_radeon_cmd_buffer_t __user *request; - if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) + if (copy_from_user(&req32, (void __user *)arg, sizeof(req32))) return -EFAULT; request = compat_alloc_user_space(sizeof(*request)); @@ -283,7 +283,7 @@ static int compat_radeon_cp_getparam(struct file *file, unsigned int cmd, drm_radeon_getparam32_t req32; drm_radeon_getparam_t __user *request; - if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) + if (copy_from_user(&req32, (void __user *)arg, sizeof(req32))) return -EFAULT; request = compat_alloc_user_space(sizeof(*request)); @@ -310,7 +310,7 @@ static int compat_radeon_mem_alloc(struct file *file, unsigned int cmd, drm_radeon_mem_alloc32_t req32; drm_radeon_mem_alloc_t __user *request; - if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) + if (copy_from_user(&req32, (void __user *)arg, sizeof(req32))) return -EFAULT; request = compat_alloc_user_space(sizeof(*request)); @@ -336,7 +336,7 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd, drm_radeon_irq_emit32_t req32; drm_radeon_irq_emit_t __user *request; - if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) + if (copy_from_user(&req32, (void __user *)arg, sizeof(req32))) return -EFAULT; request = compat_alloc_user_space(sizeof(*request)); @@ -362,7 +362,7 @@ static int compat_radeon_cp_setparam(struct file *file, unsigned int cmd, drm_radeon_setparam32_t req32; drm_radeon_setparam_t __user *request; - if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) + if (copy_from_user(&req32, (void __user *)arg, sizeof(req32))) return -EFAULT; request = compat_alloc_user_space(sizeof(*request)); diff --git a/linux-core/sis_mm.c b/linux-core/sis_mm.c index 2225ec80..5110d6e5 100644 --- a/linux-core/sis_mm.c +++ b/linux-core/sis_mm.c @@ -74,7 +74,7 @@ static void sis_sman_mm_destroy(void *private) ; } -unsigned long sis_sman_mm_offset(void *private, void *ref) +static unsigned long sis_sman_mm_offset(void *private, void *ref) { return ~((unsigned long)ref); } @@ -119,7 +119,7 @@ static int sis_fb_init(struct drm_device *dev, void *data, struct drm_file *file return 0; } -static int sis_drm_alloc(struct drm_device * dev, struct drm_file *file_priv, +static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file_priv, void *data, int pool) { drm_sis_private_t *dev_priv = dev->dev_private; @@ -231,8 +231,7 @@ static drm_local_map_t *sis_reg_init(struct drm_device *dev) return NULL; } -int -sis_idle(struct drm_device *dev) +int sis_idle(struct drm_device *dev) { drm_sis_private_t *dev_priv = dev->dev_private; uint32_t idle_reg; diff --git a/linux-core/via_dmablit.c b/linux-core/via_dmablit.c index e285ca7b..a6a21782 100644 --- a/linux-core/via_dmablit.c +++ b/linux-core/via_dmablit.c @@ -239,8 +239,10 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) return -ENOMEM; memset(vsg->pages, 0, sizeof(struct page *) * vsg->num_pages); down_read(¤t->mm->mmap_sem); - ret = get_user_pages(current, current->mm, (unsigned long) xfer->mem_addr, - vsg->num_pages, (vsg->direction == DMA_FROM_DEVICE), + ret = get_user_pages(current, current->mm, + (unsigned long)xfer->mem_addr, + vsg->num_pages, + (vsg->direction == DMA_FROM_DEVICE), 0, vsg->pages, NULL); up_read(¤t->mm->mmap_sem); @@ -509,7 +511,7 @@ via_dmablit_workqueue(struct work_struct *work) #else drm_via_blitq_t *blitq = container_of(work, drm_via_blitq_t, wq); #endif - struct drm_device *dev = blitq->dev; + struct drm_device *dev = blitq->dev; unsigned long irqsave; drm_via_sg_info_t *cur_sg; int cur_released; diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index d9a94f5f..9408073e 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -64,7 +64,7 @@ struct xgi_info { struct drm_map *fb_map; /* look up table parameters */ - struct ati_pcigart_info gart_info; + struct drm_ati_pcigart_info gart_info; unsigned int lutPageSize; struct drm_sman sman; |