提交 c2dc1ad5 编写于 作者: L Linus Torvalds

Merge branch 'drm-patches' of ssh://master.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-patches' of ssh://master.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm: remove core typedefs from the ioc32 wrappers
  drm: remove sarea typedefs
  drm: detypedef the hashtab and more of sman
  drm: de-typedef sman
  drm: detypedeffing continues...
  drm: detypef waitlist/freelist/buf_entry/device_dma/drm_queue structs
  drm: drop drm_vma_entry_t, drm_magic_entry_t
  drm: drop drm_buf_t typedef
  drm: fixup other drivers for typedef removals
  drm: remove drm_file_t, drm_device_t and drm_head_t typedefs
  drm: remove a bunch of typedefs on the userspace interface
  r300: updates register header
  radeon: add support for vblank on crtc2
  drm: cleanup list initialisation
  drm: fix typo on code drm getsarea
  drm: remove DRM_GETSAREA and replace with drm_getsarea function
  drm: cleanup use of Linux list handling macros
...@@ -73,9 +73,9 @@ static void drm_ati_free_pcigart_table(void *address, int order) ...@@ -73,9 +73,9 @@ static void drm_ati_free_pcigart_table(void *address, int order)
free_pages((unsigned long)address, order); free_pages((unsigned long)address, order);
} }
int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info) int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info)
{ {
drm_sg_mem_t *entry = dev->sg; struct drm_sg_mem *entry = dev->sg;
unsigned long pages; unsigned long pages;
int i; int i;
int order; int order;
...@@ -122,9 +122,9 @@ int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info) ...@@ -122,9 +122,9 @@ int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info)
} }
EXPORT_SYMBOL(drm_ati_pcigart_cleanup); EXPORT_SYMBOL(drm_ati_pcigart_cleanup);
int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info)
{ {
drm_sg_mem_t *entry = dev->sg; struct drm_sg_mem *entry = dev->sg;
void *address = NULL; void *address = NULL;
unsigned long pages; unsigned long pages;
u32 *pci_gart, page_base, bus_address = 0; u32 *pci_gart, page_base, bus_address = 0;
......
此差异已折叠。
此差异已折叠。
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
* Verifies the AGP device has been initialized and acquired and fills in the * 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. * drm_agp_info structure with the information in drm_agp_head::agp_info.
*/ */
int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info) int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info)
{ {
DRM_AGP_KERN *kern; DRM_AGP_KERN *kern;
...@@ -74,16 +74,16 @@ EXPORT_SYMBOL(drm_agp_info); ...@@ -74,16 +74,16 @@ EXPORT_SYMBOL(drm_agp_info);
int drm_agp_info_ioctl(struct inode *inode, struct file *filp, int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_agp_info_t info; struct drm_agp_info info;
int err; int err;
err = drm_agp_info(dev, &info); err = drm_agp_info(dev, &info);
if (err) if (err)
return err; return err;
if (copy_to_user((drm_agp_info_t __user *) arg, &info, sizeof(info))) if (copy_to_user((struct drm_agp_info __user *) arg, &info, sizeof(info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -97,7 +97,7 @@ int drm_agp_info_ioctl(struct inode *inode, struct file *filp, ...@@ -97,7 +97,7 @@ int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
* Verifies the AGP device hasn't been acquired before and calls * Verifies the AGP device hasn't been acquired before and calls
* \c agp_backend_acquire. * \c agp_backend_acquire.
*/ */
int drm_agp_acquire(drm_device_t * dev) int drm_agp_acquire(struct drm_device * dev)
{ {
if (!dev->agp) if (!dev->agp)
return -ENODEV; return -ENODEV;
...@@ -126,9 +126,9 @@ EXPORT_SYMBOL(drm_agp_acquire); ...@@ -126,9 +126,9 @@ EXPORT_SYMBOL(drm_agp_acquire);
int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
return drm_agp_acquire((drm_device_t *) priv->head->dev); return drm_agp_acquire((struct drm_device *) priv->head->dev);
} }
/** /**
...@@ -139,7 +139,7 @@ int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, ...@@ -139,7 +139,7 @@ int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
* *
* Verifies the AGP device has been acquired and calls \c agp_backend_release. * Verifies the AGP device has been acquired and calls \c agp_backend_release.
*/ */
int drm_agp_release(drm_device_t * dev) int drm_agp_release(struct drm_device * dev)
{ {
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
...@@ -152,8 +152,8 @@ EXPORT_SYMBOL(drm_agp_release); ...@@ -152,8 +152,8 @@ EXPORT_SYMBOL(drm_agp_release);
int drm_agp_release_ioctl(struct inode *inode, struct file *filp, int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
return drm_agp_release(dev); return drm_agp_release(dev);
} }
...@@ -168,7 +168,7 @@ int drm_agp_release_ioctl(struct inode *inode, struct file *filp, ...@@ -168,7 +168,7 @@ int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
* Verifies the AGP device has been acquired but not enabled, and calls * Verifies the AGP device has been acquired but not enabled, and calls
* \c agp_enable. * \c agp_enable.
*/ */
int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode) int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode)
{ {
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
...@@ -185,11 +185,11 @@ EXPORT_SYMBOL(drm_agp_enable); ...@@ -185,11 +185,11 @@ EXPORT_SYMBOL(drm_agp_enable);
int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_agp_mode_t mode; struct drm_agp_mode mode;
if (copy_from_user(&mode, (drm_agp_mode_t __user *) arg, sizeof(mode))) if (copy_from_user(&mode, (struct drm_agp_mode __user *) arg, sizeof(mode)))
return -EFAULT; return -EFAULT;
return drm_agp_enable(dev, mode); return drm_agp_enable(dev, mode);
...@@ -207,9 +207,9 @@ int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, ...@@ -207,9 +207,9 @@ int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
* Verifies the AGP device is present and has been acquired, allocates the * Verifies the AGP device is present and has been acquired, allocates the
* memory via alloc_agp() and creates a drm_agp_mem entry for it. * memory via alloc_agp() and creates a drm_agp_mem entry for it.
*/ */
int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request) int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
{ {
drm_agp_mem_t *entry; struct drm_agp_mem *entry;
DRM_AGP_MEM *memory; DRM_AGP_MEM *memory;
unsigned long pages; unsigned long pages;
u32 type; u32 type;
...@@ -232,11 +232,7 @@ int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request) ...@@ -232,11 +232,7 @@ int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request)
entry->memory = memory; entry->memory = memory;
entry->bound = 0; entry->bound = 0;
entry->pages = pages; entry->pages = pages;
entry->prev = NULL; list_add(&entry->head, &dev->agp->memory);
entry->next = dev->agp->memory;
if (dev->agp->memory)
dev->agp->memory->prev = entry;
dev->agp->memory = entry;
request->handle = entry->handle; request->handle = entry->handle;
request->physical = memory->physical; request->physical = memory->physical;
...@@ -248,10 +244,10 @@ EXPORT_SYMBOL(drm_agp_alloc); ...@@ -248,10 +244,10 @@ EXPORT_SYMBOL(drm_agp_alloc);
int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp, int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_agp_buffer_t request; struct drm_agp_buffer request;
drm_agp_buffer_t __user *argp = (void __user *)arg; struct drm_agp_buffer __user *argp = (void __user *)arg;
int err; int err;
if (copy_from_user(&request, argp, sizeof(request))) if (copy_from_user(&request, argp, sizeof(request)))
...@@ -262,10 +258,12 @@ int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp, ...@@ -262,10 +258,12 @@ int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
return err; return err;
if (copy_to_user(argp, &request, sizeof(request))) { if (copy_to_user(argp, &request, sizeof(request))) {
drm_agp_mem_t *entry = dev->agp->memory; struct drm_agp_mem *entry;
list_for_each_entry(entry, &dev->agp->memory, head) {
dev->agp->memory = entry->next; if (entry->handle == request.handle)
dev->agp->memory->prev = NULL; break;
}
list_del(&entry->head);
drm_free_agp(entry->memory, entry->pages); drm_free_agp(entry->memory, entry->pages);
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
return -EFAULT; return -EFAULT;
...@@ -283,12 +281,12 @@ int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp, ...@@ -283,12 +281,12 @@ int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
* *
* Walks through drm_agp_head::memory until finding a matching handle. * Walks through drm_agp_head::memory until finding a matching handle.
*/ */
static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t * dev, static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev,
unsigned long handle) unsigned long handle)
{ {
drm_agp_mem_t *entry; struct drm_agp_mem *entry;
for (entry = dev->agp->memory; entry; entry = entry->next) { list_for_each_entry(entry, &dev->agp->memory, head) {
if (entry->handle == handle) if (entry->handle == handle)
return entry; return entry;
} }
...@@ -307,9 +305,9 @@ static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t * dev, ...@@ -307,9 +305,9 @@ static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t * dev,
* Verifies the AGP device is present and acquired, looks-up the AGP memory * Verifies the AGP device is present and acquired, looks-up the AGP memory
* entry and passes it to the unbind_agp() function. * entry and passes it to the unbind_agp() function.
*/ */
int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request) int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
{ {
drm_agp_mem_t *entry; struct drm_agp_mem *entry;
int ret; int ret;
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
...@@ -328,12 +326,12 @@ EXPORT_SYMBOL(drm_agp_unbind); ...@@ -328,12 +326,12 @@ EXPORT_SYMBOL(drm_agp_unbind);
int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp, int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_agp_binding_t request; struct drm_agp_binding request;
if (copy_from_user if (copy_from_user
(&request, (drm_agp_binding_t __user *) arg, sizeof(request))) (&request, (struct drm_agp_binding __user *) arg, sizeof(request)))
return -EFAULT; return -EFAULT;
return drm_agp_unbind(dev, &request); return drm_agp_unbind(dev, &request);
...@@ -352,9 +350,9 @@ int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp, ...@@ -352,9 +350,9 @@ int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
* is currently bound into the GATT. Looks-up the AGP memory entry and passes * is currently bound into the GATT. Looks-up the AGP memory entry and passes
* it to bind_agp() function. * it to bind_agp() function.
*/ */
int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request) int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
{ {
drm_agp_mem_t *entry; struct drm_agp_mem *entry;
int retcode; int retcode;
int page; int page;
...@@ -377,12 +375,12 @@ EXPORT_SYMBOL(drm_agp_bind); ...@@ -377,12 +375,12 @@ EXPORT_SYMBOL(drm_agp_bind);
int drm_agp_bind_ioctl(struct inode *inode, struct file *filp, int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_agp_binding_t request; struct drm_agp_binding request;
if (copy_from_user if (copy_from_user
(&request, (drm_agp_binding_t __user *) arg, sizeof(request))) (&request, (struct drm_agp_binding __user *) arg, sizeof(request)))
return -EFAULT; return -EFAULT;
return drm_agp_bind(dev, &request); return drm_agp_bind(dev, &request);
...@@ -402,9 +400,9 @@ int drm_agp_bind_ioctl(struct inode *inode, struct file *filp, ...@@ -402,9 +400,9 @@ int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
* unbind_agp(). Frees it via free_agp() as well as the entry itself * unbind_agp(). Frees it via free_agp() as well as the entry itself
* and unlinks from the doubly linked list it's inserted in. * and unlinks from the doubly linked list it's inserted in.
*/ */
int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request) int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
{ {
drm_agp_mem_t *entry; struct drm_agp_mem *entry;
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
...@@ -413,13 +411,7 @@ int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request) ...@@ -413,13 +411,7 @@ int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request)
if (entry->bound) if (entry->bound)
drm_unbind_agp(entry->memory); drm_unbind_agp(entry->memory);
if (entry->prev) list_del(&entry->head);
entry->prev->next = entry->next;
else
dev->agp->memory = entry->next;
if (entry->next)
entry->next->prev = entry->prev;
drm_free_agp(entry->memory, entry->pages); drm_free_agp(entry->memory, entry->pages);
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
...@@ -430,12 +422,12 @@ EXPORT_SYMBOL(drm_agp_free); ...@@ -430,12 +422,12 @@ EXPORT_SYMBOL(drm_agp_free);
int drm_agp_free_ioctl(struct inode *inode, struct file *filp, int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_agp_buffer_t request; struct drm_agp_buffer request;
if (copy_from_user if (copy_from_user
(&request, (drm_agp_buffer_t __user *) arg, sizeof(request))) (&request, (struct drm_agp_buffer __user *) arg, sizeof(request)))
return -EFAULT; return -EFAULT;
return drm_agp_free(dev, &request); return drm_agp_free(dev, &request);
...@@ -450,9 +442,9 @@ int drm_agp_free_ioctl(struct inode *inode, struct file *filp, ...@@ -450,9 +442,9 @@ int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
* via the inter_module_* functions. Creates and initializes a drm_agp_head * via the inter_module_* functions. Creates and initializes a drm_agp_head
* structure. * structure.
*/ */
drm_agp_head_t *drm_agp_init(drm_device_t * dev) struct drm_agp_head *drm_agp_init(struct drm_device *dev)
{ {
drm_agp_head_t *head = NULL; struct drm_agp_head *head = NULL;
if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS))) if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
return NULL; return NULL;
...@@ -472,7 +464,7 @@ drm_agp_head_t *drm_agp_init(drm_device_t * dev) ...@@ -472,7 +464,7 @@ drm_agp_head_t *drm_agp_init(drm_device_t * dev)
drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS); drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
return NULL; return NULL;
} }
head->memory = NULL; INIT_LIST_HEAD(&head->memory);
head->cant_use_aperture = head->agp_info.cant_use_aperture; head->cant_use_aperture = head->agp_info.cant_use_aperture;
head->page_mask = head->agp_info.page_mask; head->page_mask = head->agp_info.page_mask;
......
...@@ -45,15 +45,15 @@ ...@@ -45,15 +45,15 @@
* the one with matching magic number, while holding the drm_device::struct_mutex * the one with matching magic number, while holding the drm_device::struct_mutex
* lock. * lock.
*/ */
static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) static struct drm_file *drm_find_file(struct drm_device * dev, drm_magic_t magic)
{ {
drm_file_t *retval = NULL; struct drm_file *retval = NULL;
drm_magic_entry_t *pt; struct drm_magic_entry *pt;
drm_hash_item_t *hash; struct drm_hash_item *hash;
mutex_lock(&dev->struct_mutex); 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)) {
pt = drm_hash_entry(hash, drm_magic_entry_t, hash_item); pt = drm_hash_entry(hash, struct drm_magic_entry, hash_item);
retval = pt->priv; retval = pt->priv;
} }
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
...@@ -71,10 +71,10 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) ...@@ -71,10 +71,10 @@ 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 * associated the magic number hash key in drm_device::magiclist, while holding
* the drm_device::struct_mutex lock. * the drm_device::struct_mutex lock.
*/ */
static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, static int drm_add_magic(struct drm_device * dev, struct drm_file * priv,
drm_magic_t magic) drm_magic_t magic)
{ {
drm_magic_entry_t *entry; struct drm_magic_entry *entry;
DRM_DEBUG("%d\n", magic); DRM_DEBUG("%d\n", magic);
...@@ -102,10 +102,10 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, ...@@ -102,10 +102,10 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv,
* Searches and unlinks the entry in drm_device::magiclist with the magic * Searches and unlinks the entry in drm_device::magiclist with the magic
* number hash key, while holding the drm_device::struct_mutex lock. * number hash key, while holding the drm_device::struct_mutex lock.
*/ */
static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic)
{ {
drm_magic_entry_t *pt; struct drm_magic_entry *pt;
drm_hash_item_t *hash; struct drm_hash_item *hash;
DRM_DEBUG("%d\n", magic); DRM_DEBUG("%d\n", magic);
...@@ -114,7 +114,7 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) ...@@ -114,7 +114,7 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic)
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return -EINVAL; return -EINVAL;
} }
pt = drm_hash_entry(hash, drm_magic_entry_t, hash_item); pt = drm_hash_entry(hash, struct drm_magic_entry, hash_item);
drm_ht_remove_item(&dev->magiclist, hash); drm_ht_remove_item(&dev->magiclist, hash);
list_del(&pt->head); list_del(&pt->head);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
...@@ -142,9 +142,9 @@ int drm_getmagic(struct inode *inode, struct file *filp, ...@@ -142,9 +142,9 @@ int drm_getmagic(struct inode *inode, struct file *filp,
{ {
static drm_magic_t sequence = 0; static drm_magic_t sequence = 0;
static DEFINE_SPINLOCK(lock); static DEFINE_SPINLOCK(lock);
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_auth_t auth; struct drm_auth auth;
/* Find unique magic */ /* Find unique magic */
if (priv->magic) { if (priv->magic) {
...@@ -162,7 +162,7 @@ int drm_getmagic(struct inode *inode, struct file *filp, ...@@ -162,7 +162,7 @@ int drm_getmagic(struct inode *inode, struct file *filp,
} }
DRM_DEBUG("%u\n", auth.magic); DRM_DEBUG("%u\n", auth.magic);
if (copy_to_user((drm_auth_t __user *) arg, &auth, sizeof(auth))) if (copy_to_user((struct drm_auth __user *) arg, &auth, sizeof(auth)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -181,12 +181,12 @@ int drm_getmagic(struct inode *inode, struct file *filp, ...@@ -181,12 +181,12 @@ int drm_getmagic(struct inode *inode, struct file *filp,
int drm_authmagic(struct inode *inode, struct file *filp, int drm_authmagic(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_auth_t auth; struct drm_auth auth;
drm_file_t *file; struct drm_file *file;
if (copy_from_user(&auth, (drm_auth_t __user *) arg, sizeof(auth))) if (copy_from_user(&auth, (struct drm_auth __user *) arg, sizeof(auth)))
return -EFAULT; return -EFAULT;
DRM_DEBUG("%u\n", auth.magic); DRM_DEBUG("%u\n", auth.magic);
if ((file = drm_find_file(dev, auth.magic))) { if ((file = drm_find_file(dev, auth.magic))) {
......
...@@ -36,26 +36,24 @@ ...@@ -36,26 +36,24 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include "drmP.h" #include "drmP.h"
unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource) unsigned long drm_get_resource_start(struct drm_device *dev, unsigned int resource)
{ {
return pci_resource_start(dev->pdev, resource); return pci_resource_start(dev->pdev, resource);
} }
EXPORT_SYMBOL(drm_get_resource_start); EXPORT_SYMBOL(drm_get_resource_start);
unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource) unsigned long drm_get_resource_len(struct drm_device *dev, unsigned int resource)
{ {
return pci_resource_len(dev->pdev, resource); return pci_resource_len(dev->pdev, resource);
} }
EXPORT_SYMBOL(drm_get_resource_len); EXPORT_SYMBOL(drm_get_resource_len);
static drm_map_list_t *drm_find_matching_map(drm_device_t *dev, static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
drm_local_map_t *map) drm_local_map_t *map)
{ {
struct list_head *list; struct drm_map_list *entry;
list_for_each_entry(entry, &dev->maplist, head) {
list_for_each(list, &dev->maplist->head) {
drm_map_list_t *entry = list_entry(list, drm_map_list_t, head);
if (entry->map && map->type == entry->map->type && if (entry->map && map->type == entry->map->type &&
((entry->map->offset == map->offset) || ((entry->map->offset == map->offset) ||
(map->type == _DRM_SHM && map->flags==_DRM_CONTAINS_LOCK))) { (map->type == _DRM_SHM && map->flags==_DRM_CONTAINS_LOCK))) {
...@@ -66,7 +64,7 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t *dev, ...@@ -66,7 +64,7 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t *dev,
return NULL; return NULL;
} }
static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash, static int drm_map_handle(struct drm_device *dev, struct drm_hash_item *hash,
unsigned long user_token, int hashed_handle) unsigned long user_token, int hashed_handle)
{ {
int use_hashed_handle; int use_hashed_handle;
...@@ -103,12 +101,13 @@ static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash, ...@@ -103,12 +101,13 @@ static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash,
* type. Adds the map to the map list drm_device::maplist. Adds MTRR's where * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where
* applicable and if supported by the kernel. * applicable and if supported by the kernel.
*/ */
static int drm_addmap_core(drm_device_t * dev, unsigned int offset, static int drm_addmap_core(struct drm_device * dev, unsigned int offset,
unsigned int size, drm_map_type_t type, unsigned int size, enum drm_map_type type,
drm_map_flags_t flags, drm_map_list_t ** maplist) enum drm_map_flags flags,
struct drm_map_list ** maplist)
{ {
drm_map_t *map; struct drm_map *map;
drm_map_list_t *list; struct drm_map_list *list;
drm_dma_handle_t *dmah; drm_dma_handle_t *dmah;
unsigned long user_token; unsigned long user_token;
int ret; int ret;
...@@ -214,7 +213,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, ...@@ -214,7 +213,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
} }
break; break;
case _DRM_AGP: { case _DRM_AGP: {
drm_agp_mem_t *entry; struct drm_agp_mem *entry;
int valid = 0; int valid = 0;
if (!drm_core_has_AGP(dev)) { if (!drm_core_has_AGP(dev)) {
...@@ -237,14 +236,14 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, ...@@ -237,14 +236,14 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
* skipped and we double check that dev->agp->memory is * skipped and we double check that dev->agp->memory is
* actually set as well as being invalid before EPERM'ing * actually set as well as being invalid before EPERM'ing
*/ */
for (entry = dev->agp->memory; entry; entry = entry->next) { list_for_each_entry(entry, &dev->agp->memory, head) {
if ((map->offset >= entry->bound) && if ((map->offset >= entry->bound) &&
(map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) { (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
valid = 1; valid = 1;
break; break;
} }
} }
if (dev->agp->memory && !valid) { if (!list_empty(&dev->agp->memory) && !valid) {
drm_free(map, sizeof(*map), DRM_MEM_MAPS); drm_free(map, sizeof(*map), DRM_MEM_MAPS);
return -EPERM; return -EPERM;
} }
...@@ -289,7 +288,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, ...@@ -289,7 +288,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
list->map = map; list->map = map;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
list_add(&list->head, &dev->maplist->head); list_add(&list->head, &dev->maplist);
/* Assign a 32-bit handle */ /* Assign a 32-bit handle */
/* We do it here so that dev->struct_mutex protects the increment */ /* We do it here so that dev->struct_mutex protects the increment */
...@@ -312,11 +311,11 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, ...@@ -312,11 +311,11 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
return 0; return 0;
} }
int drm_addmap(drm_device_t * dev, unsigned int offset, int drm_addmap(struct drm_device * dev, unsigned int offset,
unsigned int size, drm_map_type_t type, unsigned int size, enum drm_map_type type,
drm_map_flags_t flags, drm_local_map_t ** map_ptr) enum drm_map_flags flags, drm_local_map_t ** map_ptr)
{ {
drm_map_list_t *list; struct drm_map_list *list;
int rc; int rc;
rc = drm_addmap_core(dev, offset, size, type, flags, &list); rc = drm_addmap_core(dev, offset, size, type, flags, &list);
...@@ -330,11 +329,11 @@ EXPORT_SYMBOL(drm_addmap); ...@@ -330,11 +329,11 @@ EXPORT_SYMBOL(drm_addmap);
int drm_addmap_ioctl(struct inode *inode, struct file *filp, int drm_addmap_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_map_t map; struct drm_map map;
drm_map_list_t *maplist; struct drm_map_list *maplist;
drm_map_t __user *argp = (void __user *)arg; struct drm_map __user *argp = (void __user *)arg;
int err; int err;
if (!(filp->f_mode & 3)) if (!(filp->f_mode & 3))
...@@ -353,7 +352,7 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp, ...@@ -353,7 +352,7 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp,
if (err) if (err)
return err; return err;
if (copy_to_user(argp, maplist->map, sizeof(drm_map_t))) if (copy_to_user(argp, maplist->map, sizeof(struct drm_map)))
return -EFAULT; return -EFAULT;
/* avoid a warning on 64-bit, this casting isn't very nice, but the API is set so too late */ /* avoid a warning on 64-bit, this casting isn't very nice, but the API is set so too late */
...@@ -369,7 +368,7 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp, ...@@ -369,7 +368,7 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp,
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param filp file pointer.
* \param cmd command. * \param cmd command.
* \param arg pointer to a drm_map_t structure. * \param arg pointer to a struct drm_map structure.
* \return zero on success or a negative value on error. * \return zero on success or a negative value on error.
* *
* Searches the map on drm_device::maplist, removes it from the list, see if * Searches the map on drm_device::maplist, removes it from the list, see if
...@@ -378,31 +377,26 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp, ...@@ -378,31 +377,26 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp,
* *
* \sa drm_addmap * \sa drm_addmap
*/ */
int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map) int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map)
{ {
struct list_head *list; struct drm_map_list *r_list = NULL, *list_t;
drm_map_list_t *r_list = NULL;
drm_dma_handle_t dmah; drm_dma_handle_t dmah;
int found = 0;
/* Find the list entry for the map and remove it */ /* Find the list entry for the map and remove it */
list_for_each(list, &dev->maplist->head) { list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
r_list = list_entry(list, drm_map_list_t, head);
if (r_list->map == map) { if (r_list->map == map) {
list_del(list); list_del(&r_list->head);
drm_ht_remove_key(&dev->map_hash, drm_ht_remove_key(&dev->map_hash,
r_list->user_token >> PAGE_SHIFT); r_list->user_token >> PAGE_SHIFT);
drm_free(list, sizeof(*list), DRM_MEM_MAPS); drm_free(r_list, sizeof(*r_list), DRM_MEM_MAPS);
found = 1;
break; break;
} }
} }
/* List has wrapped around to the head pointer, or it's empty and we if (!found)
* didn't find anything.
*/
if (list == (&dev->maplist->head)) {
return -EINVAL; return -EINVAL;
}
switch (map->type) { switch (map->type) {
case _DRM_REGISTERS: case _DRM_REGISTERS:
...@@ -433,7 +427,7 @@ int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map) ...@@ -433,7 +427,7 @@ int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map)
return 0; return 0;
} }
int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) int drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
{ {
int ret; int ret;
...@@ -456,21 +450,19 @@ int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) ...@@ -456,21 +450,19 @@ int drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
int drm_rmmap_ioctl(struct inode *inode, struct file *filp, int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_map_t request; struct drm_map request;
drm_local_map_t *map = NULL; drm_local_map_t *map = NULL;
struct list_head *list; struct drm_map_list *r_list;
int ret; int ret;
if (copy_from_user(&request, (drm_map_t __user *) arg, sizeof(request))) { if (copy_from_user(&request, (struct drm_map __user *) arg, sizeof(request))) {
return -EFAULT; return -EFAULT;
} }
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
list_for_each(list, &dev->maplist->head) { list_for_each_entry(r_list, &dev->maplist, head) {
drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head);
if (r_list->map && 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) { r_list->map->flags & _DRM_REMOVABLE) {
...@@ -482,7 +474,7 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, ...@@ -482,7 +474,7 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
/* List has wrapped around to the head pointer, or its empty we didn't /* List has wrapped around to the head pointer, or its empty we didn't
* find anything. * find anything.
*/ */
if (list == (&dev->maplist->head)) { if (list_empty(&dev->maplist) || !map) {
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -513,7 +505,8 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, ...@@ -513,7 +505,8 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
* *
* Frees any pages and buffers associated with the given entry. * Frees any pages and buffers associated with the given entry.
*/ */
static void drm_cleanup_buf_error(drm_device_t * dev, drm_buf_entry_t * entry) static void drm_cleanup_buf_error(struct drm_device * dev,
struct drm_buf_entry * entry)
{ {
int i; int i;
...@@ -550,20 +543,20 @@ static void drm_cleanup_buf_error(drm_device_t * dev, drm_buf_entry_t * entry) ...@@ -550,20 +543,20 @@ static void drm_cleanup_buf_error(drm_device_t * dev, drm_buf_entry_t * entry)
/** /**
* Add AGP buffers for DMA transfers. * Add AGP buffers for DMA transfers.
* *
* \param dev drm_device_t to which the buffers are to be added. * \param dev struct drm_device to which the buffers are to be added.
* \param request pointer to a drm_buf_desc_t describing the request. * \param request pointer to a struct drm_buf_desc describing the request.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
* *
* After some sanity checks creates a drm_buf structure for each buffer and * After some sanity checks creates a drm_buf structure for each buffer and
* reallocates the buffer list of the same size order to accommodate the new * reallocates the buffer list of the same size order to accommodate the new
* buffers. * buffers.
*/ */
int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
{ {
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
drm_buf_entry_t *entry; struct drm_buf_entry *entry;
drm_agp_mem_t *agp_entry; struct drm_agp_mem *agp_entry;
drm_buf_t *buf; struct drm_buf *buf;
unsigned long offset; unsigned long offset;
unsigned long agp_offset; unsigned long agp_offset;
int count; int count;
...@@ -574,7 +567,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) ...@@ -574,7 +567,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
int total; int total;
int byte_count; int byte_count;
int i, valid; int i, valid;
drm_buf_t **temp_buflist; struct drm_buf **temp_buflist;
if (!dma) if (!dma)
return -EINVAL; return -EINVAL;
...@@ -606,14 +599,14 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) ...@@ -606,14 +599,14 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
/* Make sure buffers are located in AGP memory that we own */ /* Make sure buffers are located in AGP memory that we own */
valid = 0; valid = 0;
for (agp_entry = dev->agp->memory; agp_entry; agp_entry = agp_entry->next) { list_for_each_entry(agp_entry, &dev->agp->memory, head) {
if ((agp_offset >= agp_entry->bound) && if ((agp_offset >= agp_entry->bound) &&
(agp_offset + total * count <= agp_entry->bound + agp_entry->pages * PAGE_SIZE)) { (agp_offset + total * count <= agp_entry->bound + agp_entry->pages * PAGE_SIZE)) {
valid = 1; valid = 1;
break; break;
} }
} }
if (dev->agp->memory && !valid) { if (!list_empty(&dev->agp->memory) && !valid) {
DRM_DEBUG("zone invalid\n"); DRM_DEBUG("zone invalid\n");
return -EINVAL; return -EINVAL;
} }
...@@ -728,24 +721,24 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) ...@@ -728,24 +721,24 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
EXPORT_SYMBOL(drm_addbufs_agp); EXPORT_SYMBOL(drm_addbufs_agp);
#endif /* __OS_HAS_AGP */ #endif /* __OS_HAS_AGP */
int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
{ {
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
int count; int count;
int order; int order;
int size; int size;
int total; int total;
int page_order; int page_order;
drm_buf_entry_t *entry; struct drm_buf_entry *entry;
drm_dma_handle_t *dmah; drm_dma_handle_t *dmah;
drm_buf_t *buf; struct drm_buf *buf;
int alignment; int alignment;
unsigned long offset; unsigned long offset;
int i; int i;
int byte_count; int byte_count;
int page_count; int page_count;
unsigned long *temp_pagelist; unsigned long *temp_pagelist;
drm_buf_t **temp_buflist; struct drm_buf **temp_buflist;
if (!drm_core_check_feature(dev, DRIVER_PCI_DMA)) if (!drm_core_check_feature(dev, DRIVER_PCI_DMA))
return -EINVAL; return -EINVAL;
...@@ -954,11 +947,11 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) ...@@ -954,11 +947,11 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request)
} }
EXPORT_SYMBOL(drm_addbufs_pci); EXPORT_SYMBOL(drm_addbufs_pci);
static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request)
{ {
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
drm_buf_entry_t *entry; struct drm_buf_entry *entry;
drm_buf_t *buf; struct drm_buf *buf;
unsigned long offset; unsigned long offset;
unsigned long agp_offset; unsigned long agp_offset;
int count; int count;
...@@ -969,7 +962,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) ...@@ -969,7 +962,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request)
int total; int total;
int byte_count; int byte_count;
int i; int i;
drm_buf_t **temp_buflist; struct drm_buf **temp_buflist;
if (!drm_core_check_feature(dev, DRIVER_SG)) if (!drm_core_check_feature(dev, DRIVER_SG))
return -EINVAL; return -EINVAL;
...@@ -1116,11 +1109,11 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) ...@@ -1116,11 +1109,11 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request)
return 0; return 0;
} }
static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request)
{ {
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
drm_buf_entry_t *entry; struct drm_buf_entry *entry;
drm_buf_t *buf; struct drm_buf *buf;
unsigned long offset; unsigned long offset;
unsigned long agp_offset; unsigned long agp_offset;
int count; int count;
...@@ -1131,7 +1124,7 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) ...@@ -1131,7 +1124,7 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
int total; int total;
int byte_count; int byte_count;
int i; int i;
drm_buf_t **temp_buflist; struct drm_buf **temp_buflist;
if (!drm_core_check_feature(dev, DRIVER_FB_DMA)) if (!drm_core_check_feature(dev, DRIVER_FB_DMA))
return -EINVAL; return -EINVAL;
...@@ -1283,7 +1276,7 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) ...@@ -1283,7 +1276,7 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param filp file pointer.
* \param cmd command. * \param cmd command.
* \param arg pointer to a drm_buf_desc_t request. * \param arg pointer to a struct drm_buf_desc request.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
* *
* According with the memory type specified in drm_buf_desc::flags and the * According with the memory type specified in drm_buf_desc::flags and the
...@@ -1294,15 +1287,15 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) ...@@ -1294,15 +1287,15 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
int drm_addbufs(struct inode *inode, struct file *filp, int drm_addbufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_buf_desc_t request; struct drm_buf_desc request;
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
int ret; int ret;
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
return -EINVAL; return -EINVAL;
if (copy_from_user(&request, (drm_buf_desc_t __user *) arg, if (copy_from_user(&request, (struct drm_buf_desc __user *) arg,
sizeof(request))) sizeof(request)))
return -EFAULT; return -EFAULT;
...@@ -1346,11 +1339,11 @@ int drm_addbufs(struct inode *inode, struct file *filp, ...@@ -1346,11 +1339,11 @@ int drm_addbufs(struct inode *inode, struct file *filp,
int drm_infobufs(struct inode *inode, struct file *filp, int drm_infobufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
drm_buf_info_t request; struct drm_buf_info request;
drm_buf_info_t __user *argp = (void __user *)arg; struct drm_buf_info __user *argp = (void __user *)arg;
int i; int i;
int count; int count;
...@@ -1381,10 +1374,10 @@ int drm_infobufs(struct inode *inode, struct file *filp, ...@@ -1381,10 +1374,10 @@ int drm_infobufs(struct inode *inode, struct file *filp,
if (request.count >= count) { if (request.count >= count) {
for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) { for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
if (dma->bufs[i].buf_count) { if (dma->bufs[i].buf_count) {
drm_buf_desc_t __user *to = struct drm_buf_desc __user *to =
&request.list[count]; &request.list[count];
drm_buf_entry_t *from = &dma->bufs[i]; struct drm_buf_entry *from = &dma->bufs[i];
drm_freelist_t *list = &dma->bufs[i].freelist; struct drm_freelist *list = &dma->bufs[i].freelist;
if (copy_to_user(&to->count, if (copy_to_user(&to->count,
&from->buf_count, &from->buf_count,
sizeof(from->buf_count)) || sizeof(from->buf_count)) ||
...@@ -1434,12 +1427,12 @@ int drm_infobufs(struct inode *inode, struct file *filp, ...@@ -1434,12 +1427,12 @@ int drm_infobufs(struct inode *inode, struct file *filp,
int drm_markbufs(struct inode *inode, struct file *filp, int drm_markbufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
drm_buf_desc_t request; struct drm_buf_desc request;
int order; int order;
drm_buf_entry_t *entry; struct drm_buf_entry *entry;
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
return -EINVAL; return -EINVAL;
...@@ -1448,7 +1441,7 @@ int drm_markbufs(struct inode *inode, struct file *filp, ...@@ -1448,7 +1441,7 @@ int drm_markbufs(struct inode *inode, struct file *filp,
return -EINVAL; return -EINVAL;
if (copy_from_user(&request, if (copy_from_user(&request,
(drm_buf_desc_t __user *) arg, sizeof(request))) (struct drm_buf_desc __user *) arg, sizeof(request)))
return -EFAULT; return -EFAULT;
DRM_DEBUG("%d, %d, %d\n", DRM_DEBUG("%d, %d, %d\n",
...@@ -1484,13 +1477,13 @@ int drm_markbufs(struct inode *inode, struct file *filp, ...@@ -1484,13 +1477,13 @@ int drm_markbufs(struct inode *inode, struct file *filp,
int drm_freebufs(struct inode *inode, struct file *filp, int drm_freebufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
drm_buf_free_t request; struct drm_buf_free request;
int i; int i;
int idx; int idx;
drm_buf_t *buf; struct drm_buf *buf;
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
return -EINVAL; return -EINVAL;
...@@ -1499,7 +1492,7 @@ int drm_freebufs(struct inode *inode, struct file *filp, ...@@ -1499,7 +1492,7 @@ int drm_freebufs(struct inode *inode, struct file *filp,
return -EINVAL; return -EINVAL;
if (copy_from_user(&request, if (copy_from_user(&request,
(drm_buf_free_t __user *) arg, sizeof(request))) (struct drm_buf_free __user *) arg, sizeof(request)))
return -EFAULT; return -EFAULT;
DRM_DEBUG("%d\n", request.count); DRM_DEBUG("%d\n", request.count);
...@@ -1540,15 +1533,15 @@ int drm_freebufs(struct inode *inode, struct file *filp, ...@@ -1540,15 +1533,15 @@ int drm_freebufs(struct inode *inode, struct file *filp,
int drm_mapbufs(struct inode *inode, struct file *filp, int drm_mapbufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
drm_buf_map_t __user *argp = (void __user *)arg; struct drm_buf_map __user *argp = (void __user *)arg;
int retcode = 0; int retcode = 0;
const int zero = 0; const int zero = 0;
unsigned long virtual; unsigned long virtual;
unsigned long address; unsigned long address;
drm_buf_map_t request; struct drm_buf_map request;
int i; int i;
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
...@@ -1574,7 +1567,7 @@ int drm_mapbufs(struct inode *inode, struct file *filp, ...@@ -1574,7 +1567,7 @@ int drm_mapbufs(struct inode *inode, struct file *filp,
&& (dma->flags & _DRM_DMA_USE_SG)) && (dma->flags & _DRM_DMA_USE_SG))
|| (drm_core_check_feature(dev, DRIVER_FB_DMA) || (drm_core_check_feature(dev, DRIVER_FB_DMA)
&& (dma->flags & _DRM_DMA_USE_FB))) { && (dma->flags & _DRM_DMA_USE_FB))) {
drm_map_t *map = dev->agp_buffer_map; struct drm_map *map = dev->agp_buffer_map;
unsigned long token = dev->agp_buffer_token; unsigned long token = dev->agp_buffer_token;
if (!map) { if (!map) {
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
* in drm_device::context_sareas, while holding the drm_device::struct_mutex * in drm_device::context_sareas, while holding the drm_device::struct_mutex
* lock. * lock.
*/ */
void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
{ {
if (ctx_handle < 0) if (ctx_handle < 0)
goto failed; goto failed;
...@@ -85,7 +85,7 @@ void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) ...@@ -85,7 +85,7 @@ void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle)
* drm_device::context_sareas to accommodate the new entry while holding the * drm_device::context_sareas to accommodate the new entry while holding the
* drm_device::struct_mutex lock. * drm_device::struct_mutex lock.
*/ */
static int drm_ctxbitmap_next(drm_device_t * dev) static int drm_ctxbitmap_next(struct drm_device * dev)
{ {
int bit; int bit;
...@@ -100,7 +100,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev) ...@@ -100,7 +100,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev)
if ((bit + 1) > dev->max_context) { if ((bit + 1) > dev->max_context) {
dev->max_context = (bit + 1); dev->max_context = (bit + 1);
if (dev->context_sareas) { if (dev->context_sareas) {
drm_map_t **ctx_sareas; struct drm_map **ctx_sareas;
ctx_sareas = drm_realloc(dev->context_sareas, ctx_sareas = drm_realloc(dev->context_sareas,
(dev->max_context - (dev->max_context -
...@@ -147,7 +147,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev) ...@@ -147,7 +147,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev)
* Allocates and initialize drm_device::ctx_bitmap and drm_device::context_sareas, while holding * Allocates and initialize drm_device::ctx_bitmap and drm_device::context_sareas, while holding
* the drm_device::struct_mutex lock. * the drm_device::struct_mutex lock.
*/ */
int drm_ctxbitmap_init(drm_device_t * dev) int drm_ctxbitmap_init(struct drm_device * dev)
{ {
int i; int i;
int temp; int temp;
...@@ -180,7 +180,7 @@ int drm_ctxbitmap_init(drm_device_t * dev) ...@@ -180,7 +180,7 @@ int drm_ctxbitmap_init(drm_device_t * dev)
* Frees drm_device::ctx_bitmap and drm_device::context_sareas, while holding * Frees drm_device::ctx_bitmap and drm_device::context_sareas, while holding
* the drm_device::struct_mutex lock. * the drm_device::struct_mutex lock.
*/ */
void drm_ctxbitmap_cleanup(drm_device_t * dev) void drm_ctxbitmap_cleanup(struct drm_device * dev)
{ {
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (dev->context_sareas) if (dev->context_sareas)
...@@ -212,12 +212,12 @@ void drm_ctxbitmap_cleanup(drm_device_t * dev) ...@@ -212,12 +212,12 @@ void drm_ctxbitmap_cleanup(drm_device_t * dev)
int drm_getsareactx(struct inode *inode, struct file *filp, int drm_getsareactx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_ctx_priv_map_t __user *argp = (void __user *)arg; struct drm_ctx_priv_map __user *argp = (void __user *)arg;
drm_ctx_priv_map_t request; struct drm_ctx_priv_map request;
drm_map_t *map; struct drm_map *map;
drm_map_list_t *_entry; struct drm_map_list *_entry;
if (copy_from_user(&request, argp, sizeof(request))) if (copy_from_user(&request, argp, sizeof(request)))
return -EFAULT; return -EFAULT;
...@@ -233,7 +233,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp, ...@@ -233,7 +233,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
request.handle = NULL; request.handle = NULL;
list_for_each_entry(_entry, &dev->maplist->head, head) { list_for_each_entry(_entry, &dev->maplist, head) {
if (_entry->map == map) { if (_entry->map == map) {
request.handle = request.handle =
(void *)(unsigned long)_entry->user_token; (void *)(unsigned long)_entry->user_token;
...@@ -263,20 +263,19 @@ int drm_getsareactx(struct inode *inode, struct file *filp, ...@@ -263,20 +263,19 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
int drm_setsareactx(struct inode *inode, struct file *filp, int drm_setsareactx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_ctx_priv_map_t request; struct drm_ctx_priv_map request;
drm_map_t *map = NULL; struct drm_map *map = NULL;
drm_map_list_t *r_list = NULL; struct drm_map_list *r_list = NULL;
struct list_head *list;
if (copy_from_user(&request, if (copy_from_user(&request,
(drm_ctx_priv_map_t __user *) arg, sizeof(request))) (struct drm_ctx_priv_map __user *) arg,
sizeof(request)))
return -EFAULT; return -EFAULT;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
list_for_each(list, &dev->maplist->head) { list_for_each_entry(r_list, &dev->maplist, head) {
r_list = list_entry(list, drm_map_list_t, head);
if (r_list->map if (r_list->map
&& r_list->user_token == (unsigned long)request.handle) && r_list->user_token == (unsigned long)request.handle)
goto found; goto found;
...@@ -314,7 +313,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp, ...@@ -314,7 +313,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp,
* *
* Attempt to set drm_device::context_flag. * Attempt to set drm_device::context_flag.
*/ */
static int drm_context_switch(drm_device_t * dev, int old, int new) static int drm_context_switch(struct drm_device * dev, int old, int new)
{ {
if (test_and_set_bit(0, &dev->context_flag)) { if (test_and_set_bit(0, &dev->context_flag)) {
DRM_ERROR("Reentering -- FIXME\n"); DRM_ERROR("Reentering -- FIXME\n");
...@@ -342,7 +341,7 @@ static int drm_context_switch(drm_device_t * dev, int old, int new) ...@@ -342,7 +341,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 * hardware lock is held, clears the drm_device::context_flag and wakes up
* drm_device::context_wait. * drm_device::context_wait.
*/ */
static int drm_context_switch_complete(drm_device_t * dev, int new) static int drm_context_switch_complete(struct drm_device * dev, int new)
{ {
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
dev->last_switch = jiffies; dev->last_switch = jiffies;
...@@ -372,9 +371,9 @@ static int drm_context_switch_complete(drm_device_t * dev, int new) ...@@ -372,9 +371,9 @@ static int drm_context_switch_complete(drm_device_t * dev, int new)
int drm_resctx(struct inode *inode, struct file *filp, int drm_resctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_ctx_res_t res; struct drm_ctx_res res;
drm_ctx_t __user *argp = (void __user *)arg; struct drm_ctx_res __user *argp = (void __user *)arg;
drm_ctx_t ctx; struct drm_ctx ctx;
int i; int i;
if (copy_from_user(&res, argp, sizeof(res))) if (copy_from_user(&res, argp, sizeof(res)))
...@@ -409,11 +408,11 @@ int drm_resctx(struct inode *inode, struct file *filp, ...@@ -409,11 +408,11 @@ int drm_resctx(struct inode *inode, struct file *filp,
int drm_addctx(struct inode *inode, struct file *filp, int drm_addctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_ctx_list_t *ctx_entry; struct drm_ctx_list *ctx_entry;
drm_ctx_t __user *argp = (void __user *)arg; struct drm_ctx __user *argp = (void __user *)arg;
drm_ctx_t ctx; struct drm_ctx ctx;
if (copy_from_user(&ctx, argp, sizeof(ctx))) if (copy_from_user(&ctx, argp, sizeof(ctx)))
return -EFAULT; return -EFAULT;
...@@ -449,7 +448,7 @@ int drm_addctx(struct inode *inode, struct file *filp, ...@@ -449,7 +448,7 @@ int drm_addctx(struct inode *inode, struct file *filp,
ctx_entry->tag = priv; ctx_entry->tag = priv;
mutex_lock(&dev->ctxlist_mutex); mutex_lock(&dev->ctxlist_mutex);
list_add(&ctx_entry->head, &dev->ctxlist->head); list_add(&ctx_entry->head, &dev->ctxlist);
++dev->ctx_count; ++dev->ctx_count;
mutex_unlock(&dev->ctxlist_mutex); mutex_unlock(&dev->ctxlist_mutex);
...@@ -477,8 +476,8 @@ int drm_modctx(struct inode *inode, struct file *filp, ...@@ -477,8 +476,8 @@ int drm_modctx(struct inode *inode, struct file *filp,
int drm_getctx(struct inode *inode, struct file *filp, int drm_getctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_ctx_t __user *argp = (void __user *)arg; struct drm_ctx __user *argp = (void __user *)arg;
drm_ctx_t ctx; struct drm_ctx ctx;
if (copy_from_user(&ctx, argp, sizeof(ctx))) if (copy_from_user(&ctx, argp, sizeof(ctx)))
return -EFAULT; return -EFAULT;
...@@ -505,11 +504,11 @@ int drm_getctx(struct inode *inode, struct file *filp, ...@@ -505,11 +504,11 @@ int drm_getctx(struct inode *inode, struct file *filp,
int drm_switchctx(struct inode *inode, struct file *filp, int drm_switchctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_ctx_t ctx; struct drm_ctx ctx;
if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
return -EFAULT; return -EFAULT;
DRM_DEBUG("%d\n", ctx.handle); DRM_DEBUG("%d\n", ctx.handle);
...@@ -530,11 +529,11 @@ int drm_switchctx(struct inode *inode, struct file *filp, ...@@ -530,11 +529,11 @@ int drm_switchctx(struct inode *inode, struct file *filp,
int drm_newctx(struct inode *inode, struct file *filp, int drm_newctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_ctx_t ctx; struct drm_ctx ctx;
if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
return -EFAULT; return -EFAULT;
DRM_DEBUG("%d\n", ctx.handle); DRM_DEBUG("%d\n", ctx.handle);
...@@ -557,11 +556,11 @@ int drm_newctx(struct inode *inode, struct file *filp, ...@@ -557,11 +556,11 @@ int drm_newctx(struct inode *inode, struct file *filp,
int drm_rmctx(struct inode *inode, struct file *filp, int drm_rmctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_ctx_t ctx; struct drm_ctx ctx;
if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
return -EFAULT; return -EFAULT;
DRM_DEBUG("%d\n", ctx.handle); DRM_DEBUG("%d\n", ctx.handle);
...@@ -575,10 +574,10 @@ int drm_rmctx(struct inode *inode, struct file *filp, ...@@ -575,10 +574,10 @@ int drm_rmctx(struct inode *inode, struct file *filp,
} }
mutex_lock(&dev->ctxlist_mutex); mutex_lock(&dev->ctxlist_mutex);
if (!list_empty(&dev->ctxlist->head)) { if (!list_empty(&dev->ctxlist)) {
drm_ctx_list_t *pos, *n; struct drm_ctx_list *pos, *n;
list_for_each_entry_safe(pos, n, &dev->ctxlist->head, head) { list_for_each_entry_safe(pos, n, &dev->ctxlist, head) {
if (pos->handle == ctx.handle) { if (pos->handle == ctx.handle) {
list_del(&pos->head); list_del(&pos->head);
drm_free(pos, sizeof(*pos), DRM_MEM_CTXLIST); drm_free(pos, sizeof(*pos), DRM_MEM_CTXLIST);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
* *
* Allocate and initialize a drm_device_dma structure. * Allocate and initialize a drm_device_dma structure.
*/ */
int drm_dma_setup(drm_device_t * dev) int drm_dma_setup(struct drm_device *dev)
{ {
int i; int i;
...@@ -67,9 +67,9 @@ int drm_dma_setup(drm_device_t * dev) ...@@ -67,9 +67,9 @@ int drm_dma_setup(drm_device_t * dev)
* Free all pages associated with DMA buffers, the buffers and pages lists, and * Free all pages associated with DMA buffers, the buffers and pages lists, and
* finally the drm_device::dma structure itself. * finally the drm_device::dma structure itself.
*/ */
void drm_dma_takedown(drm_device_t * dev) void drm_dma_takedown(struct drm_device *dev)
{ {
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
int i, j; int i, j;
if (!dma) if (!dma)
...@@ -129,7 +129,7 @@ void drm_dma_takedown(drm_device_t * dev) ...@@ -129,7 +129,7 @@ void drm_dma_takedown(drm_device_t * dev)
* *
* Resets the fields of \p buf. * Resets the fields of \p buf.
*/ */
void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf) void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
{ {
if (!buf) if (!buf)
return; return;
...@@ -152,9 +152,9 @@ void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf) ...@@ -152,9 +152,9 @@ void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf)
* *
* Frees each buffer associated with \p filp not already on the hardware. * Frees each buffer associated with \p filp not already on the hardware.
*/ */
void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp) void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp)
{ {
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
int i; int i;
if (!dma) if (!dma)
......
...@@ -47,9 +47,9 @@ int drm_adddraw(DRM_IOCTL_ARGS) ...@@ -47,9 +47,9 @@ int drm_adddraw(DRM_IOCTL_ARGS)
int i, j; int i, j;
u32 *bitfield = dev->drw_bitfield; u32 *bitfield = dev->drw_bitfield;
unsigned int bitfield_length = dev->drw_bitfield_length; unsigned int bitfield_length = dev->drw_bitfield_length;
drm_drawable_info_t **info = dev->drw_info; struct drm_drawable_info **info = dev->drw_info;
unsigned int info_length = dev->drw_info_length; unsigned int info_length = dev->drw_info_length;
drm_draw_t draw; struct drm_draw draw;
for (i = 0, j = 0; i < bitfield_length; i++) { for (i = 0, j = 0; i < bitfield_length; i++) {
if (bitfield[i] == ~0) if (bitfield[i] == ~0)
...@@ -120,7 +120,7 @@ int drm_adddraw(DRM_IOCTL_ARGS) ...@@ -120,7 +120,7 @@ int drm_adddraw(DRM_IOCTL_ARGS)
spin_unlock_irqrestore(&dev->drw_lock, irqflags); spin_unlock_irqrestore(&dev->drw_lock, irqflags);
DRM_COPY_TO_USER_IOCTL((drm_draw_t __user *)data, draw, sizeof(draw)); DRM_COPY_TO_USER_IOCTL((struct drm_draw __user *)data, draw, sizeof(draw));
return 0; return 0;
} }
...@@ -131,16 +131,16 @@ int drm_adddraw(DRM_IOCTL_ARGS) ...@@ -131,16 +131,16 @@ int drm_adddraw(DRM_IOCTL_ARGS)
int drm_rmdraw(DRM_IOCTL_ARGS) int drm_rmdraw(DRM_IOCTL_ARGS)
{ {
DRM_DEVICE; DRM_DEVICE;
drm_draw_t draw; struct drm_draw draw;
int id, idx; int id, idx;
unsigned int shift; unsigned int shift;
unsigned long irqflags; unsigned long irqflags;
u32 *bitfield = dev->drw_bitfield; u32 *bitfield = dev->drw_bitfield;
unsigned int bitfield_length = dev->drw_bitfield_length; unsigned int bitfield_length = dev->drw_bitfield_length;
drm_drawable_info_t **info = dev->drw_info; struct drm_drawable_info **info = dev->drw_info;
unsigned int info_length = dev->drw_info_length; unsigned int info_length = dev->drw_info_length;
DRM_COPY_FROM_USER_IOCTL(draw, (drm_draw_t __user *) data, DRM_COPY_FROM_USER_IOCTL(draw, (struct drm_draw __user *) data,
sizeof(draw)); sizeof(draw));
id = draw.handle - 1; id = draw.handle - 1;
...@@ -161,7 +161,7 @@ int drm_rmdraw(DRM_IOCTL_ARGS) ...@@ -161,7 +161,7 @@ int drm_rmdraw(DRM_IOCTL_ARGS)
if (info[id]) { if (info[id]) {
drm_free(info[id]->rects, info[id]->num_rects * drm_free(info[id]->rects, info[id]->num_rects *
sizeof(drm_clip_rect_t), DRM_MEM_BUFS); sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
drm_free(info[id], sizeof(**info), DRM_MEM_BUFS); drm_free(info[id], sizeof(**info), DRM_MEM_BUFS);
} }
...@@ -230,15 +230,15 @@ int drm_rmdraw(DRM_IOCTL_ARGS) ...@@ -230,15 +230,15 @@ int drm_rmdraw(DRM_IOCTL_ARGS)
int drm_update_drawable_info(DRM_IOCTL_ARGS) { int drm_update_drawable_info(DRM_IOCTL_ARGS) {
DRM_DEVICE; DRM_DEVICE;
drm_update_draw_t update; struct drm_update_draw update;
unsigned int id, idx, shift; unsigned int id, idx, shift;
u32 *bitfield = dev->drw_bitfield; u32 *bitfield = dev->drw_bitfield;
unsigned long irqflags, bitfield_length = dev->drw_bitfield_length; unsigned long irqflags, bitfield_length = dev->drw_bitfield_length;
drm_drawable_info_t *info; struct drm_drawable_info *info;
drm_clip_rect_t *rects; struct drm_clip_rect *rects;
int err; int err;
DRM_COPY_FROM_USER_IOCTL(update, (drm_update_draw_t __user *) data, DRM_COPY_FROM_USER_IOCTL(update, (struct drm_update_draw __user *) data,
sizeof(update)); sizeof(update));
id = update.handle - 1; id = update.handle - 1;
...@@ -254,7 +254,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) { ...@@ -254,7 +254,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
info = dev->drw_info[id]; info = dev->drw_info[id];
if (!info) { if (!info) {
info = drm_calloc(1, sizeof(drm_drawable_info_t), DRM_MEM_BUFS); info = drm_calloc(1, sizeof(struct drm_drawable_info), DRM_MEM_BUFS);
if (!info) { if (!info) {
DRM_ERROR("Failed to allocate drawable info memory\n"); DRM_ERROR("Failed to allocate drawable info memory\n");
...@@ -265,7 +265,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) { ...@@ -265,7 +265,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
switch (update.type) { switch (update.type) {
case DRM_DRAWABLE_CLIPRECTS: case DRM_DRAWABLE_CLIPRECTS:
if (update.num != info->num_rects) { if (update.num != info->num_rects) {
rects = drm_alloc(update.num * sizeof(drm_clip_rect_t), rects = drm_alloc(update.num * sizeof(struct drm_clip_rect),
DRM_MEM_BUFS); DRM_MEM_BUFS);
} else } else
rects = info->rects; rects = info->rects;
...@@ -277,7 +277,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) { ...@@ -277,7 +277,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
} }
if (update.num && DRM_COPY_FROM_USER(rects, if (update.num && DRM_COPY_FROM_USER(rects,
(drm_clip_rect_t __user *) (struct drm_clip_rect __user *)
(unsigned long)update.data, (unsigned long)update.data,
update.num * update.num *
sizeof(*rects))) { sizeof(*rects))) {
...@@ -290,7 +290,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) { ...@@ -290,7 +290,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
if (rects != info->rects) { if (rects != info->rects) {
drm_free(info->rects, info->num_rects * drm_free(info->rects, info->num_rects *
sizeof(drm_clip_rect_t), DRM_MEM_BUFS); sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
} }
info->rects = rects; info->rects = rects;
...@@ -314,7 +314,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) { ...@@ -314,7 +314,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
drm_free(info, sizeof(*info), DRM_MEM_BUFS); drm_free(info, sizeof(*info), DRM_MEM_BUFS);
else if (rects != dev->drw_info[id]->rects) else if (rects != dev->drw_info[id]->rects)
drm_free(rects, update.num * drm_free(rects, update.num *
sizeof(drm_clip_rect_t), DRM_MEM_BUFS); sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
return err; return err;
} }
...@@ -322,7 +322,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) { ...@@ -322,7 +322,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) {
/** /**
* Caller must hold the drawable spinlock! * Caller must hold the drawable spinlock!
*/ */
drm_drawable_info_t *drm_get_drawable_info(drm_device_t *dev, drm_drawable_t id) { struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev, drm_drawable_t id) {
u32 *bitfield = dev->drw_bitfield; u32 *bitfield = dev->drw_bitfield;
unsigned int idx, shift; unsigned int idx, shift;
......
...@@ -129,11 +129,11 @@ static drm_ioctl_desc_t drm_ioctls[] = { ...@@ -129,11 +129,11 @@ static drm_ioctl_desc_t drm_ioctls[] = {
* *
* \sa drm_device * \sa drm_device
*/ */
int drm_lastclose(drm_device_t * dev) int drm_lastclose(struct drm_device * dev)
{ {
drm_magic_entry_t *pt, *next; struct drm_magic_entry *pt, *next;
drm_map_list_t *r_list; struct drm_map_list *r_list, *list_t;
drm_vma_entry_t *vma, *vma_next; struct drm_vma_entry *vma, *vma_temp;
int i; int i;
DRM_DEBUG("\n"); DRM_DEBUG("\n");
...@@ -154,11 +154,11 @@ int drm_lastclose(drm_device_t * dev) ...@@ -154,11 +154,11 @@ int drm_lastclose(drm_device_t * dev)
/* Free drawable information memory */ /* Free drawable information memory */
for (i = 0; i < dev->drw_bitfield_length / sizeof(*dev->drw_bitfield); for (i = 0; i < dev->drw_bitfield_length / sizeof(*dev->drw_bitfield);
i++) { i++) {
drm_drawable_info_t *info = drm_get_drawable_info(dev, i); struct drm_drawable_info *info = drm_get_drawable_info(dev, i);
if (info) { if (info) {
drm_free(info->rects, info->num_rects * drm_free(info->rects, info->num_rects *
sizeof(drm_clip_rect_t), DRM_MEM_BUFS); sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
drm_free(info, sizeof(*info), DRM_MEM_BUFS); drm_free(info, sizeof(*info), DRM_MEM_BUFS);
} }
} }
...@@ -178,19 +178,17 @@ int drm_lastclose(drm_device_t * dev) ...@@ -178,19 +178,17 @@ int drm_lastclose(drm_device_t * dev)
/* Clear AGP information */ /* Clear AGP information */
if (drm_core_has_AGP(dev) && dev->agp) { if (drm_core_has_AGP(dev) && dev->agp) {
drm_agp_mem_t *entry; struct drm_agp_mem *entry, *tempe;
drm_agp_mem_t *nexte;
/* Remove AGP resources, but leave dev->agp /* Remove AGP resources, but leave dev->agp
intact until drv_cleanup is called. */ intact until drv_cleanup is called. */
for (entry = dev->agp->memory; entry; entry = nexte) { list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
nexte = entry->next;
if (entry->bound) if (entry->bound)
drm_unbind_agp(entry->memory); drm_unbind_agp(entry->memory);
drm_free_agp(entry->memory, entry->pages); drm_free_agp(entry->memory, entry->pages);
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
} }
dev->agp->memory = NULL; INIT_LIST_HEAD(&dev->agp->memory);
if (dev->agp->acquired) if (dev->agp->acquired)
drm_agp_release(dev); drm_agp_release(dev);
...@@ -204,20 +202,14 @@ int drm_lastclose(drm_device_t * dev) ...@@ -204,20 +202,14 @@ int drm_lastclose(drm_device_t * dev)
} }
/* Clear vma list (only built for debugging) */ /* Clear vma list (only built for debugging) */
if (dev->vmalist) { list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) {
for (vma = dev->vmalist; vma; vma = vma_next) { list_del(&vma->head);
vma_next = vma->next; drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
}
dev->vmalist = NULL;
} }
if (dev->maplist) { list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
while (!list_empty(&dev->maplist->head)) { drm_rmmap_locked(dev, r_list->map);
struct list_head *list = dev->maplist->head.next; r_list = NULL;
r_list = list_entry(list, drm_map_list_t, head);
drm_rmmap_locked(dev, r_list->map);
}
} }
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) { if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) {
...@@ -298,7 +290,7 @@ EXPORT_SYMBOL(drm_init); ...@@ -298,7 +290,7 @@ EXPORT_SYMBOL(drm_init);
* *
* \sa drm_init * \sa drm_init
*/ */
static void drm_cleanup(drm_device_t * dev) static void drm_cleanup(struct drm_device * dev)
{ {
DRM_DEBUG("\n"); DRM_DEBUG("\n");
...@@ -309,11 +301,7 @@ static void drm_cleanup(drm_device_t * dev) ...@@ -309,11 +301,7 @@ static void drm_cleanup(drm_device_t * dev)
drm_lastclose(dev); drm_lastclose(dev);
if (dev->maplist) { drm_ht_remove(&dev->map_hash);
drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
dev->maplist = NULL;
drm_ht_remove(&dev->map_hash);
}
drm_ctxbitmap_cleanup(dev); drm_ctxbitmap_cleanup(dev);
...@@ -342,8 +330,8 @@ static void drm_cleanup(drm_device_t * dev) ...@@ -342,8 +330,8 @@ static void drm_cleanup(drm_device_t * dev)
void drm_exit(struct drm_driver *driver) void drm_exit(struct drm_driver *driver)
{ {
int i; int i;
drm_device_t *dev = NULL; struct drm_device *dev = NULL;
drm_head_t *head; struct drm_head *head;
DRM_DEBUG("\n"); DRM_DEBUG("\n");
...@@ -442,10 +430,10 @@ module_exit(drm_core_exit); ...@@ -442,10 +430,10 @@ module_exit(drm_core_exit);
static int drm_version(struct inode *inode, struct file *filp, static int drm_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_version_t __user *argp = (void __user *)arg; struct drm_version __user *argp = (void __user *)arg;
drm_version_t version; struct drm_version version;
int len; int len;
if (copy_from_user(&version, argp, sizeof(version))) if (copy_from_user(&version, argp, sizeof(version)))
...@@ -478,8 +466,8 @@ static int drm_version(struct inode *inode, struct file *filp, ...@@ -478,8 +466,8 @@ static int drm_version(struct inode *inode, struct file *filp,
int drm_ioctl(struct inode *inode, struct file *filp, int drm_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_ioctl_desc_t *ioctl; drm_ioctl_desc_t *ioctl;
drm_ioctl_t *func; drm_ioctl_t *func;
unsigned int nr = DRM_IOCTL_NR(cmd); unsigned int nr = DRM_IOCTL_NR(cmd);
...@@ -529,3 +517,17 @@ int drm_ioctl(struct inode *inode, struct file *filp, ...@@ -529,3 +517,17 @@ int drm_ioctl(struct inode *inode, struct file *filp,
} }
EXPORT_SYMBOL(drm_ioctl); EXPORT_SYMBOL(drm_ioctl);
drm_local_map_t *drm_getsarea(struct drm_device *dev)
{
struct drm_map_list *entry;
list_for_each_entry(entry, &dev->maplist, head) {
if (entry->map && entry->map->type == _DRM_SHM &&
(entry->map->flags & _DRM_CONTAINS_LOCK)) {
return entry->map;
}
}
return NULL;
}
EXPORT_SYMBOL(drm_getsarea);
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
#include <linux/poll.h> #include <linux/poll.h>
static int drm_open_helper(struct inode *inode, struct file *filp, static int drm_open_helper(struct inode *inode, struct file *filp,
drm_device_t * dev); struct drm_device * dev);
static int drm_setup(drm_device_t * dev) static int drm_setup(struct drm_device * dev)
{ {
drm_local_map_t *map; drm_local_map_t *map;
int i; int i;
...@@ -79,13 +79,6 @@ static int drm_setup(drm_device_t * dev) ...@@ -79,13 +79,6 @@ static int drm_setup(drm_device_t * dev)
drm_ht_create(&dev->magiclist, DRM_MAGIC_HASH_ORDER); drm_ht_create(&dev->magiclist, DRM_MAGIC_HASH_ORDER);
INIT_LIST_HEAD(&dev->magicfree); INIT_LIST_HEAD(&dev->magicfree);
dev->ctxlist = drm_alloc(sizeof(*dev->ctxlist), DRM_MEM_CTXLIST);
if (dev->ctxlist == NULL)
return -ENOMEM;
memset(dev->ctxlist, 0, sizeof(*dev->ctxlist));
INIT_LIST_HEAD(&dev->ctxlist->head);
dev->vmalist = NULL;
dev->sigdata.lock = NULL; dev->sigdata.lock = NULL;
init_waitqueue_head(&dev->lock.lock_queue); init_waitqueue_head(&dev->lock.lock_queue);
dev->queue_count = 0; dev->queue_count = 0;
...@@ -135,7 +128,7 @@ static int drm_setup(drm_device_t * dev) ...@@ -135,7 +128,7 @@ static int drm_setup(drm_device_t * dev)
*/ */
int drm_open(struct inode *inode, struct file *filp) int drm_open(struct inode *inode, struct file *filp)
{ {
drm_device_t *dev = NULL; struct drm_device *dev = NULL;
int minor = iminor(inode); int minor = iminor(inode);
int retcode = 0; int retcode = 0;
...@@ -174,7 +167,7 @@ EXPORT_SYMBOL(drm_open); ...@@ -174,7 +167,7 @@ EXPORT_SYMBOL(drm_open);
*/ */
int drm_stub_open(struct inode *inode, struct file *filp) int drm_stub_open(struct inode *inode, struct file *filp)
{ {
drm_device_t *dev = NULL; struct drm_device *dev = NULL;
int minor = iminor(inode); int minor = iminor(inode);
int err = -ENODEV; int err = -ENODEV;
const struct file_operations *old_fops; const struct file_operations *old_fops;
...@@ -230,10 +223,10 @@ static int drm_cpu_valid(void) ...@@ -230,10 +223,10 @@ static int drm_cpu_valid(void)
* filp and add it into the double linked list in \p dev. * filp and add it into the double linked list in \p dev.
*/ */
static int drm_open_helper(struct inode *inode, struct file *filp, static int drm_open_helper(struct inode *inode, struct file *filp,
drm_device_t * dev) struct drm_device * dev)
{ {
int minor = iminor(inode); int minor = iminor(inode);
drm_file_t *priv; struct drm_file *priv;
int ret; int ret;
if (filp->f_flags & O_EXCL) if (filp->f_flags & O_EXCL)
...@@ -258,6 +251,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp, ...@@ -258,6 +251,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
priv->authenticated = capable(CAP_SYS_ADMIN); priv->authenticated = capable(CAP_SYS_ADMIN);
priv->lock_count = 0; priv->lock_count = 0;
INIT_LIST_HEAD(&priv->lhead);
if (dev->driver->open) { if (dev->driver->open) {
ret = dev->driver->open(dev, priv); ret = dev->driver->open(dev, priv);
if (ret < 0) if (ret < 0)
...@@ -265,19 +260,10 @@ static int drm_open_helper(struct inode *inode, struct file *filp, ...@@ -265,19 +260,10 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
} }
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (!dev->file_last) { if (list_empty(&dev->filelist))
priv->next = NULL;
priv->prev = NULL;
dev->file_first = priv;
dev->file_last = priv;
/* first opener automatically becomes master */
priv->master = 1; priv->master = 1;
} else {
priv->next = NULL; list_add(&priv->lhead, &dev->filelist);
priv->prev = dev->file_last;
dev->file_last->next = priv;
dev->file_last = priv;
}
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
#ifdef __alpha__ #ifdef __alpha__
...@@ -309,8 +295,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp, ...@@ -309,8 +295,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
/** No-op. */ /** No-op. */
int drm_fasync(int fd, struct file *filp, int on) int drm_fasync(int fd, struct file *filp, int on)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
int retcode; int retcode;
DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, DRM_DEBUG("fd = %d, device = 0x%lx\n", fd,
...@@ -336,8 +322,8 @@ EXPORT_SYMBOL(drm_fasync); ...@@ -336,8 +322,8 @@ EXPORT_SYMBOL(drm_fasync);
*/ */
int drm_release(struct inode *inode, struct file *filp) int drm_release(struct inode *inode, struct file *filp)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev; struct drm_device *dev;
int retcode = 0; int retcode = 0;
lock_kernel(); lock_kernel();
...@@ -414,10 +400,10 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -414,10 +400,10 @@ int drm_release(struct inode *inode, struct file *filp)
drm_fasync(-1, filp, 0); drm_fasync(-1, filp, 0);
mutex_lock(&dev->ctxlist_mutex); mutex_lock(&dev->ctxlist_mutex);
if (dev->ctxlist && (!list_empty(&dev->ctxlist->head))) { if (!list_empty(&dev->ctxlist)) {
drm_ctx_list_t *pos, *n; struct drm_ctx_list *pos, *n;
list_for_each_entry_safe(pos, n, &dev->ctxlist->head, head) { list_for_each_entry_safe(pos, n, &dev->ctxlist, head) {
if (pos->tag == priv && if (pos->tag == priv &&
pos->handle != DRM_KERNEL_CONTEXT) { pos->handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor) if (dev->driver->context_dtor)
...@@ -436,22 +422,12 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -436,22 +422,12 @@ int drm_release(struct inode *inode, struct file *filp)
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (priv->remove_auth_on_close == 1) { if (priv->remove_auth_on_close == 1) {
drm_file_t *temp = dev->file_first; struct drm_file *temp;
while (temp) {
list_for_each_entry(temp, &dev->filelist, lhead)
temp->authenticated = 0; temp->authenticated = 0;
temp = temp->next;
}
}
if (priv->prev) {
priv->prev->next = priv->next;
} else {
dev->file_first = priv->next;
}
if (priv->next) {
priv->next->prev = priv->prev;
} else {
dev->file_last = priv->prev;
} }
list_del(&priv->lhead);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (dev->driver->postclose) if (dev->driver->postclose)
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "drm_hashtab.h" #include "drm_hashtab.h"
#include <linux/hash.h> #include <linux/hash.h>
int drm_ht_create(drm_open_hash_t *ht, unsigned int order) int drm_ht_create(struct drm_open_hash *ht, unsigned int order)
{ {
unsigned int i; unsigned int i;
...@@ -63,9 +63,9 @@ int drm_ht_create(drm_open_hash_t *ht, unsigned int order) ...@@ -63,9 +63,9 @@ int drm_ht_create(drm_open_hash_t *ht, unsigned int order)
return 0; return 0;
} }
void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key) void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key)
{ {
drm_hash_item_t *entry; struct drm_hash_item *entry;
struct hlist_head *h_list; struct hlist_head *h_list;
struct hlist_node *list; struct hlist_node *list;
unsigned int hashed_key; unsigned int hashed_key;
...@@ -75,15 +75,15 @@ void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key) ...@@ -75,15 +75,15 @@ void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key)
DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key); DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
h_list = &ht->table[hashed_key]; h_list = &ht->table[hashed_key];
hlist_for_each(list, h_list) { hlist_for_each(list, h_list) {
entry = hlist_entry(list, drm_hash_item_t, head); entry = hlist_entry(list, struct drm_hash_item, head);
DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key); DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key);
} }
} }
static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht, static struct hlist_node *drm_ht_find_key(struct drm_open_hash *ht,
unsigned long key) unsigned long key)
{ {
drm_hash_item_t *entry; struct drm_hash_item *entry;
struct hlist_head *h_list; struct hlist_head *h_list;
struct hlist_node *list; struct hlist_node *list;
unsigned int hashed_key; unsigned int hashed_key;
...@@ -91,7 +91,7 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht, ...@@ -91,7 +91,7 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
hashed_key = hash_long(key, ht->order); hashed_key = hash_long(key, ht->order);
h_list = &ht->table[hashed_key]; h_list = &ht->table[hashed_key];
hlist_for_each(list, h_list) { hlist_for_each(list, h_list) {
entry = hlist_entry(list, drm_hash_item_t, head); entry = hlist_entry(list, struct drm_hash_item, head);
if (entry->key == key) if (entry->key == key)
return list; return list;
if (entry->key > key) if (entry->key > key)
...@@ -101,9 +101,9 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht, ...@@ -101,9 +101,9 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
} }
int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item) int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item)
{ {
drm_hash_item_t *entry; struct drm_hash_item *entry;
struct hlist_head *h_list; struct hlist_head *h_list;
struct hlist_node *list, *parent; struct hlist_node *list, *parent;
unsigned int hashed_key; unsigned int hashed_key;
...@@ -113,7 +113,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item) ...@@ -113,7 +113,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
h_list = &ht->table[hashed_key]; h_list = &ht->table[hashed_key];
parent = NULL; parent = NULL;
hlist_for_each(list, h_list) { hlist_for_each(list, h_list) {
entry = hlist_entry(list, drm_hash_item_t, head); entry = hlist_entry(list, struct drm_hash_item, head);
if (entry->key == key) if (entry->key == key)
return -EINVAL; return -EINVAL;
if (entry->key > key) if (entry->key > key)
...@@ -132,7 +132,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item) ...@@ -132,7 +132,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
* Just insert an item and return any "bits" bit key that hasn't been * Just insert an item and return any "bits" bit key that hasn't been
* used before. * used before.
*/ */
int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *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 seed, int bits, int shift,
unsigned long add) unsigned long add)
{ {
...@@ -156,8 +156,8 @@ int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item, ...@@ -156,8 +156,8 @@ int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item,
return 0; return 0;
} }
int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key,
drm_hash_item_t **item) struct drm_hash_item **item)
{ {
struct hlist_node *list; struct hlist_node *list;
...@@ -165,11 +165,11 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, ...@@ -165,11 +165,11 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key,
if (!list) if (!list)
return -EINVAL; return -EINVAL;
*item = hlist_entry(list, drm_hash_item_t, head); *item = hlist_entry(list, struct drm_hash_item, head);
return 0; return 0;
} }
int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key) int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key)
{ {
struct hlist_node *list; struct hlist_node *list;
...@@ -182,14 +182,14 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key) ...@@ -182,14 +182,14 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key)
return -EINVAL; return -EINVAL;
} }
int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item) int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item)
{ {
hlist_del_init(&item->head); hlist_del_init(&item->head);
ht->fill--; ht->fill--;
return 0; return 0;
} }
void drm_ht_remove(drm_open_hash_t *ht) void drm_ht_remove(struct drm_open_hash *ht)
{ {
if (ht->table) { if (ht->table) {
if (ht->use_vmalloc) if (ht->use_vmalloc)
......
...@@ -37,31 +37,31 @@ ...@@ -37,31 +37,31 @@
#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member) #define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
typedef struct drm_hash_item{ struct drm_hash_item {
struct hlist_node head; struct hlist_node head;
unsigned long key; unsigned long key;
} drm_hash_item_t; };
typedef struct drm_open_hash{ struct drm_open_hash {
unsigned int size; unsigned int size;
unsigned int order; unsigned int order;
unsigned int fill; unsigned int fill;
struct hlist_head *table; struct hlist_head *table;
int use_vmalloc; int use_vmalloc;
} drm_open_hash_t; };
extern int drm_ht_create(drm_open_hash_t *ht, unsigned int order); extern int drm_ht_create(struct drm_open_hash *ht, unsigned int order);
extern int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item); extern int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item);
extern int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item, extern 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 seed, int bits, int shift,
unsigned long add); unsigned long add);
extern int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key, drm_hash_item_t **item); extern int drm_ht_find_item(struct drm_open_hash *ht, unsigned long key, struct drm_hash_item **item);
extern void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key); extern void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key);
extern int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key); extern int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key);
extern int drm_ht_remove_item(drm_open_hash_t *ht, drm_hash_item_t *item); extern int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item);
extern void drm_ht_remove(drm_open_hash_t *ht); extern void drm_ht_remove(struct drm_open_hash *ht);
#endif #endif
......
...@@ -82,7 +82,7 @@ static int compat_drm_version(struct file *file, unsigned int cmd, ...@@ -82,7 +82,7 @@ static int compat_drm_version(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_version32_t v32; drm_version32_t v32;
drm_version_t __user *version; struct drm_version __user *version;
int err; int err;
if (copy_from_user(&v32, (void __user *)arg, sizeof(v32))) if (copy_from_user(&v32, (void __user *)arg, sizeof(v32)))
...@@ -129,7 +129,7 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd, ...@@ -129,7 +129,7 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_unique32_t uq32; drm_unique32_t uq32;
drm_unique_t __user *u; struct drm_unique __user *u;
int err; int err;
if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32))) if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32)))
...@@ -159,7 +159,7 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd, ...@@ -159,7 +159,7 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_unique32_t uq32; drm_unique32_t uq32;
drm_unique_t __user *u; struct drm_unique __user *u;
if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32))) if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32)))
return -EFAULT; return -EFAULT;
...@@ -179,8 +179,8 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd, ...@@ -179,8 +179,8 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd,
typedef struct drm_map32 { typedef struct drm_map32 {
u32 offset; /**< Requested physical address (0 for SAREA)*/ u32 offset; /**< Requested physical address (0 for SAREA)*/
u32 size; /**< Requested physical size (bytes) */ u32 size; /**< Requested physical size (bytes) */
drm_map_type_t type; /**< Type of memory to map */ enum drm_map_type type; /**< Type of memory to map */
drm_map_flags_t flags; /**< Flags */ enum drm_map_flags flags; /**< Flags */
u32 handle; /**< User-space: "Handle" to pass to mmap() */ u32 handle; /**< User-space: "Handle" to pass to mmap() */
int mtrr; /**< MTRR slot used */ int mtrr; /**< MTRR slot used */
} drm_map32_t; } drm_map32_t;
...@@ -190,7 +190,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd, ...@@ -190,7 +190,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
{ {
drm_map32_t __user *argp = (void __user *)arg; drm_map32_t __user *argp = (void __user *)arg;
drm_map32_t m32; drm_map32_t m32;
drm_map_t __user *map; struct drm_map __user *map;
int idx, err; int idx, err;
void *handle; void *handle;
...@@ -228,7 +228,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd, ...@@ -228,7 +228,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
{ {
drm_map32_t __user *argp = (void __user *)arg; drm_map32_t __user *argp = (void __user *)arg;
drm_map32_t m32; drm_map32_t m32;
drm_map_t __user *map; struct drm_map __user *map;
int err; int err;
void *handle; void *handle;
...@@ -270,7 +270,7 @@ static int compat_drm_rmmap(struct file *file, unsigned int cmd, ...@@ -270,7 +270,7 @@ static int compat_drm_rmmap(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_map32_t __user *argp = (void __user *)arg; drm_map32_t __user *argp = (void __user *)arg;
drm_map_t __user *map; struct drm_map __user *map;
u32 handle; u32 handle;
if (get_user(handle, &argp->handle)) if (get_user(handle, &argp->handle))
...@@ -300,7 +300,7 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd, ...@@ -300,7 +300,7 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd,
{ {
drm_client32_t c32; drm_client32_t c32;
drm_client32_t __user *argp = (void __user *)arg; drm_client32_t __user *argp = (void __user *)arg;
drm_client_t __user *client; struct drm_client __user *client;
int idx, err; int idx, err;
if (get_user(idx, &argp->idx)) if (get_user(idx, &argp->idx))
...@@ -333,7 +333,7 @@ typedef struct drm_stats32 { ...@@ -333,7 +333,7 @@ typedef struct drm_stats32 {
u32 count; u32 count;
struct { struct {
u32 value; u32 value;
drm_stat_type_t type; enum drm_stat_type type;
} data[15]; } data[15];
} drm_stats32_t; } drm_stats32_t;
...@@ -342,7 +342,7 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd, ...@@ -342,7 +342,7 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd,
{ {
drm_stats32_t s32; drm_stats32_t s32;
drm_stats32_t __user *argp = (void __user *)arg; drm_stats32_t __user *argp = (void __user *)arg;
drm_stats_t __user *stats; struct drm_stats __user *stats;
int i, err; int i, err;
stats = compat_alloc_user_space(sizeof(*stats)); stats = compat_alloc_user_space(sizeof(*stats));
...@@ -379,7 +379,7 @@ static int compat_drm_addbufs(struct file *file, unsigned int cmd, ...@@ -379,7 +379,7 @@ static int compat_drm_addbufs(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_buf_desc32_t __user *argp = (void __user *)arg; drm_buf_desc32_t __user *argp = (void __user *)arg;
drm_buf_desc_t __user *buf; struct drm_buf_desc __user *buf;
int err; int err;
unsigned long agp_start; unsigned long agp_start;
...@@ -411,7 +411,7 @@ static int compat_drm_markbufs(struct file *file, unsigned int cmd, ...@@ -411,7 +411,7 @@ static int compat_drm_markbufs(struct file *file, unsigned int cmd,
{ {
drm_buf_desc32_t b32; drm_buf_desc32_t b32;
drm_buf_desc32_t __user *argp = (void __user *)arg; drm_buf_desc32_t __user *argp = (void __user *)arg;
drm_buf_desc_t __user *buf; struct drm_buf_desc __user *buf;
if (copy_from_user(&b32, argp, sizeof(b32))) if (copy_from_user(&b32, argp, sizeof(b32)))
return -EFAULT; return -EFAULT;
...@@ -440,8 +440,8 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd, ...@@ -440,8 +440,8 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
drm_buf_info32_t req32; drm_buf_info32_t req32;
drm_buf_info32_t __user *argp = (void __user *)arg; drm_buf_info32_t __user *argp = (void __user *)arg;
drm_buf_desc32_t __user *to; drm_buf_desc32_t __user *to;
drm_buf_info_t __user *request; struct drm_buf_info __user *request;
drm_buf_desc_t __user *list; struct drm_buf_desc __user *list;
size_t nbytes; size_t nbytes;
int i, err; int i, err;
int count, actual; int count, actual;
...@@ -457,11 +457,11 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd, ...@@ -457,11 +457,11 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
&& !access_ok(VERIFY_WRITE, to, count * sizeof(drm_buf_desc32_t))) && !access_ok(VERIFY_WRITE, to, count * sizeof(drm_buf_desc32_t)))
return -EFAULT; return -EFAULT;
nbytes = sizeof(*request) + count * sizeof(drm_buf_desc_t); nbytes = sizeof(*request) + count * sizeof(struct drm_buf_desc);
request = compat_alloc_user_space(nbytes); request = compat_alloc_user_space(nbytes);
if (!access_ok(VERIFY_WRITE, request, nbytes)) if (!access_ok(VERIFY_WRITE, request, nbytes))
return -EFAULT; return -EFAULT;
list = (drm_buf_desc_t *) (request + 1); list = (struct drm_buf_desc *) (request + 1);
if (__put_user(count, &request->count) if (__put_user(count, &request->count)
|| __put_user(list, &request->list)) || __put_user(list, &request->list))
...@@ -477,7 +477,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd, ...@@ -477,7 +477,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
if (count >= actual) if (count >= actual)
for (i = 0; i < actual; ++i) for (i = 0; i < actual; ++i)
if (__copy_in_user(&to[i], &list[i], if (__copy_in_user(&to[i], &list[i],
offsetof(drm_buf_desc_t, flags))) offsetof(struct drm_buf_desc, flags)))
return -EFAULT; return -EFAULT;
if (__put_user(actual, &argp->count)) if (__put_user(actual, &argp->count))
...@@ -505,8 +505,8 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd, ...@@ -505,8 +505,8 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
drm_buf_map32_t __user *argp = (void __user *)arg; drm_buf_map32_t __user *argp = (void __user *)arg;
drm_buf_map32_t req32; drm_buf_map32_t req32;
drm_buf_pub32_t __user *list32; drm_buf_pub32_t __user *list32;
drm_buf_map_t __user *request; struct drm_buf_map __user *request;
drm_buf_pub_t __user *list; struct drm_buf_pub __user *list;
int i, err; int i, err;
int count, actual; int count, actual;
size_t nbytes; size_t nbytes;
...@@ -519,11 +519,11 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd, ...@@ -519,11 +519,11 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
if (count < 0) if (count < 0)
return -EINVAL; return -EINVAL;
nbytes = sizeof(*request) + count * sizeof(drm_buf_pub_t); nbytes = sizeof(*request) + count * sizeof(struct drm_buf_pub);
request = compat_alloc_user_space(nbytes); request = compat_alloc_user_space(nbytes);
if (!access_ok(VERIFY_WRITE, request, nbytes)) if (!access_ok(VERIFY_WRITE, request, nbytes))
return -EFAULT; return -EFAULT;
list = (drm_buf_pub_t *) (request + 1); list = (struct drm_buf_pub *) (request + 1);
if (__put_user(count, &request->count) if (__put_user(count, &request->count)
|| __put_user(list, &request->list)) || __put_user(list, &request->list))
...@@ -539,7 +539,7 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd, ...@@ -539,7 +539,7 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
if (count >= actual) if (count >= actual)
for (i = 0; i < actual; ++i) for (i = 0; i < actual; ++i)
if (__copy_in_user(&list32[i], &list[i], if (__copy_in_user(&list32[i], &list[i],
offsetof(drm_buf_pub_t, address)) offsetof(struct drm_buf_pub, address))
|| __get_user(addr, &list[i].address) || __get_user(addr, &list[i].address)
|| __put_user((unsigned long)addr, || __put_user((unsigned long)addr,
&list32[i].address)) &list32[i].address))
...@@ -562,7 +562,7 @@ static int compat_drm_freebufs(struct file *file, unsigned int cmd, ...@@ -562,7 +562,7 @@ static int compat_drm_freebufs(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_buf_free32_t req32; drm_buf_free32_t req32;
drm_buf_free_t __user *request; struct drm_buf_free __user *request;
drm_buf_free32_t __user *argp = (void __user *)arg; drm_buf_free32_t __user *argp = (void __user *)arg;
if (copy_from_user(&req32, argp, sizeof(req32))) if (copy_from_user(&req32, argp, sizeof(req32)))
...@@ -589,7 +589,7 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd, ...@@ -589,7 +589,7 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_ctx_priv_map32_t req32; drm_ctx_priv_map32_t req32;
drm_ctx_priv_map_t __user *request; struct drm_ctx_priv_map __user *request;
drm_ctx_priv_map32_t __user *argp = (void __user *)arg; drm_ctx_priv_map32_t __user *argp = (void __user *)arg;
if (copy_from_user(&req32, argp, sizeof(req32))) if (copy_from_user(&req32, argp, sizeof(req32)))
...@@ -610,7 +610,7 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd, ...@@ -610,7 +610,7 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
static int compat_drm_getsareactx(struct file *file, unsigned int cmd, static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_ctx_priv_map_t __user *request; struct drm_ctx_priv_map __user *request;
drm_ctx_priv_map32_t __user *argp = (void __user *)arg; drm_ctx_priv_map32_t __user *argp = (void __user *)arg;
int err; int err;
unsigned int ctx_id; unsigned int ctx_id;
...@@ -648,7 +648,7 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd, ...@@ -648,7 +648,7 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd,
{ {
drm_ctx_res32_t __user *argp = (void __user *)arg; drm_ctx_res32_t __user *argp = (void __user *)arg;
drm_ctx_res32_t res32; drm_ctx_res32_t res32;
drm_ctx_res_t __user *res; struct drm_ctx_res __user *res;
int err; int err;
if (copy_from_user(&res32, argp, sizeof(res32))) if (copy_from_user(&res32, argp, sizeof(res32)))
...@@ -658,7 +658,7 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd, ...@@ -658,7 +658,7 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd,
if (!access_ok(VERIFY_WRITE, res, sizeof(*res))) if (!access_ok(VERIFY_WRITE, res, sizeof(*res)))
return -EFAULT; return -EFAULT;
if (__put_user(res32.count, &res->count) if (__put_user(res32.count, &res->count)
|| __put_user((drm_ctx_t __user *) (unsigned long)res32.contexts, || __put_user((struct drm_ctx __user *) (unsigned long)res32.contexts,
&res->contexts)) &res->contexts))
return -EFAULT; return -EFAULT;
...@@ -679,7 +679,7 @@ typedef struct drm_dma32 { ...@@ -679,7 +679,7 @@ typedef struct drm_dma32 {
int send_count; /**< Number of buffers to send */ int send_count; /**< Number of buffers to send */
u32 send_indices; /**< List of handles to buffers */ u32 send_indices; /**< List of handles to buffers */
u32 send_sizes; /**< Lengths of data to send */ u32 send_sizes; /**< Lengths of data to send */
drm_dma_flags_t flags; /**< Flags */ enum drm_dma_flags flags; /**< Flags */
int request_count; /**< Number of buffers requested */ int request_count; /**< Number of buffers requested */
int request_size; /**< Desired size for buffers */ int request_size; /**< Desired size for buffers */
u32 request_indices; /**< Buffer information */ u32 request_indices; /**< Buffer information */
...@@ -692,7 +692,7 @@ static int compat_drm_dma(struct file *file, unsigned int cmd, ...@@ -692,7 +692,7 @@ static int compat_drm_dma(struct file *file, unsigned int cmd,
{ {
drm_dma32_t d32; drm_dma32_t d32;
drm_dma32_t __user *argp = (void __user *)arg; drm_dma32_t __user *argp = (void __user *)arg;
drm_dma_t __user *d; struct drm_dma __user *d;
int err; int err;
if (copy_from_user(&d32, argp, sizeof(d32))) if (copy_from_user(&d32, argp, sizeof(d32)))
...@@ -740,7 +740,7 @@ static int compat_drm_agp_enable(struct file *file, unsigned int cmd, ...@@ -740,7 +740,7 @@ static int compat_drm_agp_enable(struct file *file, unsigned int cmd,
{ {
drm_agp_mode32_t __user *argp = (void __user *)arg; drm_agp_mode32_t __user *argp = (void __user *)arg;
drm_agp_mode32_t m32; drm_agp_mode32_t m32;
drm_agp_mode_t __user *mode; struct drm_agp_mode __user *mode;
if (get_user(m32.mode, &argp->mode)) if (get_user(m32.mode, &argp->mode))
return -EFAULT; return -EFAULT;
...@@ -772,7 +772,7 @@ static int compat_drm_agp_info(struct file *file, unsigned int cmd, ...@@ -772,7 +772,7 @@ static int compat_drm_agp_info(struct file *file, unsigned int cmd,
{ {
drm_agp_info32_t __user *argp = (void __user *)arg; drm_agp_info32_t __user *argp = (void __user *)arg;
drm_agp_info32_t i32; drm_agp_info32_t i32;
drm_agp_info_t __user *info; struct drm_agp_info __user *info;
int err; int err;
info = compat_alloc_user_space(sizeof(*info)); info = compat_alloc_user_space(sizeof(*info));
...@@ -813,7 +813,7 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd, ...@@ -813,7 +813,7 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
{ {
drm_agp_buffer32_t __user *argp = (void __user *)arg; drm_agp_buffer32_t __user *argp = (void __user *)arg;
drm_agp_buffer32_t req32; drm_agp_buffer32_t req32;
drm_agp_buffer_t __user *request; struct drm_agp_buffer __user *request;
int err; int err;
if (copy_from_user(&req32, argp, sizeof(req32))) if (copy_from_user(&req32, argp, sizeof(req32)))
...@@ -845,7 +845,7 @@ static int compat_drm_agp_free(struct file *file, unsigned int cmd, ...@@ -845,7 +845,7 @@ static int compat_drm_agp_free(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_agp_buffer32_t __user *argp = (void __user *)arg; drm_agp_buffer32_t __user *argp = (void __user *)arg;
drm_agp_buffer_t __user *request; struct drm_agp_buffer __user *request;
u32 handle; u32 handle;
request = compat_alloc_user_space(sizeof(*request)); request = compat_alloc_user_space(sizeof(*request));
...@@ -868,7 +868,7 @@ static int compat_drm_agp_bind(struct file *file, unsigned int cmd, ...@@ -868,7 +868,7 @@ static int compat_drm_agp_bind(struct file *file, unsigned int cmd,
{ {
drm_agp_binding32_t __user *argp = (void __user *)arg; drm_agp_binding32_t __user *argp = (void __user *)arg;
drm_agp_binding32_t req32; drm_agp_binding32_t req32;
drm_agp_binding_t __user *request; struct drm_agp_binding __user *request;
if (copy_from_user(&req32, argp, sizeof(req32))) if (copy_from_user(&req32, argp, sizeof(req32)))
return -EFAULT; return -EFAULT;
...@@ -887,7 +887,7 @@ static int compat_drm_agp_unbind(struct file *file, unsigned int cmd, ...@@ -887,7 +887,7 @@ static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_agp_binding32_t __user *argp = (void __user *)arg; drm_agp_binding32_t __user *argp = (void __user *)arg;
drm_agp_binding_t __user *request; struct drm_agp_binding __user *request;
u32 handle; u32 handle;
request = compat_alloc_user_space(sizeof(*request)); request = compat_alloc_user_space(sizeof(*request));
...@@ -910,7 +910,7 @@ static int compat_drm_sg_alloc(struct file *file, unsigned int cmd, ...@@ -910,7 +910,7 @@ static int compat_drm_sg_alloc(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_scatter_gather32_t __user *argp = (void __user *)arg; drm_scatter_gather32_t __user *argp = (void __user *)arg;
drm_scatter_gather_t __user *request; struct drm_scatter_gather __user *request;
int err; int err;
unsigned long x; unsigned long x;
...@@ -938,7 +938,7 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd, ...@@ -938,7 +938,7 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_scatter_gather32_t __user *argp = (void __user *)arg; drm_scatter_gather32_t __user *argp = (void __user *)arg;
drm_scatter_gather_t __user *request; struct drm_scatter_gather __user *request;
unsigned long x; unsigned long x;
request = compat_alloc_user_space(sizeof(*request)); request = compat_alloc_user_space(sizeof(*request));
...@@ -953,13 +953,13 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd, ...@@ -953,13 +953,13 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd,
} }
struct drm_wait_vblank_request32 { struct drm_wait_vblank_request32 {
drm_vblank_seq_type_t type; enum drm_vblank_seq_type type;
unsigned int sequence; unsigned int sequence;
u32 signal; u32 signal;
}; };
struct drm_wait_vblank_reply32 { struct drm_wait_vblank_reply32 {
drm_vblank_seq_type_t type; enum drm_vblank_seq_type type;
unsigned int sequence; unsigned int sequence;
s32 tval_sec; s32 tval_sec;
s32 tval_usec; s32 tval_usec;
...@@ -975,7 +975,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, ...@@ -975,7 +975,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
{ {
drm_wait_vblank32_t __user *argp = (void __user *)arg; drm_wait_vblank32_t __user *argp = (void __user *)arg;
drm_wait_vblank32_t req32; drm_wait_vblank32_t req32;
drm_wait_vblank_t __user *request; union drm_wait_vblank __user *request;
int err; int err;
if (copy_from_user(&req32, argp, sizeof(req32))) if (copy_from_user(&req32, argp, sizeof(req32)))
......
...@@ -52,10 +52,10 @@ ...@@ -52,10 +52,10 @@
int drm_getunique(struct inode *inode, struct file *filp, int drm_getunique(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_unique_t __user *argp = (void __user *)arg; struct drm_unique __user *argp = (void __user *)arg;
drm_unique_t u; struct drm_unique u;
if (copy_from_user(&u, argp, sizeof(u))) if (copy_from_user(&u, argp, sizeof(u)))
return -EFAULT; return -EFAULT;
...@@ -86,15 +86,15 @@ int drm_getunique(struct inode *inode, struct file *filp, ...@@ -86,15 +86,15 @@ int drm_getunique(struct inode *inode, struct file *filp,
int drm_setunique(struct inode *inode, struct file *filp, int drm_setunique(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_unique_t u; struct drm_unique u;
int domain, bus, slot, func, ret; int domain, bus, slot, func, ret;
if (dev->unique_len || dev->unique) if (dev->unique_len || dev->unique)
return -EBUSY; return -EBUSY;
if (copy_from_user(&u, (drm_unique_t __user *) arg, sizeof(u))) if (copy_from_user(&u, (struct drm_unique __user *) arg, sizeof(u)))
return -EFAULT; return -EFAULT;
if (!u.unique_len || u.unique_len > 1024) if (!u.unique_len || u.unique_len > 1024)
...@@ -136,7 +136,7 @@ int drm_setunique(struct inode *inode, struct file *filp, ...@@ -136,7 +136,7 @@ int drm_setunique(struct inode *inode, struct file *filp,
return 0; return 0;
} }
static int drm_set_busid(drm_device_t * dev) static int drm_set_busid(struct drm_device * dev)
{ {
int len; int len;
...@@ -184,11 +184,11 @@ static int drm_set_busid(drm_device_t * dev) ...@@ -184,11 +184,11 @@ static int drm_set_busid(drm_device_t * dev)
int drm_getmap(struct inode *inode, struct file *filp, int drm_getmap(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_map_t __user *argp = (void __user *)arg; struct drm_map __user *argp = (void __user *)arg;
drm_map_t map; struct drm_map map;
drm_map_list_t *r_list = NULL; struct drm_map_list *r_list = NULL;
struct list_head *list; struct list_head *list;
int idx; int idx;
int i; int i;
...@@ -204,9 +204,9 @@ int drm_getmap(struct inode *inode, struct file *filp, ...@@ -204,9 +204,9 @@ int drm_getmap(struct inode *inode, struct file *filp,
} }
i = 0; i = 0;
list_for_each(list, &dev->maplist->head) { list_for_each(list, &dev->maplist) {
if (i == idx) { if (i == idx) {
r_list = list_entry(list, drm_map_list_t, head); r_list = list_entry(list, struct drm_map_list, head);
break; break;
} }
i++; i++;
...@@ -245,11 +245,11 @@ int drm_getmap(struct inode *inode, struct file *filp, ...@@ -245,11 +245,11 @@ int drm_getmap(struct inode *inode, struct file *filp,
int drm_getclient(struct inode *inode, struct file *filp, int drm_getclient(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_client_t __user *argp = (drm_client_t __user *)arg; struct drm_client __user *argp = (struct drm_client __user *)arg;
drm_client_t client; struct drm_client client;
drm_file_t *pt; struct drm_file *pt;
int idx; int idx;
int i; int i;
...@@ -257,12 +257,18 @@ int drm_getclient(struct inode *inode, struct file *filp, ...@@ -257,12 +257,18 @@ int drm_getclient(struct inode *inode, struct file *filp,
return -EFAULT; return -EFAULT;
idx = client.idx; idx = client.idx;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) ;
if (list_empty(&dev->filelist)) {
if (!pt) {
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return -EINVAL; return -EINVAL;
} }
i = 0;
list_for_each_entry(pt, &dev->filelist, lhead) {
if (i++ >= idx)
break;
}
client.auth = pt->authenticated; client.auth = pt->authenticated;
client.pid = pt->pid; client.pid = pt->pid;
client.uid = pt->uid; client.uid = pt->uid;
...@@ -288,9 +294,9 @@ int drm_getclient(struct inode *inode, struct file *filp, ...@@ -288,9 +294,9 @@ int drm_getclient(struct inode *inode, struct file *filp,
int drm_getstats(struct inode *inode, struct file *filp, int drm_getstats(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_stats_t stats; struct drm_stats stats;
int i; int i;
memset(&stats, 0, sizeof(stats)); memset(&stats, 0, sizeof(stats));
...@@ -310,7 +316,7 @@ int drm_getstats(struct inode *inode, struct file *filp, ...@@ -310,7 +316,7 @@ int drm_getstats(struct inode *inode, struct file *filp,
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (copy_to_user((drm_stats_t __user *) arg, &stats, sizeof(stats))) if (copy_to_user((struct drm_stats __user *) arg, &stats, sizeof(stats)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -329,10 +335,10 @@ int drm_getstats(struct inode *inode, struct file *filp, ...@@ -329,10 +335,10 @@ int drm_getstats(struct inode *inode, struct file *filp,
int drm_setversion(DRM_IOCTL_ARGS) int drm_setversion(DRM_IOCTL_ARGS)
{ {
DRM_DEVICE; DRM_DEVICE;
drm_set_version_t sv; struct drm_set_version sv;
drm_set_version_t retv; struct drm_set_version retv;
int if_version; int if_version;
drm_set_version_t __user *argp = (void __user *)data; struct drm_set_version __user *argp = (void __user *)data;
int ret; int ret;
if (copy_from_user(&sv, argp, sizeof(sv))) if (copy_from_user(&sv, argp, sizeof(sv)))
......
...@@ -53,10 +53,10 @@ ...@@ -53,10 +53,10 @@
int drm_irq_by_busid(struct inode *inode, struct file *filp, int drm_irq_by_busid(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_irq_busid_t __user *argp = (void __user *)arg; struct drm_irq_busid __user *argp = (void __user *)arg;
drm_irq_busid_t p; struct drm_irq_busid p;
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL; return -EINVAL;
...@@ -87,7 +87,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp, ...@@ -87,7 +87,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
* \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions * \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions
* before and after the installation. * before and after the installation.
*/ */
static int drm_irq_install(drm_device_t * dev) static int drm_irq_install(struct drm_device * dev)
{ {
int ret; int ret;
unsigned long sh_flags = 0; unsigned long sh_flags = 0;
...@@ -120,8 +120,8 @@ static int drm_irq_install(drm_device_t * dev) ...@@ -120,8 +120,8 @@ static int drm_irq_install(drm_device_t * dev)
spin_lock_init(&dev->vbl_lock); spin_lock_init(&dev->vbl_lock);
INIT_LIST_HEAD(&dev->vbl_sigs.head); INIT_LIST_HEAD(&dev->vbl_sigs);
INIT_LIST_HEAD(&dev->vbl_sigs2.head); INIT_LIST_HEAD(&dev->vbl_sigs2);
dev->vbl_pending = 0; dev->vbl_pending = 0;
} }
...@@ -155,7 +155,7 @@ static int drm_irq_install(drm_device_t * dev) ...@@ -155,7 +155,7 @@ static int drm_irq_install(drm_device_t * dev)
* *
* Calls the driver's \c drm_driver_irq_uninstall() function, and stops the irq. * Calls the driver's \c drm_driver_irq_uninstall() function, and stops the irq.
*/ */
int drm_irq_uninstall(drm_device_t * dev) int drm_irq_uninstall(struct drm_device * dev)
{ {
int irq_enabled; int irq_enabled;
...@@ -197,13 +197,13 @@ EXPORT_SYMBOL(drm_irq_uninstall); ...@@ -197,13 +197,13 @@ EXPORT_SYMBOL(drm_irq_uninstall);
int drm_control(struct inode *inode, struct file *filp, int drm_control(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_control_t ctl; struct drm_control ctl;
/* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */ /* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */
if (copy_from_user(&ctl, (drm_control_t __user *) arg, sizeof(ctl))) if (copy_from_user(&ctl, (struct drm_control __user *) arg, sizeof(ctl)))
return -EFAULT; return -EFAULT;
switch (ctl.func) { switch (ctl.func) {
...@@ -244,10 +244,10 @@ int drm_control(struct inode *inode, struct file *filp, ...@@ -244,10 +244,10 @@ int drm_control(struct inode *inode, struct file *filp,
*/ */
int drm_wait_vblank(DRM_IOCTL_ARGS) int drm_wait_vblank(DRM_IOCTL_ARGS)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_wait_vblank_t __user *argp = (void __user *)data; union drm_wait_vblank __user *argp = (void __user *)data;
drm_wait_vblank_t vblwait; union drm_wait_vblank vblwait;
struct timeval now; struct timeval now;
int ret = 0; int ret = 0;
unsigned int flags, seq; unsigned int flags, seq;
...@@ -292,9 +292,9 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -292,9 +292,9 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
if (flags & _DRM_VBLANK_SIGNAL) { if (flags & _DRM_VBLANK_SIGNAL) {
unsigned long irqflags; unsigned long irqflags;
drm_vbl_sig_t *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY) struct list_head *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY)
? &dev->vbl_sigs2 : &dev->vbl_sigs; ? &dev->vbl_sigs2 : &dev->vbl_sigs;
drm_vbl_sig_t *vbl_sig; struct drm_vbl_sig *vbl_sig;
spin_lock_irqsave(&dev->vbl_lock, irqflags); spin_lock_irqsave(&dev->vbl_lock, irqflags);
...@@ -302,7 +302,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -302,7 +302,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
* for the same vblank sequence number; nothing to be done in * for the same vblank sequence number; nothing to be done in
* that case * that case
*/ */
list_for_each_entry(vbl_sig, &vbl_sigs->head, head) { list_for_each_entry(vbl_sig, vbl_sigs, head) {
if (vbl_sig->sequence == vblwait.request.sequence if (vbl_sig->sequence == vblwait.request.sequence
&& vbl_sig->info.si_signo == vblwait.request.signal && vbl_sig->info.si_signo == vblwait.request.signal
&& vbl_sig->task == current) { && vbl_sig->task == current) {
...@@ -324,7 +324,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -324,7 +324,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
if (! if (!
(vbl_sig = (vbl_sig =
drm_alloc(sizeof(drm_vbl_sig_t), DRM_MEM_DRIVER))) { drm_alloc(sizeof(struct drm_vbl_sig), DRM_MEM_DRIVER))) {
return -ENOMEM; return -ENOMEM;
} }
...@@ -336,7 +336,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -336,7 +336,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
spin_lock_irqsave(&dev->vbl_lock, irqflags); spin_lock_irqsave(&dev->vbl_lock, irqflags);
list_add_tail((struct list_head *)vbl_sig, &vbl_sigs->head); list_add_tail(&vbl_sig->head, vbl_sigs);
spin_unlock_irqrestore(&dev->vbl_lock, irqflags); spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
...@@ -371,7 +371,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -371,7 +371,7 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
* *
* If a signal is not requested, then calls vblank_wait(). * If a signal is not requested, then calls vblank_wait().
*/ */
void drm_vbl_send_signals(drm_device_t * dev) void drm_vbl_send_signals(struct drm_device * dev)
{ {
unsigned long flags; unsigned long flags;
int i; int i;
...@@ -379,20 +379,18 @@ void drm_vbl_send_signals(drm_device_t * dev) ...@@ -379,20 +379,18 @@ void drm_vbl_send_signals(drm_device_t * dev)
spin_lock_irqsave(&dev->vbl_lock, flags); spin_lock_irqsave(&dev->vbl_lock, flags);
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
struct list_head *list, *tmp; struct drm_vbl_sig *vbl_sig, *tmp;
drm_vbl_sig_t *vbl_sig; struct list_head *vbl_sigs = i ? &dev->vbl_sigs2 : &dev->vbl_sigs;
drm_vbl_sig_t *vbl_sigs = i ? &dev->vbl_sigs2 : &dev->vbl_sigs;
unsigned int vbl_seq = atomic_read(i ? &dev->vbl_received2 : unsigned int vbl_seq = atomic_read(i ? &dev->vbl_received2 :
&dev->vbl_received); &dev->vbl_received);
list_for_each_safe(list, tmp, &vbl_sigs->head) { list_for_each_entry_safe(vbl_sig, tmp, vbl_sigs, head) {
vbl_sig = list_entry(list, drm_vbl_sig_t, head);
if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) {
vbl_sig->info.si_code = vbl_seq; vbl_sig->info.si_code = vbl_seq;
send_sig_info(vbl_sig->info.si_signo, send_sig_info(vbl_sig->info.si_signo,
&vbl_sig->info, vbl_sig->task); &vbl_sig->info, vbl_sig->task);
list_del(list); list_del(&vbl_sig->head);
drm_free(vbl_sig, sizeof(*vbl_sig), drm_free(vbl_sig, sizeof(*vbl_sig),
DRM_MEM_DRIVER); DRM_MEM_DRIVER);
...@@ -418,7 +416,7 @@ EXPORT_SYMBOL(drm_vbl_send_signals); ...@@ -418,7 +416,7 @@ EXPORT_SYMBOL(drm_vbl_send_signals);
*/ */
static void drm_locked_tasklet_func(unsigned long data) static void drm_locked_tasklet_func(unsigned long data)
{ {
drm_device_t *dev = (drm_device_t*)data; struct drm_device *dev = (struct drm_device *)data;
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&dev->tasklet_lock, irqflags); spin_lock_irqsave(&dev->tasklet_lock, irqflags);
...@@ -455,7 +453,7 @@ static void drm_locked_tasklet_func(unsigned long data) ...@@ -455,7 +453,7 @@ static void drm_locked_tasklet_func(unsigned long data)
* context, it must not make any assumptions about this. Also, the HW lock will * context, it must not make any assumptions about this. Also, the HW lock will
* be held with the kernel context or any client context. * be held with the kernel context or any client context.
*/ */
void drm_locked_tasklet(drm_device_t *dev, void (*func)(drm_device_t*)) void drm_locked_tasklet(struct drm_device *dev, void (*func)(struct drm_device *))
{ {
unsigned long irqflags; unsigned long irqflags;
static DECLARE_TASKLET(drm_tasklet, drm_locked_tasklet_func, 0); static DECLARE_TASKLET(drm_tasklet, drm_locked_tasklet_func, 0);
......
...@@ -51,15 +51,15 @@ static int drm_notifier(void *priv); ...@@ -51,15 +51,15 @@ static int drm_notifier(void *priv);
int drm_lock(struct inode *inode, struct file *filp, int drm_lock(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
DECLARE_WAITQUEUE(entry, current); DECLARE_WAITQUEUE(entry, current);
drm_lock_t lock; struct drm_lock lock;
int ret = 0; int ret = 0;
++priv->lock_count; ++priv->lock_count;
if (copy_from_user(&lock, (drm_lock_t __user *) arg, sizeof(lock))) if (copy_from_user(&lock, (struct drm_lock __user *) arg, sizeof(lock)))
return -EFAULT; return -EFAULT;
if (lock.context == DRM_KERNEL_CONTEXT) { if (lock.context == DRM_KERNEL_CONTEXT) {
...@@ -152,12 +152,12 @@ int drm_lock(struct inode *inode, struct file *filp, ...@@ -152,12 +152,12 @@ int drm_lock(struct inode *inode, struct file *filp,
int drm_unlock(struct inode *inode, struct file *filp, int drm_unlock(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_lock_t lock; struct drm_lock lock;
unsigned long irqflags; unsigned long irqflags;
if (copy_from_user(&lock, (drm_lock_t __user *) arg, sizeof(lock))) if (copy_from_user(&lock, (struct drm_lock __user *) arg, sizeof(lock)))
return -EFAULT; return -EFAULT;
if (lock.context == DRM_KERNEL_CONTEXT) { if (lock.context == DRM_KERNEL_CONTEXT) {
...@@ -202,7 +202,7 @@ int drm_unlock(struct inode *inode, struct file *filp, ...@@ -202,7 +202,7 @@ int drm_unlock(struct inode *inode, struct file *filp,
* *
* Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction. * Attempt to mark the lock as held by the given context, via the \p cmpxchg instruction.
*/ */
int drm_lock_take(drm_lock_data_t *lock_data, int drm_lock_take(struct drm_lock_data *lock_data,
unsigned int context) unsigned int context)
{ {
unsigned int old, new, prev; unsigned int old, new, prev;
...@@ -251,7 +251,7 @@ int drm_lock_take(drm_lock_data_t *lock_data, ...@@ -251,7 +251,7 @@ int drm_lock_take(drm_lock_data_t *lock_data,
* Resets the lock file pointer. * Resets the lock file pointer.
* Marks the lock as held by the given context, via the \p cmpxchg instruction. * Marks the lock as held by the given context, via the \p cmpxchg instruction.
*/ */
static int drm_lock_transfer(drm_lock_data_t *lock_data, static int drm_lock_transfer(struct drm_lock_data *lock_data,
unsigned int context) unsigned int context)
{ {
unsigned int old, new, prev; unsigned int old, new, prev;
...@@ -277,7 +277,7 @@ static int drm_lock_transfer(drm_lock_data_t *lock_data, ...@@ -277,7 +277,7 @@ static int drm_lock_transfer(drm_lock_data_t *lock_data,
* Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task
* waiting on the lock queue. * waiting on the lock queue.
*/ */
int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context) int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context)
{ {
unsigned int old, new, prev; unsigned int old, new, prev;
volatile unsigned int *lock = &lock_data->hw_lock->lock; volatile unsigned int *lock = &lock_data->hw_lock->lock;
...@@ -319,7 +319,7 @@ int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context) ...@@ -319,7 +319,7 @@ int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context)
*/ */
static int drm_notifier(void *priv) static int drm_notifier(void *priv)
{ {
drm_sigdata_t *s = (drm_sigdata_t *) priv; struct drm_sigdata *s = (struct drm_sigdata *) priv;
unsigned int old, new, prev; unsigned int old, new, prev;
/* Allow signal delivery if lock isn't held */ /* Allow signal delivery if lock isn't held */
...@@ -350,7 +350,7 @@ static int drm_notifier(void *priv) ...@@ -350,7 +350,7 @@ static int drm_notifier(void *priv)
* having to worry about starvation. * having to worry about starvation.
*/ */
void drm_idlelock_take(drm_lock_data_t *lock_data) void drm_idlelock_take(struct drm_lock_data *lock_data)
{ {
int ret = 0; int ret = 0;
...@@ -369,7 +369,7 @@ void drm_idlelock_take(drm_lock_data_t *lock_data) ...@@ -369,7 +369,7 @@ void drm_idlelock_take(drm_lock_data_t *lock_data)
} }
EXPORT_SYMBOL(drm_idlelock_take); EXPORT_SYMBOL(drm_idlelock_take);
void drm_idlelock_release(drm_lock_data_t *lock_data) void drm_idlelock_release(struct drm_lock_data *lock_data)
{ {
unsigned int old, prev; unsigned int old, prev;
volatile unsigned int *lock = &lock_data->hw_lock->lock; volatile unsigned int *lock = &lock_data->hw_lock->lock;
......
...@@ -80,7 +80,7 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area) ...@@ -80,7 +80,7 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
#if __OS_HAS_AGP #if __OS_HAS_AGP
static void *agp_remap(unsigned long offset, unsigned long size, static void *agp_remap(unsigned long offset, unsigned long size,
drm_device_t * dev) struct drm_device * dev)
{ {
unsigned long *phys_addr_map, i, num_pages = unsigned long *phys_addr_map, i, num_pages =
PAGE_ALIGN(size) / PAGE_SIZE; PAGE_ALIGN(size) / PAGE_SIZE;
...@@ -94,7 +94,7 @@ static void *agp_remap(unsigned long offset, unsigned long size, ...@@ -94,7 +94,7 @@ static void *agp_remap(unsigned long offset, unsigned long size,
offset -= dev->hose->mem_space->start; offset -= dev->hose->mem_space->start;
#endif #endif
for (agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) list_for_each_entry(agpmem, &dev->agp->memory, head)
if (agpmem->bound <= offset if (agpmem->bound <= offset
&& (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >= && (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >=
(offset + size)) (offset + size))
...@@ -123,7 +123,7 @@ static void *agp_remap(unsigned long offset, unsigned long size, ...@@ -123,7 +123,7 @@ static void *agp_remap(unsigned long offset, unsigned long size,
} }
/** Wrapper around agp_allocate_memory() */ /** Wrapper around agp_allocate_memory() */
DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type) DRM_AGP_MEM *drm_alloc_agp(struct drm_device * dev, int pages, u32 type)
{ {
return drm_agp_allocate_memory(dev->agp->bridge, pages, type); return drm_agp_allocate_memory(dev->agp->bridge, pages, type);
} }
...@@ -148,7 +148,7 @@ int drm_unbind_agp(DRM_AGP_MEM * handle) ...@@ -148,7 +148,7 @@ int drm_unbind_agp(DRM_AGP_MEM * handle)
#else /* __OS_HAS_AGP */ #else /* __OS_HAS_AGP */
static inline void *agp_remap(unsigned long offset, unsigned long size, static inline void *agp_remap(unsigned long offset, unsigned long size,
drm_device_t * dev) struct drm_device * dev)
{ {
return NULL; return NULL;
} }
......
...@@ -44,26 +44,26 @@ ...@@ -44,26 +44,26 @@
#include "drmP.h" #include "drmP.h"
#include <linux/slab.h> #include <linux/slab.h>
unsigned long drm_mm_tail_space(drm_mm_t *mm) unsigned long drm_mm_tail_space(struct drm_mm *mm)
{ {
struct list_head *tail_node; struct list_head *tail_node;
drm_mm_node_t *entry; struct drm_mm_node *entry;
tail_node = mm->ml_entry.prev; tail_node = mm->ml_entry.prev;
entry = list_entry(tail_node, drm_mm_node_t, ml_entry); entry = list_entry(tail_node, struct drm_mm_node, ml_entry);
if (!entry->free) if (!entry->free)
return 0; return 0;
return entry->size; return entry->size;
} }
int drm_mm_remove_space_from_tail(drm_mm_t *mm, unsigned long size) int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size)
{ {
struct list_head *tail_node; struct list_head *tail_node;
drm_mm_node_t *entry; struct drm_mm_node *entry;
tail_node = mm->ml_entry.prev; tail_node = mm->ml_entry.prev;
entry = list_entry(tail_node, drm_mm_node_t, ml_entry); entry = list_entry(tail_node, struct drm_mm_node, ml_entry);
if (!entry->free) if (!entry->free)
return -ENOMEM; return -ENOMEM;
...@@ -75,13 +75,13 @@ int drm_mm_remove_space_from_tail(drm_mm_t *mm, unsigned long size) ...@@ -75,13 +75,13 @@ int drm_mm_remove_space_from_tail(drm_mm_t *mm, unsigned long size)
} }
static int drm_mm_create_tail_node(drm_mm_t *mm, static int drm_mm_create_tail_node(struct drm_mm *mm,
unsigned long start, unsigned long start,
unsigned long size) unsigned long size)
{ {
drm_mm_node_t *child; struct drm_mm_node *child;
child = (drm_mm_node_t *) child = (struct drm_mm_node *)
drm_alloc(sizeof(*child), DRM_MEM_MM); drm_alloc(sizeof(*child), DRM_MEM_MM);
if (!child) if (!child)
return -ENOMEM; return -ENOMEM;
...@@ -98,13 +98,13 @@ static int drm_mm_create_tail_node(drm_mm_t *mm, ...@@ -98,13 +98,13 @@ static int drm_mm_create_tail_node(drm_mm_t *mm,
} }
int drm_mm_add_space_to_tail(drm_mm_t *mm, unsigned long size) int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size)
{ {
struct list_head *tail_node; struct list_head *tail_node;
drm_mm_node_t *entry; struct drm_mm_node *entry;
tail_node = mm->ml_entry.prev; tail_node = mm->ml_entry.prev;
entry = list_entry(tail_node, drm_mm_node_t, ml_entry); entry = list_entry(tail_node, struct drm_mm_node, ml_entry);
if (!entry->free) { if (!entry->free) {
return drm_mm_create_tail_node(mm, entry->start + entry->size, size); return drm_mm_create_tail_node(mm, entry->start + entry->size, size);
} }
...@@ -112,12 +112,12 @@ int drm_mm_add_space_to_tail(drm_mm_t *mm, unsigned long size) ...@@ -112,12 +112,12 @@ int drm_mm_add_space_to_tail(drm_mm_t *mm, unsigned long size)
return 0; return 0;
} }
static drm_mm_node_t *drm_mm_split_at_start(drm_mm_node_t *parent, static struct drm_mm_node *drm_mm_split_at_start(struct drm_mm_node *parent,
unsigned long size) unsigned long size)
{ {
drm_mm_node_t *child; struct drm_mm_node *child;
child = (drm_mm_node_t *) child = (struct drm_mm_node *)
drm_alloc(sizeof(*child), DRM_MEM_MM); drm_alloc(sizeof(*child), DRM_MEM_MM);
if (!child) if (!child)
return NULL; return NULL;
...@@ -139,12 +139,12 @@ static drm_mm_node_t *drm_mm_split_at_start(drm_mm_node_t *parent, ...@@ -139,12 +139,12 @@ static drm_mm_node_t *drm_mm_split_at_start(drm_mm_node_t *parent,
drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent, struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent,
unsigned long size, unsigned alignment) unsigned long size, unsigned alignment)
{ {
drm_mm_node_t *align_splitoff = NULL; struct drm_mm_node *align_splitoff = NULL;
drm_mm_node_t *child; struct drm_mm_node *child;
unsigned tmp = 0; unsigned tmp = 0;
if (alignment) if (alignment)
...@@ -175,26 +175,26 @@ drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent, ...@@ -175,26 +175,26 @@ drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent,
* Otherwise add to the free stack. * Otherwise add to the free stack.
*/ */
void drm_mm_put_block(drm_mm_node_t * cur) void drm_mm_put_block(struct drm_mm_node * cur)
{ {
drm_mm_t *mm = cur->mm; struct drm_mm *mm = cur->mm;
struct list_head *cur_head = &cur->ml_entry; struct list_head *cur_head = &cur->ml_entry;
struct list_head *root_head = &mm->ml_entry; struct list_head *root_head = &mm->ml_entry;
drm_mm_node_t *prev_node = NULL; struct drm_mm_node *prev_node = NULL;
drm_mm_node_t *next_node; struct drm_mm_node *next_node;
int merged = 0; int merged = 0;
if (cur_head->prev != root_head) { if (cur_head->prev != root_head) {
prev_node = list_entry(cur_head->prev, drm_mm_node_t, ml_entry); prev_node = list_entry(cur_head->prev, struct drm_mm_node, ml_entry);
if (prev_node->free) { if (prev_node->free) {
prev_node->size += cur->size; prev_node->size += cur->size;
merged = 1; merged = 1;
} }
} }
if (cur_head->next != root_head) { if (cur_head->next != root_head) {
next_node = list_entry(cur_head->next, drm_mm_node_t, ml_entry); next_node = list_entry(cur_head->next, struct drm_mm_node, ml_entry);
if (next_node->free) { if (next_node->free) {
if (merged) { if (merged) {
prev_node->size += next_node->size; prev_node->size += next_node->size;
...@@ -218,14 +218,14 @@ void drm_mm_put_block(drm_mm_node_t * cur) ...@@ -218,14 +218,14 @@ void drm_mm_put_block(drm_mm_node_t * cur)
} }
} }
drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm, struct drm_mm_node *drm_mm_search_free(const struct drm_mm * mm,
unsigned long size, unsigned long size,
unsigned alignment, int best_match) unsigned alignment, int best_match)
{ {
struct list_head *list; struct list_head *list;
const struct list_head *free_stack = &mm->fl_entry; const struct list_head *free_stack = &mm->fl_entry;
drm_mm_node_t *entry; struct drm_mm_node *entry;
drm_mm_node_t *best; struct drm_mm_node *best;
unsigned long best_size; unsigned long best_size;
unsigned wasted; unsigned wasted;
...@@ -233,7 +233,7 @@ drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm, ...@@ -233,7 +233,7 @@ drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm,
best_size = ~0UL; best_size = ~0UL;
list_for_each(list, free_stack) { list_for_each(list, free_stack) {
entry = list_entry(list, drm_mm_node_t, fl_entry); entry = list_entry(list, struct drm_mm_node, fl_entry);
wasted = 0; wasted = 0;
if (entry->size < size) if (entry->size < size)
...@@ -259,14 +259,14 @@ drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm, ...@@ -259,14 +259,14 @@ drm_mm_node_t *drm_mm_search_free(const drm_mm_t * mm,
return best; return best;
} }
int drm_mm_clean(drm_mm_t * mm) int drm_mm_clean(struct drm_mm * mm)
{ {
struct list_head *head = &mm->ml_entry; struct list_head *head = &mm->ml_entry;
return (head->next->next == head); return (head->next->next == head);
} }
int drm_mm_init(drm_mm_t * mm, unsigned long start, unsigned long size) int drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size)
{ {
INIT_LIST_HEAD(&mm->ml_entry); INIT_LIST_HEAD(&mm->ml_entry);
INIT_LIST_HEAD(&mm->fl_entry); INIT_LIST_HEAD(&mm->fl_entry);
...@@ -275,12 +275,12 @@ int drm_mm_init(drm_mm_t * mm, unsigned long start, unsigned long size) ...@@ -275,12 +275,12 @@ int drm_mm_init(drm_mm_t * mm, unsigned long start, unsigned long size)
} }
void drm_mm_takedown(drm_mm_t * mm) void drm_mm_takedown(struct drm_mm * mm)
{ {
struct list_head *bnode = mm->fl_entry.next; struct list_head *bnode = mm->fl_entry.next;
drm_mm_node_t *entry; struct drm_mm_node *entry;
entry = list_entry(bnode, drm_mm_node_t, fl_entry); entry = list_entry(bnode, struct drm_mm_node, fl_entry);
if (entry->ml_entry.next != &mm->ml_entry || if (entry->ml_entry.next != &mm->ml_entry ||
entry->fl_entry.next != &mm->fl_entry) { entry->fl_entry.next != &mm->fl_entry) {
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
/** Read/write memory barrier */ /** Read/write memory barrier */
#define DRM_MEMORYBARRIER() mb() #define DRM_MEMORYBARRIER() mb()
/** DRM device local declaration */ /** DRM device local declaration */
#define DRM_DEVICE drm_file_t *priv = filp->private_data; \ #define DRM_DEVICE struct drm_file *priv = filp->private_data; \
drm_device_t *dev = priv->head->dev struct drm_device *dev = priv->head->dev
/** IRQ handler arguments and return type and values */ /** IRQ handler arguments and return type and values */
#define DRM_IRQ_ARGS int irq, void *arg #define DRM_IRQ_ARGS int irq, void *arg
...@@ -96,24 +96,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size) ...@@ -96,24 +96,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data #define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data
/**
* Get the pointer to the SAREA.
*
* Searches the SAREA on the mapping lists and points drm_device::sarea to it.
*/
#define DRM_GETSAREA() \
do { \
drm_map_list_t *entry; \
list_for_each_entry( entry, &dev->maplist->head, head ) { \
if ( entry->map && \
entry->map->type == _DRM_SHM && \
(entry->map->flags & _DRM_CONTAINS_LOCK) ) { \
dev_priv->sarea = entry->map; \
break; \
} \
} \
} while (0)
#define DRM_HZ HZ #define DRM_HZ HZ
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \ #define DRM_WAIT_ON( ret, queue, timeout, condition ) \
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
/** /**
* \brief Allocate a PCI consistent memory block, for DMA. * \brief Allocate a PCI consistent memory block, for DMA.
*/ */
drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align, drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align,
dma_addr_t maxaddr) dma_addr_t maxaddr)
{ {
drm_dma_handle_t *dmah; drm_dma_handle_t *dmah;
...@@ -126,7 +126,7 @@ EXPORT_SYMBOL(drm_pci_alloc); ...@@ -126,7 +126,7 @@ EXPORT_SYMBOL(drm_pci_alloc);
* *
* This function is for internal use in the Linux-specific DRM core code. * 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(struct drm_device * dev, drm_dma_handle_t * dmah)
{ {
#if 1 #if 1
unsigned long addr; unsigned long addr;
...@@ -172,7 +172,7 @@ void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah) ...@@ -172,7 +172,7 @@ void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah)
/** /**
* \brief Free a PCI consistent memory block * \brief Free a PCI consistent memory block
*/ */
void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah) void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
{ {
__drm_pci_free(dev, dmah); __drm_pci_free(dev, dmah);
kfree(dmah); kfree(dmah);
......
...@@ -87,7 +87,7 @@ static struct drm_proc_list { ...@@ -87,7 +87,7 @@ static struct drm_proc_list {
* "/proc/dri/%minor%/", and each entry in proc_list as * "/proc/dri/%minor%/", and each entry in proc_list as
* "/proc/dri/%minor%/%name%". * "/proc/dri/%minor%/%name%".
*/ */
int drm_proc_init(drm_device_t * dev, int minor, int drm_proc_init(struct drm_device * dev, int minor,
struct proc_dir_entry *root, struct proc_dir_entry **dev_root) struct proc_dir_entry *root, struct proc_dir_entry **dev_root)
{ {
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
...@@ -163,7 +163,7 @@ int drm_proc_cleanup(int minor, struct proc_dir_entry *root, ...@@ -163,7 +163,7 @@ int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
static int drm_name_info(char *buf, char **start, off_t offset, int request, static int drm_name_info(char *buf, char **start, off_t offset, int request,
int *eof, void *data) int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int len = 0; int len = 0;
if (offset > DRM_PROC_LIMIT) { if (offset > DRM_PROC_LIMIT) {
...@@ -205,11 +205,10 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request, ...@@ -205,11 +205,10 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request,
static int drm__vm_info(char *buf, char **start, off_t offset, int request, static int drm__vm_info(char *buf, char **start, off_t offset, int request,
int *eof, void *data) int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int len = 0; int len = 0;
drm_map_t *map; struct drm_map *map;
drm_map_list_t *r_list; struct drm_map_list *r_list;
struct list_head *list;
/* Hardcoded from _DRM_FRAME_BUFFER, /* Hardcoded from _DRM_FRAME_BUFFER,
_DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and
...@@ -229,9 +228,7 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request, ...@@ -229,9 +228,7 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
DRM_PROC_PRINT("slot offset size type flags " DRM_PROC_PRINT("slot offset size type flags "
"address mtrr\n\n"); "address mtrr\n\n");
i = 0; i = 0;
if (dev->maplist != NULL) list_for_each_entry(r_list, &dev->maplist, head) {
list_for_each(list, &dev->maplist->head) {
r_list = list_entry(list, drm_map_list_t, head);
map = r_list->map; map = r_list->map;
if (!map) if (!map)
continue; continue;
...@@ -242,14 +239,15 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request, ...@@ -242,14 +239,15 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08x ", DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08x ",
i, i,
map->offset, map->offset,
map->size, type, map->flags, r_list->user_token); map->size, type, map->flags,
r_list->user_token);
if (map->mtrr < 0) { if (map->mtrr < 0) {
DRM_PROC_PRINT("none\n"); DRM_PROC_PRINT("none\n");
} else { } else {
DRM_PROC_PRINT("%4d\n", map->mtrr); DRM_PROC_PRINT("%4d\n", map->mtrr);
} }
i++; i++;
} }
if (len > request + offset) if (len > request + offset)
return request; return request;
...@@ -263,7 +261,7 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request, ...@@ -263,7 +261,7 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
static int drm_vm_info(char *buf, char **start, off_t offset, int request, static int drm_vm_info(char *buf, char **start, off_t offset, int request,
int *eof, void *data) int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int ret; int ret;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
...@@ -286,10 +284,10 @@ static int drm_vm_info(char *buf, char **start, off_t offset, int request, ...@@ -286,10 +284,10 @@ static int drm_vm_info(char *buf, char **start, off_t offset, int request,
static int drm__queues_info(char *buf, char **start, off_t offset, static int drm__queues_info(char *buf, char **start, off_t offset,
int request, int *eof, void *data) int request, int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int len = 0; int len = 0;
int i; int i;
drm_queue_t *q; struct drm_queue *q;
if (offset > DRM_PROC_LIMIT) { if (offset > DRM_PROC_LIMIT) {
*eof = 1; *eof = 1;
...@@ -336,7 +334,7 @@ static int drm__queues_info(char *buf, char **start, off_t offset, ...@@ -336,7 +334,7 @@ static int drm__queues_info(char *buf, char **start, off_t offset,
static int drm_queues_info(char *buf, char **start, off_t offset, int request, static int drm_queues_info(char *buf, char **start, off_t offset, int request,
int *eof, void *data) int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int ret; int ret;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
...@@ -359,9 +357,9 @@ static int drm_queues_info(char *buf, char **start, off_t offset, int request, ...@@ -359,9 +357,9 @@ static int drm_queues_info(char *buf, char **start, off_t offset, int request,
static int drm__bufs_info(char *buf, char **start, off_t offset, int request, static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
int *eof, void *data) int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int len = 0; int len = 0;
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
int i; int i;
if (!dma || offset > DRM_PROC_LIMIT) { if (!dma || offset > DRM_PROC_LIMIT) {
...@@ -408,7 +406,7 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request, ...@@ -408,7 +406,7 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
static int drm_bufs_info(char *buf, char **start, off_t offset, int request, static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
int *eof, void *data) int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int ret; int ret;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
...@@ -431,9 +429,9 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request, ...@@ -431,9 +429,9 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
static int drm__clients_info(char *buf, char **start, off_t offset, static int drm__clients_info(char *buf, char **start, off_t offset,
int request, int *eof, void *data) int request, int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int len = 0; int len = 0;
drm_file_t *priv; struct drm_file *priv;
if (offset > DRM_PROC_LIMIT) { if (offset > DRM_PROC_LIMIT) {
*eof = 1; *eof = 1;
...@@ -444,7 +442,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset, ...@@ -444,7 +442,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
*eof = 0; *eof = 0;
DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n"); DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n");
for (priv = dev->file_first; priv; priv = priv->next) { list_for_each_entry(priv, &dev->filelist, lhead) {
DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n", DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n",
priv->authenticated ? 'y' : 'n', priv->authenticated ? 'y' : 'n',
priv->minor, priv->minor,
...@@ -464,7 +462,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset, ...@@ -464,7 +462,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
static int drm_clients_info(char *buf, char **start, off_t offset, static int drm_clients_info(char *buf, char **start, off_t offset,
int request, int *eof, void *data) int request, int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int ret; int ret;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
...@@ -478,9 +476,9 @@ static int drm_clients_info(char *buf, char **start, off_t offset, ...@@ -478,9 +476,9 @@ static int drm_clients_info(char *buf, char **start, off_t offset,
static int drm__vma_info(char *buf, char **start, off_t offset, int request, static int drm__vma_info(char *buf, char **start, off_t offset, int request,
int *eof, void *data) int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int len = 0; int len = 0;
drm_vma_entry_t *pt; struct drm_vma_entry *pt;
struct vm_area_struct *vma; struct vm_area_struct *vma;
#if defined(__i386__) #if defined(__i386__)
unsigned int pgprot; unsigned int pgprot;
...@@ -497,7 +495,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request, ...@@ -497,7 +495,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n", DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n",
atomic_read(&dev->vma_count), atomic_read(&dev->vma_count),
high_memory, virt_to_phys(high_memory)); high_memory, virt_to_phys(high_memory));
for (pt = dev->vmalist; pt; pt = pt->next) { list_for_each_entry(pt, &dev->vmalist, head) {
if (!(vma = pt->vma)) if (!(vma = pt->vma))
continue; continue;
DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx000", DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx000",
...@@ -537,7 +535,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request, ...@@ -537,7 +535,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
static int drm_vma_info(char *buf, char **start, off_t offset, int request, static int drm_vma_info(char *buf, char **start, off_t offset, int request,
int *eof, void *data) int *eof, void *data)
{ {
drm_device_t *dev = (drm_device_t *) data; struct drm_device *dev = (struct drm_device *) data;
int ret; int ret;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
......
...@@ -50,29 +50,35 @@ ...@@ -50,29 +50,35 @@
#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 #define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000
/** SAREA drawable */ /** SAREA drawable */
typedef struct drm_sarea_drawable { struct drm_sarea_drawable {
unsigned int stamp; unsigned int stamp;
unsigned int flags; unsigned int flags;
} drm_sarea_drawable_t; };
/** SAREA frame */ /** SAREA frame */
typedef struct drm_sarea_frame { struct drm_sarea_frame {
unsigned int x; unsigned int x;
unsigned int y; unsigned int y;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
unsigned int fullscreen; unsigned int fullscreen;
} drm_sarea_frame_t; };
/** SAREA */ /** SAREA */
typedef struct drm_sarea { struct drm_sarea {
/** first thing is always the DRM locking structure */ /** first thing is always the DRM locking structure */
drm_hw_lock_t lock; struct drm_hw_lock lock;
/** \todo Use readers/writer lock for drm_sarea::drawable_lock */ /** \todo Use readers/writer lock for drm_sarea::drawable_lock */
drm_hw_lock_t drawable_lock; struct drm_hw_lock drawable_lock;
drm_sarea_drawable_t drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */ struct drm_sarea_drawable drawableTable[SAREA_MAX_DRAWABLES]; /**< drawables */
drm_sarea_frame_t frame; /**< frame */ struct drm_sarea_frame frame; /**< frame */
drm_context_t dummy_context; drm_context_t dummy_context;
} drm_sarea_t; };
#ifndef __KERNEL__
typedef struct drm_sarea_drawable drm_sarea_drawable_t;
typedef struct drm_sarea_frame drm_sarea_frame_t;
typedef struct drm_sarea drm_sarea_t;
#endif
#endif /* _DRM_SAREA_H_ */ #endif /* _DRM_SAREA_H_ */
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define DEBUG_SCATTER 0 #define DEBUG_SCATTER 0
void drm_sg_cleanup(drm_sg_mem_t * entry) void drm_sg_cleanup(struct drm_sg_mem * entry)
{ {
struct page *page; struct page *page;
int i; int i;
...@@ -65,11 +65,11 @@ void drm_sg_cleanup(drm_sg_mem_t * entry) ...@@ -65,11 +65,11 @@ void drm_sg_cleanup(drm_sg_mem_t * entry)
int drm_sg_alloc(struct inode *inode, struct file *filp, int drm_sg_alloc(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_scatter_gather_t __user *argp = (void __user *)arg; struct drm_scatter_gather __user *argp = (void __user *)arg;
drm_scatter_gather_t request; struct drm_scatter_gather request;
drm_sg_mem_t *entry; struct drm_sg_mem *entry;
unsigned long pages, i, j; unsigned long pages, i, j;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("%s\n", __FUNCTION__);
...@@ -201,16 +201,16 @@ int drm_sg_alloc(struct inode *inode, struct file *filp, ...@@ -201,16 +201,16 @@ int drm_sg_alloc(struct inode *inode, struct file *filp,
int drm_sg_free(struct inode *inode, struct file *filp, int drm_sg_free(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_scatter_gather_t request; struct drm_scatter_gather request;
drm_sg_mem_t *entry; struct drm_sg_mem *entry;
if (!drm_core_check_feature(dev, DRIVER_SG)) if (!drm_core_check_feature(dev, DRIVER_SG))
return -EINVAL; return -EINVAL;
if (copy_from_user(&request, if (copy_from_user(&request,
(drm_scatter_gather_t __user *) arg, (struct drm_scatter_gather __user *) arg,
sizeof(request))) sizeof(request)))
return -EFAULT; return -EFAULT;
......
...@@ -38,13 +38,13 @@ ...@@ -38,13 +38,13 @@
#include "drm_sman.h" #include "drm_sman.h"
typedef struct drm_owner_item { struct drm_owner_item {
drm_hash_item_t owner_hash; struct drm_hash_item owner_hash;
struct list_head sman_list; struct list_head sman_list;
struct list_head mem_blocks; struct list_head mem_blocks;
} drm_owner_item_t; };
void drm_sman_takedown(drm_sman_t * sman) void drm_sman_takedown(struct drm_sman * sman)
{ {
drm_ht_remove(&sman->user_hash_tab); drm_ht_remove(&sman->user_hash_tab);
drm_ht_remove(&sman->owner_hash_tab); drm_ht_remove(&sman->owner_hash_tab);
...@@ -56,12 +56,12 @@ void drm_sman_takedown(drm_sman_t * sman) ...@@ -56,12 +56,12 @@ void drm_sman_takedown(drm_sman_t * sman)
EXPORT_SYMBOL(drm_sman_takedown); EXPORT_SYMBOL(drm_sman_takedown);
int int
drm_sman_init(drm_sman_t * sman, unsigned int num_managers, drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
unsigned int user_order, unsigned int owner_order) unsigned int user_order, unsigned int owner_order)
{ {
int ret = 0; int ret = 0;
sman->mm = (drm_sman_mm_t *) drm_calloc(num_managers, sizeof(*sman->mm), sman->mm = (struct drm_sman_mm *) drm_calloc(num_managers, sizeof(*sman->mm),
DRM_MEM_MM); DRM_MEM_MM);
if (!sman->mm) { if (!sman->mm) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -88,8 +88,8 @@ EXPORT_SYMBOL(drm_sman_init); ...@@ -88,8 +88,8 @@ EXPORT_SYMBOL(drm_sman_init);
static void *drm_sman_mm_allocate(void *private, unsigned long size, static void *drm_sman_mm_allocate(void *private, unsigned long size,
unsigned alignment) unsigned alignment)
{ {
drm_mm_t *mm = (drm_mm_t *) private; struct drm_mm *mm = (struct drm_mm *) private;
drm_mm_node_t *tmp; struct drm_mm_node *tmp;
tmp = drm_mm_search_free(mm, size, alignment, 1); tmp = drm_mm_search_free(mm, size, alignment, 1);
if (!tmp) { if (!tmp) {
...@@ -101,30 +101,30 @@ static void *drm_sman_mm_allocate(void *private, unsigned long size, ...@@ -101,30 +101,30 @@ static void *drm_sman_mm_allocate(void *private, unsigned long size,
static void drm_sman_mm_free(void *private, void *ref) static void drm_sman_mm_free(void *private, void *ref)
{ {
drm_mm_node_t *node = (drm_mm_node_t *) ref; struct drm_mm_node *node = (struct drm_mm_node *) ref;
drm_mm_put_block(node); drm_mm_put_block(node);
} }
static void drm_sman_mm_destroy(void *private) static void drm_sman_mm_destroy(void *private)
{ {
drm_mm_t *mm = (drm_mm_t *) private; struct drm_mm *mm = (struct drm_mm *) private;
drm_mm_takedown(mm); drm_mm_takedown(mm);
drm_free(mm, sizeof(*mm), DRM_MEM_MM); drm_free(mm, sizeof(*mm), DRM_MEM_MM);
} }
static unsigned long drm_sman_mm_offset(void *private, void *ref) static unsigned long drm_sman_mm_offset(void *private, void *ref)
{ {
drm_mm_node_t *node = (drm_mm_node_t *) ref; struct drm_mm_node *node = (struct drm_mm_node *) ref;
return node->start; return node->start;
} }
int int
drm_sman_set_range(drm_sman_t * sman, unsigned int manager, drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
unsigned long start, unsigned long size) unsigned long start, unsigned long size)
{ {
drm_sman_mm_t *sman_mm; struct drm_sman_mm *sman_mm;
drm_mm_t *mm; struct drm_mm *mm;
int ret; int ret;
BUG_ON(manager >= sman->num_managers); BUG_ON(manager >= sman->num_managers);
...@@ -153,8 +153,8 @@ drm_sman_set_range(drm_sman_t * sman, unsigned int manager, ...@@ -153,8 +153,8 @@ drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
EXPORT_SYMBOL(drm_sman_set_range); EXPORT_SYMBOL(drm_sman_set_range);
int int
drm_sman_set_manager(drm_sman_t * sman, unsigned int manager, drm_sman_set_manager(struct drm_sman * sman, unsigned int manager,
drm_sman_mm_t * allocator) struct drm_sman_mm * allocator)
{ {
BUG_ON(manager >= sman->num_managers); BUG_ON(manager >= sman->num_managers);
sman->mm[manager] = *allocator; sman->mm[manager] = *allocator;
...@@ -163,16 +163,16 @@ drm_sman_set_manager(drm_sman_t * sman, unsigned int manager, ...@@ -163,16 +163,16 @@ drm_sman_set_manager(drm_sman_t * sman, unsigned int manager,
} }
EXPORT_SYMBOL(drm_sman_set_manager); EXPORT_SYMBOL(drm_sman_set_manager);
static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman, static struct drm_owner_item *drm_sman_get_owner_item(struct drm_sman * sman,
unsigned long owner) unsigned long owner)
{ {
int ret; int ret;
drm_hash_item_t *owner_hash_item; struct drm_hash_item *owner_hash_item;
drm_owner_item_t *owner_item; struct drm_owner_item *owner_item;
ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item); ret = drm_ht_find_item(&sman->owner_hash_tab, owner, &owner_hash_item);
if (!ret) { if (!ret) {
return drm_hash_entry(owner_hash_item, drm_owner_item_t, return drm_hash_entry(owner_hash_item, struct drm_owner_item,
owner_hash); owner_hash);
} }
...@@ -194,14 +194,14 @@ static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman, ...@@ -194,14 +194,14 @@ static drm_owner_item_t *drm_sman_get_owner_item(drm_sman_t * sman,
return NULL; return NULL;
} }
drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager, struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int manager,
unsigned long size, unsigned alignment, unsigned long size, unsigned alignment,
unsigned long owner) unsigned long owner)
{ {
void *tmp; void *tmp;
drm_sman_mm_t *sman_mm; struct drm_sman_mm *sman_mm;
drm_owner_item_t *owner_item; struct drm_owner_item *owner_item;
drm_memblock_item_t *memblock; struct drm_memblock_item *memblock;
BUG_ON(manager >= sman->num_managers); BUG_ON(manager >= sman->num_managers);
...@@ -246,9 +246,9 @@ drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager, ...@@ -246,9 +246,9 @@ drm_memblock_item_t *drm_sman_alloc(drm_sman_t *sman, unsigned int manager,
EXPORT_SYMBOL(drm_sman_alloc); EXPORT_SYMBOL(drm_sman_alloc);
static void drm_sman_free(drm_memblock_item_t *item) static void drm_sman_free(struct drm_memblock_item *item)
{ {
drm_sman_t *sman = item->sman; struct drm_sman *sman = item->sman;
list_del(&item->owner_list); list_del(&item->owner_list);
drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash); drm_ht_remove_item(&sman->user_hash_tab, &item->user_hash);
...@@ -256,40 +256,41 @@ static void drm_sman_free(drm_memblock_item_t *item) ...@@ -256,40 +256,41 @@ static void drm_sman_free(drm_memblock_item_t *item)
drm_free(item, sizeof(*item), DRM_MEM_MM); drm_free(item, sizeof(*item), DRM_MEM_MM);
} }
int drm_sman_free_key(drm_sman_t *sman, unsigned int key) int drm_sman_free_key(struct drm_sman *sman, unsigned int key)
{ {
drm_hash_item_t *hash_item; struct drm_hash_item *hash_item;
drm_memblock_item_t *memblock_item; struct drm_memblock_item *memblock_item;
if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item)) if (drm_ht_find_item(&sman->user_hash_tab, key, &hash_item))
return -EINVAL; return -EINVAL;
memblock_item = drm_hash_entry(hash_item, drm_memblock_item_t, user_hash); memblock_item = drm_hash_entry(hash_item, struct drm_memblock_item,
user_hash);
drm_sman_free(memblock_item); drm_sman_free(memblock_item);
return 0; return 0;
} }
EXPORT_SYMBOL(drm_sman_free_key); EXPORT_SYMBOL(drm_sman_free_key);
static void drm_sman_remove_owner(drm_sman_t *sman, static void drm_sman_remove_owner(struct drm_sman *sman,
drm_owner_item_t *owner_item) struct drm_owner_item *owner_item)
{ {
list_del(&owner_item->sman_list); list_del(&owner_item->sman_list);
drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash); drm_ht_remove_item(&sman->owner_hash_tab, &owner_item->owner_hash);
drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM); drm_free(owner_item, sizeof(*owner_item), DRM_MEM_MM);
} }
int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner) int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner)
{ {
drm_hash_item_t *hash_item; struct drm_hash_item *hash_item;
drm_owner_item_t *owner_item; struct drm_owner_item *owner_item;
if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) {
return -1; return -1;
} }
owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash); owner_item = drm_hash_entry(hash_item, struct drm_owner_item, owner_hash);
if (owner_item->mem_blocks.next == &owner_item->mem_blocks) { if (owner_item->mem_blocks.next == &owner_item->mem_blocks) {
drm_sman_remove_owner(sman, owner_item); drm_sman_remove_owner(sman, owner_item);
return -1; return -1;
...@@ -300,10 +301,10 @@ int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner) ...@@ -300,10 +301,10 @@ int drm_sman_owner_clean(drm_sman_t *sman, unsigned long owner)
EXPORT_SYMBOL(drm_sman_owner_clean); EXPORT_SYMBOL(drm_sman_owner_clean);
static void drm_sman_do_owner_cleanup(drm_sman_t *sman, static void drm_sman_do_owner_cleanup(struct drm_sman *sman,
drm_owner_item_t *owner_item) struct drm_owner_item *owner_item)
{ {
drm_memblock_item_t *entry, *next; struct drm_memblock_item *entry, *next;
list_for_each_entry_safe(entry, next, &owner_item->mem_blocks, list_for_each_entry_safe(entry, next, &owner_item->mem_blocks,
owner_list) { owner_list) {
...@@ -312,28 +313,28 @@ static void drm_sman_do_owner_cleanup(drm_sman_t *sman, ...@@ -312,28 +313,28 @@ static void drm_sman_do_owner_cleanup(drm_sman_t *sman,
drm_sman_remove_owner(sman, owner_item); drm_sman_remove_owner(sman, owner_item);
} }
void drm_sman_owner_cleanup(drm_sman_t *sman, unsigned long owner) void drm_sman_owner_cleanup(struct drm_sman *sman, unsigned long owner)
{ {
drm_hash_item_t *hash_item; struct drm_hash_item *hash_item;
drm_owner_item_t *owner_item; struct drm_owner_item *owner_item;
if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) { if (drm_ht_find_item(&sman->owner_hash_tab, owner, &hash_item)) {
return; return;
} }
owner_item = drm_hash_entry(hash_item, drm_owner_item_t, owner_hash); owner_item = drm_hash_entry(hash_item, struct drm_owner_item, owner_hash);
drm_sman_do_owner_cleanup(sman, owner_item); drm_sman_do_owner_cleanup(sman, owner_item);
} }
EXPORT_SYMBOL(drm_sman_owner_cleanup); EXPORT_SYMBOL(drm_sman_owner_cleanup);
void drm_sman_cleanup(drm_sman_t *sman) void drm_sman_cleanup(struct drm_sman *sman)
{ {
drm_owner_item_t *entry, *next; struct drm_owner_item *entry, *next;
unsigned int i; unsigned int i;
drm_sman_mm_t *sman_mm; struct drm_sman_mm *sman_mm;
list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) { list_for_each_entry_safe(entry, next, &sman->owner_items, sman_list) {
drm_sman_do_owner_cleanup(sman, entry); drm_sman_do_owner_cleanup(sman, entry);
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
* for memory management. * for memory management.
*/ */
typedef struct drm_sman_mm { struct drm_sman_mm {
/* private info. If allocated, needs to be destroyed by the destroy /* private info. If allocated, needs to be destroyed by the destroy
function */ function */
void *private; void *private;
...@@ -74,30 +74,30 @@ typedef struct drm_sman_mm { ...@@ -74,30 +74,30 @@ typedef struct drm_sman_mm {
"alloc" function */ "alloc" function */
unsigned long (*offset) (void *private, void *ref); unsigned long (*offset) (void *private, void *ref);
} drm_sman_mm_t; };
typedef struct drm_memblock_item { struct drm_memblock_item {
struct list_head owner_list; struct list_head owner_list;
drm_hash_item_t user_hash; struct drm_hash_item user_hash;
void *mm_info; void *mm_info;
drm_sman_mm_t *mm; struct drm_sman_mm *mm;
struct drm_sman *sman; struct drm_sman *sman;
} drm_memblock_item_t; };
typedef struct drm_sman { struct drm_sman {
drm_sman_mm_t *mm; struct drm_sman_mm *mm;
int num_managers; int num_managers;
drm_open_hash_t owner_hash_tab; struct drm_open_hash owner_hash_tab;
drm_open_hash_t user_hash_tab; struct drm_open_hash user_hash_tab;
struct list_head owner_items; struct list_head owner_items;
} drm_sman_t; };
/* /*
* Take down a memory manager. This function should only be called after a * Take down a memory manager. This function should only be called after a
* successful init and after a call to drm_sman_cleanup. * successful init and after a call to drm_sman_cleanup.
*/ */
extern void drm_sman_takedown(drm_sman_t * sman); extern void drm_sman_takedown(struct drm_sman * sman);
/* /*
* Allocate structures for a manager. * Allocate structures for a manager.
...@@ -112,7 +112,7 @@ extern void drm_sman_takedown(drm_sman_t * sman); ...@@ -112,7 +112,7 @@ extern void drm_sman_takedown(drm_sman_t * sman);
* *
*/ */
extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers, extern int drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
unsigned int user_order, unsigned int owner_order); unsigned int user_order, unsigned int owner_order);
/* /*
...@@ -120,7 +120,7 @@ extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers, ...@@ -120,7 +120,7 @@ extern int drm_sman_init(drm_sman_t * sman, unsigned int num_managers,
* manager unless a customized allogator is used. * manager unless a customized allogator is used.
*/ */
extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager, extern int drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
unsigned long start, unsigned long size); unsigned long start, unsigned long size);
/* /*
...@@ -129,23 +129,23 @@ extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager, ...@@ -129,23 +129,23 @@ extern int drm_sman_set_range(drm_sman_t * sman, unsigned int manager,
* so it can be destroyed after this call. * so it can be destroyed after this call.
*/ */
extern int drm_sman_set_manager(drm_sman_t * sman, unsigned int mananger, extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger,
drm_sman_mm_t * allocator); struct drm_sman_mm * allocator);
/* /*
* Allocate a memory block. Aligment is not implemented yet. * Allocate a memory block. Aligment is not implemented yet.
*/ */
extern drm_memblock_item_t *drm_sman_alloc(drm_sman_t * sman, extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman,
unsigned int manager, unsigned int manager,
unsigned long size, unsigned long size,
unsigned alignment, unsigned alignment,
unsigned long owner); unsigned long owner);
/* /*
* Free a memory block identified by its user hash key. * Free a memory block identified by its user hash key.
*/ */
extern int drm_sman_free_key(drm_sman_t * sman, unsigned int key); extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key);
/* /*
* returns 1 iff there are no stale memory blocks associated with this owner. * returns 1 iff there are no stale memory blocks associated with this owner.
...@@ -154,7 +154,7 @@ extern int drm_sman_free_key(drm_sman_t * sman, unsigned int key); ...@@ -154,7 +154,7 @@ extern int drm_sman_free_key(drm_sman_t * sman, unsigned int key);
* resources associated with owner. * resources associated with owner.
*/ */
extern int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner); extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner);
/* /*
* Frees all stale memory blocks associated with this owner. Note that this * Frees all stale memory blocks associated with this owner. Note that this
...@@ -164,13 +164,13 @@ extern int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner); ...@@ -164,13 +164,13 @@ extern int drm_sman_owner_clean(drm_sman_t * sman, unsigned long owner);
* is not going to be referenced anymore. * is not going to be referenced anymore.
*/ */
extern void drm_sman_owner_cleanup(drm_sman_t * sman, unsigned long owner); extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long owner);
/* /*
* Frees all stale memory blocks associated with the memory manager. * Frees all stale memory blocks associated with the memory manager.
* See idling above. * See idling above.
*/ */
extern void drm_sman_cleanup(drm_sman_t * sman); extern void drm_sman_cleanup(struct drm_sman * sman);
#endif #endif
...@@ -49,16 +49,21 @@ MODULE_PARM_DESC(debug, "Enable debug output"); ...@@ -49,16 +49,21 @@ MODULE_PARM_DESC(debug, "Enable debug output");
module_param_named(cards_limit, drm_cards_limit, int, 0444); module_param_named(cards_limit, drm_cards_limit, int, 0444);
module_param_named(debug, drm_debug, int, 0600); module_param_named(debug, drm_debug, int, 0600);
drm_head_t **drm_heads; struct drm_head **drm_heads;
struct class *drm_class; struct class *drm_class;
struct proc_dir_entry *drm_proc_root; struct proc_dir_entry *drm_proc_root;
static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev,
const struct pci_device_id *ent, const struct pci_device_id *ent,
struct drm_driver *driver) struct drm_driver *driver)
{ {
int retcode; int retcode;
INIT_LIST_HEAD(&dev->filelist);
INIT_LIST_HEAD(&dev->ctxlist);
INIT_LIST_HEAD(&dev->vmalist);
INIT_LIST_HEAD(&dev->maplist);
spin_lock_init(&dev->count_lock); spin_lock_init(&dev->count_lock);
spin_lock_init(&dev->drw_lock); spin_lock_init(&dev->drw_lock);
spin_lock_init(&dev->tasklet_lock); spin_lock_init(&dev->tasklet_lock);
...@@ -76,12 +81,7 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, ...@@ -76,12 +81,7 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
#endif #endif
dev->irq = pdev->irq; dev->irq = pdev->irq;
dev->maplist = drm_calloc(1, sizeof(*dev->maplist), DRM_MEM_MAPS);
if (dev->maplist == NULL)
return -ENOMEM;
INIT_LIST_HEAD(&dev->maplist->head);
if (drm_ht_create(&dev->map_hash, 12)) { if (drm_ht_create(&dev->map_hash, 12)) {
drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
return -ENOMEM; return -ENOMEM;
} }
...@@ -143,9 +143,9 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, ...@@ -143,9 +143,9 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
* create the proc init entry via proc_init(). This routines assigns * create the proc init entry via proc_init(). This routines assigns
* minor numbers to secondary heads of multi-headed cards * minor numbers to secondary heads of multi-headed cards
*/ */
static int drm_get_head(drm_device_t * dev, drm_head_t * head) static int drm_get_head(struct drm_device * dev, struct drm_head * head)
{ {
drm_head_t **heads = drm_heads; struct drm_head **heads = drm_heads;
int ret; int ret;
int minor; int minor;
...@@ -154,7 +154,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head) ...@@ -154,7 +154,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head)
for (minor = 0; minor < drm_cards_limit; minor++, heads++) { for (minor = 0; minor < drm_cards_limit; minor++, heads++) {
if (!*heads) { if (!*heads) {
*head = (drm_head_t) { *head = (struct drm_head) {
.dev = dev,.device = .dev = dev,.device =
MKDEV(DRM_MAJOR, minor),.minor = minor,}; MKDEV(DRM_MAJOR, minor),.minor = minor,};
...@@ -184,7 +184,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head) ...@@ -184,7 +184,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head)
err_g2: err_g2:
drm_proc_cleanup(minor, drm_proc_root, head->dev_root); drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
err_g1: err_g1:
*head = (drm_head_t) { *head = (struct drm_head) {
.dev = NULL}; .dev = NULL};
return ret; return ret;
} }
...@@ -203,7 +203,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head) ...@@ -203,7 +203,7 @@ static int drm_get_head(drm_device_t * dev, drm_head_t * head)
int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
struct drm_driver *driver) struct drm_driver *driver)
{ {
drm_device_t *dev; struct drm_device *dev;
int ret; int ret;
DRM_DEBUG("\n"); DRM_DEBUG("\n");
...@@ -246,7 +246,7 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, ...@@ -246,7 +246,7 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
* "drm" data, otherwise unregisters the "drm" data, frees the dev list and * "drm" data, otherwise unregisters the "drm" data, frees the dev list and
* unregisters the character device. * unregisters the character device.
*/ */
int drm_put_dev(drm_device_t * dev) int drm_put_dev(struct drm_device * dev)
{ {
DRM_DEBUG("release primary %s\n", dev->driver->pci_driver.name); DRM_DEBUG("release primary %s\n", dev->driver->pci_driver.name);
...@@ -274,7 +274,7 @@ int drm_put_dev(drm_device_t * dev) ...@@ -274,7 +274,7 @@ int drm_put_dev(drm_device_t * dev)
* last minor released. * last minor released.
* *
*/ */
int drm_put_head(drm_head_t * head) int drm_put_head(struct drm_head * head)
{ {
int minor = head->minor; int minor = head->minor;
...@@ -283,7 +283,7 @@ int drm_put_head(drm_head_t * head) ...@@ -283,7 +283,7 @@ int drm_put_head(drm_head_t * head)
drm_proc_cleanup(minor, drm_proc_root, head->dev_root); drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
drm_sysfs_device_remove(head->dev_class); drm_sysfs_device_remove(head->dev_class);
*head = (drm_head_t) {.dev = NULL}; *head = (struct drm_head) {.dev = NULL};
drm_heads[minor] = NULL; drm_heads[minor] = NULL;
......
...@@ -80,7 +80,7 @@ void drm_sysfs_destroy(struct class *class) ...@@ -80,7 +80,7 @@ void drm_sysfs_destroy(struct class *class)
static ssize_t show_dri(struct class_device *class_device, char *buf) static ssize_t show_dri(struct class_device *class_device, char *buf)
{ {
drm_device_t * dev = ((drm_head_t *)class_get_devdata(class_device))->dev; struct drm_device * dev = ((struct drm_head *)class_get_devdata(class_device))->dev;
if (dev->driver->dri_library_name) if (dev->driver->dri_library_name)
return dev->driver->dri_library_name(dev, buf); return dev->driver->dri_library_name(dev, buf);
return snprintf(buf, PAGE_SIZE, "%s\n", dev->driver->pci_driver.name); return snprintf(buf, PAGE_SIZE, "%s\n", dev->driver->pci_driver.name);
...@@ -104,7 +104,7 @@ static struct class_device_attribute class_device_attrs[] = { ...@@ -104,7 +104,7 @@ static struct class_device_attribute class_device_attrs[] = {
* Note: the struct class passed to this function must have previously been * Note: the struct class passed to this function must have previously been
* created with a call to drm_sysfs_create(). * created with a call to drm_sysfs_create().
*/ */
struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head) struct class_device *drm_sysfs_device_add(struct class *cs, struct drm_head *head)
{ {
struct class_device *class_dev; struct class_device *class_dev;
int i, j, err; int i, j, err;
......
...@@ -79,11 +79,11 @@ static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma) ...@@ -79,11 +79,11 @@ static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
unsigned long address) unsigned long address)
{ {
drm_file_t *priv = vma->vm_file->private_data; struct drm_file *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_map_t *map = NULL; struct drm_map *map = NULL;
drm_map_list_t *r_list; struct drm_map_list *r_list;
drm_hash_item_t *hash; struct drm_hash_item *hash;
/* /*
* Find the right map * Find the right map
...@@ -97,7 +97,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, ...@@ -97,7 +97,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash))
goto vm_nopage_error; goto vm_nopage_error;
r_list = drm_hash_entry(hash, drm_map_list_t, hash); r_list = drm_hash_entry(hash, struct drm_map_list, hash);
map = r_list->map; map = r_list->map;
if (map && map->type == _DRM_AGP) { if (map && map->type == _DRM_AGP) {
...@@ -116,7 +116,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, ...@@ -116,7 +116,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
/* /*
* It's AGP memory - find the real physical page to map * It's AGP memory - find the real physical page to map
*/ */
for (agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) { list_for_each_entry(agpmem, &dev->agp->memory, head) {
if (agpmem->bound <= baddr && if (agpmem->bound <= baddr &&
agpmem->bound + agpmem->pages * PAGE_SIZE > baddr) agpmem->bound + agpmem->pages * PAGE_SIZE > baddr)
break; break;
...@@ -163,7 +163,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, ...@@ -163,7 +163,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
unsigned long address) unsigned long address)
{ {
drm_map_t *map = (drm_map_t *) vma->vm_private_data; struct drm_map *map = (struct drm_map *) vma->vm_private_data;
unsigned long offset; unsigned long offset;
unsigned long i; unsigned long i;
struct page *page; struct page *page;
...@@ -194,12 +194,11 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, ...@@ -194,12 +194,11 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
*/ */
static void drm_vm_shm_close(struct vm_area_struct *vma) static void drm_vm_shm_close(struct vm_area_struct *vma)
{ {
drm_file_t *priv = vma->vm_file->private_data; struct drm_file *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_vma_entry_t *pt, *prev, *next; struct drm_vma_entry *pt, *temp;
drm_map_t *map; struct drm_map *map;
drm_map_list_t *r_list; struct drm_map_list *r_list;
struct list_head *list;
int found_maps = 0; int found_maps = 0;
DRM_DEBUG("0x%08lx,0x%08lx\n", DRM_DEBUG("0x%08lx,0x%08lx\n",
...@@ -209,30 +208,22 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) ...@@ -209,30 +208,22 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
map = vma->vm_private_data; map = vma->vm_private_data;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
for (pt = dev->vmalist, prev = NULL; pt; pt = next) { list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
next = pt->next;
if (pt->vma->vm_private_data == map) if (pt->vma->vm_private_data == map)
found_maps++; found_maps++;
if (pt->vma == vma) { if (pt->vma == vma) {
if (prev) { list_del(&pt->head);
prev->next = pt->next;
} else {
dev->vmalist = pt->next;
}
drm_free(pt, sizeof(*pt), DRM_MEM_VMAS); drm_free(pt, sizeof(*pt), DRM_MEM_VMAS);
} else {
prev = pt;
} }
} }
/* We were the only map that was found */ /* We were the only map that was found */
if (found_maps == 1 && map->flags & _DRM_REMOVABLE) { if (found_maps == 1 && map->flags & _DRM_REMOVABLE) {
/* Check to see if we are in the maplist, if we are not, then /* Check to see if we are in the maplist, if we are not, then
* we delete this mappings information. * we delete this mappings information.
*/ */
found_maps = 0; found_maps = 0;
list = &dev->maplist->head; list_for_each_entry(r_list, &dev->maplist, head) {
list_for_each(list, &dev->maplist->head) {
r_list = list_entry(list, drm_map_list_t, head);
if (r_list->map == map) if (r_list->map == map)
found_maps++; found_maps++;
} }
...@@ -283,9 +274,9 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) ...@@ -283,9 +274,9 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
unsigned long address) unsigned long address)
{ {
drm_file_t *priv = vma->vm_file->private_data; struct drm_file *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
unsigned long offset; unsigned long offset;
unsigned long page_nr; unsigned long page_nr;
struct page *page; struct page *page;
...@@ -319,10 +310,10 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, ...@@ -319,10 +310,10 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
unsigned long address) unsigned long address)
{ {
drm_map_t *map = (drm_map_t *) vma->vm_private_data; struct drm_map *map = (struct drm_map *) vma->vm_private_data;
drm_file_t *priv = vma->vm_file->private_data; struct drm_file *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_sg_mem_t *entry = dev->sg; struct drm_sg_mem *entry = dev->sg;
unsigned long offset; unsigned long offset;
unsigned long map_offset; unsigned long map_offset;
unsigned long page_offset; unsigned long page_offset;
...@@ -414,9 +405,9 @@ static struct vm_operations_struct drm_vm_sg_ops = { ...@@ -414,9 +405,9 @@ static struct vm_operations_struct drm_vm_sg_ops = {
*/ */
static void drm_vm_open_locked(struct vm_area_struct *vma) static void drm_vm_open_locked(struct vm_area_struct *vma)
{ {
drm_file_t *priv = vma->vm_file->private_data; struct drm_file *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_vma_entry_t *vma_entry; struct drm_vma_entry *vma_entry;
DRM_DEBUG("0x%08lx,0x%08lx\n", DRM_DEBUG("0x%08lx,0x%08lx\n",
vma->vm_start, vma->vm_end - vma->vm_start); vma->vm_start, vma->vm_end - vma->vm_start);
...@@ -425,16 +416,15 @@ static void drm_vm_open_locked(struct vm_area_struct *vma) ...@@ -425,16 +416,15 @@ static void drm_vm_open_locked(struct vm_area_struct *vma)
vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS); vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
if (vma_entry) { if (vma_entry) {
vma_entry->vma = vma; vma_entry->vma = vma;
vma_entry->next = dev->vmalist;
vma_entry->pid = current->pid; vma_entry->pid = current->pid;
dev->vmalist = vma_entry; list_add(&vma_entry->head, &dev->vmalist);
} }
} }
static void drm_vm_open(struct vm_area_struct *vma) static void drm_vm_open(struct vm_area_struct *vma)
{ {
drm_file_t *priv = vma->vm_file->private_data; struct drm_file *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
drm_vm_open_locked(vma); drm_vm_open_locked(vma);
...@@ -451,22 +441,18 @@ static void drm_vm_open(struct vm_area_struct *vma) ...@@ -451,22 +441,18 @@ static void drm_vm_open(struct vm_area_struct *vma)
*/ */
static void drm_vm_close(struct vm_area_struct *vma) static void drm_vm_close(struct vm_area_struct *vma)
{ {
drm_file_t *priv = vma->vm_file->private_data; struct drm_file *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_vma_entry_t *pt, *prev; struct drm_vma_entry *pt, *temp;
DRM_DEBUG("0x%08lx,0x%08lx\n", DRM_DEBUG("0x%08lx,0x%08lx\n",
vma->vm_start, vma->vm_end - vma->vm_start); vma->vm_start, vma->vm_end - vma->vm_start);
atomic_dec(&dev->vma_count); atomic_dec(&dev->vma_count);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
if (pt->vma == vma) { if (pt->vma == vma) {
if (prev) { list_del(&pt->head);
prev->next = pt->next;
} else {
dev->vmalist = pt->next;
}
drm_free(pt, sizeof(*pt), DRM_MEM_VMAS); drm_free(pt, sizeof(*pt), DRM_MEM_VMAS);
break; break;
} }
...@@ -486,9 +472,9 @@ static void drm_vm_close(struct vm_area_struct *vma) ...@@ -486,9 +472,9 @@ static void drm_vm_close(struct vm_area_struct *vma)
*/ */
static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev; struct drm_device *dev;
drm_device_dma_t *dma; struct drm_device_dma *dma;
unsigned long length = vma->vm_end - vma->vm_start; unsigned long length = vma->vm_end - vma->vm_start;
dev = priv->head->dev; dev = priv->head->dev;
...@@ -526,7 +512,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) ...@@ -526,7 +512,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
return 0; return 0;
} }
unsigned long drm_core_get_map_ofs(drm_map_t * map) unsigned long drm_core_get_map_ofs(struct drm_map * map)
{ {
return map->offset; return map->offset;
} }
...@@ -559,11 +545,11 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs); ...@@ -559,11 +545,11 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
*/ */
static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
drm_map_t *map = NULL; struct drm_map *map = NULL;
unsigned long offset = 0; unsigned long offset = 0;
drm_hash_item_t *hash; struct drm_hash_item *hash;
DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n", DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
vma->vm_start, vma->vm_end, vma->vm_pgoff); vma->vm_start, vma->vm_end, vma->vm_pgoff);
...@@ -588,7 +574,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) ...@@ -588,7 +574,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
return -EINVAL; return -EINVAL;
} }
map = drm_hash_entry(hash, drm_map_list_t, hash)->map; map = drm_hash_entry(hash, struct drm_map_list, hash)->map;
if (!map || ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) if (!map || ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN)))
return -EPERM; return -EPERM;
...@@ -677,8 +663,8 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) ...@@ -677,8 +663,8 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
int drm_mmap(struct file *filp, struct vm_area_struct *vma) int drm_mmap(struct file *filp, struct vm_area_struct *vma)
{ {
drm_file_t *priv = filp->private_data; struct drm_file *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; struct drm_device *dev = priv->head->dev;
int ret; int ret;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册