Commit 6c340eac authored by Eric Anholt's avatar Eric Anholt Committed by Dave Airlie

drm: Replace filp in ioctl arguments with drm_file *file_priv.

As a fallout, replace filp storage with file_priv storage for "unique
identifier of a client" all over the DRM.  There is a 1:1 mapping, so this
should be a noop.  This could be a minor performance improvement, as everyth
on Linux dereferenced filp to get file_priv anyway, while only the mmap ioct
went the other direction.
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 20caafa6
This diff is collapsed.
......@@ -40,7 +40,7 @@
* Get AGP information.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a (output) drm_agp_info structure.
* \return zero on success or a negative number on failure.
......@@ -71,11 +71,10 @@ int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info)
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 drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_agp_info info;
int err;
......@@ -115,7 +114,7 @@ EXPORT_SYMBOL(drm_agp_acquire);
* Acquire the AGP device (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument.
* \return zero on success or a negative number on failure.
......@@ -123,12 +122,10 @@ EXPORT_SYMBOL(drm_agp_acquire);
* Verifies the AGP device hasn't been acquired before and calls
* \c agp_backend_acquire.
*/
int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
int drm_agp_acquire_ioctl(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
return drm_agp_acquire((struct drm_device *) priv->head->dev);
return drm_agp_acquire((struct drm_device *) file_priv->head->dev);
}
/**
......@@ -149,11 +146,10 @@ int drm_agp_release(struct drm_device * dev)
}
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 drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
return drm_agp_release(dev);
}
......@@ -182,11 +178,10 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode)
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 drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_agp_mode mode;
if (copy_from_user(&mode, (struct drm_agp_mode __user *) arg, sizeof(mode)))
......@@ -199,7 +194,7 @@ int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
* Allocate AGP memory.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv file private pointer.
* \param cmd command.
* \param arg pointer to a drm_agp_buffer structure.
* \return zero on success or a negative number on failure.
......@@ -241,11 +236,10 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
}
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 drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_agp_buffer request;
struct drm_agp_buffer __user *argp = (void __user *)arg;
int err;
......@@ -297,7 +291,7 @@ static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev,
* Unbind AGP memory from the GATT (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_agp_binding structure.
* \return zero on success or a negative number on failure.
......@@ -323,11 +317,10 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
}
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 drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_agp_binding request;
if (copy_from_user
......@@ -341,7 +334,7 @@ int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
* Bind AGP memory into the GATT (ioctl)
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_agp_binding structure.
* \return zero on success or a negative number on failure.
......@@ -372,11 +365,10 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
}
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 drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_agp_binding request;
if (copy_from_user
......@@ -390,7 +382,7 @@ int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
* Free AGP memory (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_agp_buffer structure.
* \return zero on success or a negative number on failure.
......@@ -419,11 +411,10 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
}
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 drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_agp_buffer request;
if (copy_from_user
......
......@@ -128,27 +128,26 @@ static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic)
* Get a unique magic number (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a resulting drm_auth structure.
* \return zero on success, or a negative number on failure.
*
* If there is a magic number in drm_file::magic then use it, otherwise
* searches an unique non-zero magic number and add it associating it with \p
* filp.
* file_priv.
*/
int drm_getmagic(struct inode *inode, struct file *filp,
int drm_getmagic(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
static drm_magic_t sequence = 0;
static DEFINE_SPINLOCK(lock);
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_auth auth;
/* Find unique magic */
if (priv->magic) {
auth.magic = priv->magic;
if (file_priv->magic) {
auth.magic = file_priv->magic;
} else {
do {
spin_lock(&lock);
......@@ -157,8 +156,8 @@ int drm_getmagic(struct inode *inode, struct file *filp,
auth.magic = sequence++;
spin_unlock(&lock);
} while (drm_find_file(dev, auth.magic));
priv->magic = auth.magic;
drm_add_magic(dev, priv, auth.magic);
file_priv->magic = auth.magic;
drm_add_magic(dev, file_priv, auth.magic);
}
DRM_DEBUG("%u\n", auth.magic);
......@@ -171,18 +170,17 @@ int drm_getmagic(struct inode *inode, struct file *filp,
* Authenticate with a magic.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_auth structure.
* \return zero if authentication successed, or a negative number otherwise.
*
* Checks if \p filp is associated with the magic number passed in \arg.
* Checks if \p file_priv is associated with the magic number passed in \arg.
*/
int drm_authmagic(struct inode *inode, struct file *filp,
int drm_authmagic(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_auth auth;
struct drm_file *file;
......
......@@ -92,7 +92,7 @@ static int drm_map_handle(struct drm_device *dev, struct drm_hash_item *hash,
* Ioctl to specify a range of memory that is available for mapping by a non-root process.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_map structure.
* \return zero on success or a negative value on error.
......@@ -332,19 +332,15 @@ int drm_addmap(struct drm_device * dev, unsigned int offset,
EXPORT_SYMBOL(drm_addmap);
int drm_addmap_ioctl(struct inode *inode, struct file *filp,
int drm_addmap_ioctl(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_map map;
struct drm_map_list *maplist;
struct drm_map __user *argp = (void __user *)arg;
int err;
if (!(filp->f_mode & 3))
return -EACCES; /* Require read/write */
if (copy_from_user(&map, argp, sizeof(map))) {
return -EFAULT;
}
......@@ -372,7 +368,7 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp,
* isn't in use.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a struct drm_map structure.
* \return zero on success or a negative value on error.
......@@ -453,11 +449,10 @@ int drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
* gets used by drivers that the server doesn't need to care about. This seems
* unlikely.
*/
int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
int drm_rmmap_ioctl(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_map request;
drm_local_map_t *map = NULL;
struct drm_map_list *r_list;
......@@ -661,7 +656,7 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
buf->waiting = 0;
buf->pending = 0;
init_waitqueue_head(&buf->dma_wait);
buf->filp = NULL;
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->dev_priv_size;
buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
......@@ -872,7 +867,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
buf->waiting = 0;
buf->pending = 0;
init_waitqueue_head(&buf->dma_wait);
buf->filp = NULL;
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->dev_priv_size;
buf->dev_private = drm_alloc(buf->dev_priv_size,
......@@ -1050,7 +1045,7 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request
buf->waiting = 0;
buf->pending = 0;
init_waitqueue_head(&buf->dma_wait);
buf->filp = NULL;
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->dev_priv_size;
buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
......@@ -1211,7 +1206,7 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request
buf->waiting = 0;
buf->pending = 0;
init_waitqueue_head(&buf->dma_wait);
buf->filp = NULL;
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->dev_priv_size;
buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
......@@ -1275,7 +1270,7 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request
* Add buffers for DMA transfers (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a struct drm_buf_desc request.
* \return zero on success or a negative number on failure.
......@@ -1285,12 +1280,11 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request
* addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent
* PCI memory respectively.
*/
int drm_addbufs(struct inode *inode, struct file *filp,
int drm_addbufs(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_buf_desc request;
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
int ret;
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
......@@ -1328,7 +1322,7 @@ int drm_addbufs(struct inode *inode, struct file *filp,
* large buffers can be used for image transfer).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_buf_info structure.
* \return zero on success or a negative number on failure.
......@@ -1337,11 +1331,10 @@ int drm_addbufs(struct inode *inode, struct file *filp,
* lock, preventing of allocating more buffers after this call. Information
* about each requested buffer is then copied into user space.
*/
int drm_infobufs(struct inode *inode, struct file *filp,
int drm_infobufs(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_device_dma *dma = dev->dma;
struct drm_buf_info request;
struct drm_buf_info __user *argp = (void __user *)arg;
......@@ -1415,7 +1408,7 @@ int drm_infobufs(struct inode *inode, struct file *filp,
* Specifies a low and high water mark for buffer allocation
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg a pointer to a drm_buf_desc structure.
* \return zero on success or a negative number on failure.
......@@ -1425,11 +1418,10 @@ int drm_infobufs(struct inode *inode, struct file *filp,
*
* \note This ioctl is deprecated and mostly never used.
*/
int drm_markbufs(struct inode *inode, struct file *filp,
int drm_markbufs(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_device_dma *dma = dev->dma;
struct drm_buf_desc request;
int order;
......@@ -1467,7 +1459,7 @@ int drm_markbufs(struct inode *inode, struct file *filp,
* Unreserve the buffers in list, previously reserved using drmDMA.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_buf_free structure.
* \return zero on success or a negative number on failure.
......@@ -1475,11 +1467,10 @@ int drm_markbufs(struct inode *inode, struct file *filp,
* Calls free_buffer() for each used buffer.
* This function is primarily used for debugging.
*/
int drm_freebufs(struct inode *inode, struct file *filp,
int drm_freebufs(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_device_dma *dma = dev->dma;
struct drm_buf_free request;
int i;
......@@ -1506,7 +1497,7 @@ int drm_freebufs(struct inode *inode, struct file *filp,
return -EINVAL;
}
buf = dma->buflist[idx];
if (buf->filp != filp) {
if (buf->file_priv != file_priv) {
DRM_ERROR("Process %d freeing buffer not owned\n",
current->pid);
return -EINVAL;
......@@ -1521,7 +1512,7 @@ int drm_freebufs(struct inode *inode, struct file *filp,
* Maps all of the DMA buffers into client-virtual space (ioctl).
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg pointer to a drm_buf_map structure.
* \return zero on success or a negative number on failure.
......@@ -1531,11 +1522,10 @@ int drm_freebufs(struct inode *inode, struct file *filp,
* offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls
* drm_mmap_dma().
*/
int drm_mapbufs(struct inode *inode, struct file *filp,
int drm_mapbufs(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_device_dma *dma = dev->dma;
struct drm_buf_map __user *argp = (void __user *)arg;
int retcode = 0;
......@@ -1577,13 +1567,13 @@ int drm_mapbufs(struct inode *inode, struct file *filp,
}
down_write(&current->mm->mmap_sem);
virtual = do_mmap(filp, 0, map->size,
virtual = do_mmap(file_priv->filp, 0, map->size,
PROT_READ | PROT_WRITE,
MAP_SHARED, token);
up_write(&current->mm->mmap_sem);
} else {
down_write(&current->mm->mmap_sem);
virtual = do_mmap(filp, 0, dma->byte_count,
virtual = do_mmap(file_priv->filp, 0, dma->byte_count,
PROT_READ | PROT_WRITE,
MAP_SHARED, 0);
up_write(&current->mm->mmap_sem);
......
......@@ -131,7 +131,7 @@ void drm_ctxbitmap_cleanup(struct drm_device * dev)
* Get per-context SAREA.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx_priv_map structure.
* \return zero on success or a negative number on failure.
......@@ -139,11 +139,10 @@ void drm_ctxbitmap_cleanup(struct drm_device * dev)
* Gets the map from drm_device::ctx_idr with the handle specified and
* returns its handle.
*/
int drm_getsareactx(struct inode *inode, struct file *filp,
int drm_getsareactx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_ctx_priv_map __user *argp = (void __user *)arg;
struct drm_ctx_priv_map request;
struct drm_map *map;
......@@ -182,7 +181,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
* Set per-context SAREA.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx_priv_map structure.
* \return zero on success or a negative number on failure.
......@@ -190,11 +189,10 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
* Searches the mapping specified in \p arg and update the entry in
* drm_device::ctx_idr with it.
*/
int drm_setsareactx(struct inode *inode, struct file *filp,
int drm_setsareactx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_ctx_priv_map request;
struct drm_map *map = NULL;
struct drm_map_list *r_list = NULL;
......@@ -292,12 +290,12 @@ static int drm_context_switch_complete(struct drm_device * dev, int new)
* Reserve contexts.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx_res structure.
* \return zero on success or a negative number on failure.
*/
int drm_resctx(struct inode *inode, struct file *filp,
int drm_resctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_ctx_res res;
......@@ -327,18 +325,17 @@ int drm_resctx(struct inode *inode, struct file *filp,
* Add context.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*
* Get a new handle for the context and copy to userspace.
*/
int drm_addctx(struct inode *inode, struct file *filp,
int drm_addctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_ctx_list *ctx_entry;
struct drm_ctx __user *argp = (void __user *)arg;
struct drm_ctx ctx;
......@@ -374,7 +371,7 @@ int drm_addctx(struct inode *inode, struct file *filp,
INIT_LIST_HEAD(&ctx_entry->head);
ctx_entry->handle = ctx.handle;
ctx_entry->tag = priv;
ctx_entry->tag = file_priv;
mutex_lock(&dev->ctxlist_mutex);
list_add(&ctx_entry->head, &dev->ctxlist);
......@@ -386,7 +383,7 @@ int drm_addctx(struct inode *inode, struct file *filp,
return 0;
}
int drm_modctx(struct inode *inode, struct file *filp,
int drm_modctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
/* This does nothing */
......@@ -397,12 +394,12 @@ int drm_modctx(struct inode *inode, struct file *filp,
* Get context.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*/
int drm_getctx(struct inode *inode, struct file *filp,
int drm_getctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_ctx __user *argp = (void __user *)arg;
......@@ -423,18 +420,17 @@ int drm_getctx(struct inode *inode, struct file *filp,
* Switch context.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*
* Calls context_switch().
*/
int drm_switchctx(struct inode *inode, struct file *filp,
int drm_switchctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_ctx ctx;
if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
......@@ -448,18 +444,17 @@ int drm_switchctx(struct inode *inode, struct file *filp,
* New context.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*
* Calls context_switch_complete().
*/
int drm_newctx(struct inode *inode, struct file *filp,
int drm_newctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_ctx ctx;
if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
......@@ -475,18 +470,17 @@ int drm_newctx(struct inode *inode, struct file *filp,
* Remove context.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*
* If not the special kernel context, calls ctxbitmap_free() to free the specified context.
*/
int drm_rmctx(struct inode *inode, struct file *filp,
int drm_rmctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_ctx ctx;
if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
......@@ -494,7 +488,7 @@ int drm_rmctx(struct inode *inode, struct file *filp,
DRM_DEBUG("%d\n", ctx.handle);
if (ctx.handle == DRM_KERNEL_CONTEXT + 1) {
priv->remove_auth_on_close = 1;
file_priv->remove_auth_on_close = 1;
}
if (ctx.handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor)
......
......@@ -136,7 +136,7 @@ void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
buf->waiting = 0;
buf->pending = 0;
buf->filp = NULL;
buf->file_priv = NULL;
buf->used = 0;
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)
......@@ -148,11 +148,12 @@ void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
/**
* Reclaim the buffers.
*
* \param filp file pointer.
* \param file_priv DRM file private.
*
* Frees each buffer associated with \p filp not already on the hardware.
* Frees each buffer associated with \p file_priv not already on the hardware.
*/
void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp)
void drm_core_reclaim_buffers(struct drm_device *dev,
struct drm_file *file_priv)
{
struct drm_device_dma *dma = dev->dma;
int i;
......@@ -160,7 +161,7 @@ void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp)
if (!dma)
return;
for (i = 0; i < dma->buf_count; i++) {
if (dma->buflist[i]->filp == filp) {
if (dma->buflist[i]->file_priv == file_priv) {
switch (dma->buflist[i]->list) {
case DRM_LIST_NONE:
drm_free_buffer(dev, dma->buflist[i]);
......
......@@ -49,7 +49,7 @@
#include "drmP.h"
#include "drm_core.h"
static int drm_version(struct inode *inode, struct file *filp,
static int drm_version(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg);
/** Ioctl table */
......@@ -224,7 +224,7 @@ int drm_lastclose(struct drm_device * dev)
if (dev->lock.hw_lock) {
dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */
dev->lock.filp = NULL;
dev->lock.file_priv = NULL;
wake_up_interruptible(&dev->lock.lock_queue);
}
mutex_unlock(&dev->struct_mutex);
......@@ -418,11 +418,10 @@ module_exit(drm_core_exit);
*
* Fills in the version information in \p arg.
*/
static int drm_version(struct inode *inode, struct file *filp,
static int drm_version(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_version __user *argp = (void __user *)arg;
struct drm_version version;
int len;
......@@ -446,7 +445,7 @@ static int drm_version(struct inode *inode, struct file *filp,
* Called whenever a process performs an ioctl on /dev/drm.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument.
* \return zero on success or negative number on failure.
......@@ -457,8 +456,8 @@ static int drm_version(struct inode *inode, struct file *filp,
int drm_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_file *file_priv = filp->private_data;
struct drm_device *dev = file_priv->head->dev;
drm_ioctl_desc_t *ioctl;
drm_ioctl_t *func;
unsigned int nr = DRM_IOCTL_NR(cmd);
......@@ -466,12 +465,12 @@ int drm_ioctl(struct inode *inode, struct file *filp,
atomic_inc(&dev->ioctl_count);
atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
++priv->ioctl_count;
++file_priv->ioctl_count;
DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
current->pid, cmd, nr,
(long)old_encode_dev(priv->head->device),
priv->authenticated);
(long)old_encode_dev(file_priv->head->device),
file_priv->authenticated);
if ((nr >= DRM_CORE_IOCTL_COUNT) &&
((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
......@@ -493,11 +492,11 @@ int drm_ioctl(struct inode *inode, struct file *filp,
DRM_DEBUG("no function\n");
retcode = -EINVAL;
} else if (((ioctl->flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN)) ||
((ioctl->flags & DRM_AUTH) && !priv->authenticated) ||
((ioctl->flags & DRM_MASTER) && !priv->master)) {
((ioctl->flags & DRM_AUTH) && !file_priv->authenticated) ||
((ioctl->flags & DRM_MASTER) && !file_priv->master)) {
retcode = -EACCES;
} else {
retcode = func(inode, filp, cmd, arg);
retcode = func(inode, file_priv, cmd, arg);
}
err_i1:
......
......@@ -242,6 +242,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
memset(priv, 0, sizeof(*priv));
filp->private_data = priv;
priv->filp = filp;
priv->uid = current->euid;
priv->pid = current->pid;
priv->minor = minor;
......@@ -312,7 +313,7 @@ EXPORT_SYMBOL(drm_fasync);
* Release file.
*
* \param inode device inode
* \param filp file pointer.
* \param file_priv DRM file private.
* \return zero on success or a negative number on failure.
*
* If the hardware lock is held then free it, and take it again for the kernel
......@@ -322,29 +323,28 @@ EXPORT_SYMBOL(drm_fasync);
*/
int drm_release(struct inode *inode, struct file *filp)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev;
struct drm_file *file_priv = filp->private_data;
struct drm_device *dev = file_priv->head->dev;
int retcode = 0;
lock_kernel();
dev = priv->head->dev;
DRM_DEBUG("open_count = %d\n", dev->open_count);
if (dev->driver->preclose)
dev->driver->preclose(dev, filp);
dev->driver->preclose(dev, file_priv);
/* ========================================================
* Begin inline drm_release
*/
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
current->pid, (long)old_encode_dev(priv->head->device),
current->pid, (long)old_encode_dev(file_priv->head->device),
dev->open_count);
if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) {
if (drm_i_have_hw_lock(filp)) {
dev->driver->reclaim_buffers_locked(dev, filp);
if (drm_i_have_hw_lock(file_priv)) {
dev->driver->reclaim_buffers_locked(dev, file_priv);
} else {
unsigned long _end=jiffies + 3*DRM_HZ;
int locked = 0;
......@@ -370,7 +370,7 @@ int drm_release(struct inode *inode, struct file *filp)
"\tI will go on reclaiming the buffers anyway.\n");
}
dev->driver->reclaim_buffers_locked(dev, filp);
dev->driver->reclaim_buffers_locked(dev, file_priv);
drm_idlelock_release(&dev->lock);
}
}
......@@ -378,12 +378,12 @@ int drm_release(struct inode *inode, struct file *filp)
if (dev->driver->reclaim_buffers_idlelocked && dev->lock.hw_lock) {
drm_idlelock_take(&dev->lock);
dev->driver->reclaim_buffers_idlelocked(dev, filp);
dev->driver->reclaim_buffers_idlelocked(dev, file_priv);
drm_idlelock_release(&dev->lock);
}
if (drm_i_have_hw_lock(filp)) {
if (drm_i_have_hw_lock(file_priv)) {
DRM_DEBUG("File %p released, freeing lock for context %d\n",
filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
......@@ -394,7 +394,7 @@ int drm_release(struct inode *inode, struct file *filp)
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
!dev->driver->reclaim_buffers_locked) {
dev->driver->reclaim_buffers(dev, filp);
dev->driver->reclaim_buffers(dev, file_priv);
}
drm_fasync(-1, filp, 0);
......@@ -404,7 +404,7 @@ int drm_release(struct inode *inode, struct file *filp)
struct drm_ctx_list *pos, *n;
list_for_each_entry_safe(pos, n, &dev->ctxlist, head) {
if (pos->tag == priv &&
if (pos->tag == file_priv &&
pos->handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor)
dev->driver->context_dtor(dev,
......@@ -421,18 +421,18 @@ int drm_release(struct inode *inode, struct file *filp)
mutex_unlock(&dev->ctxlist_mutex);
mutex_lock(&dev->struct_mutex);
if (priv->remove_auth_on_close == 1) {
if (file_priv->remove_auth_on_close == 1) {
struct drm_file *temp;
list_for_each_entry(temp, &dev->filelist, lhead)
temp->authenticated = 0;
}
list_del(&priv->lhead);
list_del(&file_priv->lhead);
mutex_unlock(&dev->struct_mutex);
if (dev->driver->postclose)
dev->driver->postclose(dev, priv);
drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
dev->driver->postclose(dev, file_priv);
drm_free(file_priv, sizeof(*file_priv), DRM_MEM_FILES);
/* ========================================================
* End inline drm_release
......
......@@ -1040,7 +1040,7 @@ drm_ioctl_compat_t *drm_compat_ioctls[] = {
* Called whenever a 32-bit process running under a 64-bit kernel
* performs an ioctl on /dev/drm.
*
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument.
* \return zero on success or negative number on failure.
......
......@@ -42,18 +42,17 @@
* Get the bus id.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_unique structure.
* \return zero on success or a negative number on failure.
*
* Copies the bus id from drm_device::unique into user space.
*/
int drm_getunique(struct inode *inode, struct file *filp,
int drm_getunique(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_unique __user *argp = (void __user *)arg;
struct drm_unique u;
......@@ -73,7 +72,7 @@ int drm_getunique(struct inode *inode, struct file *filp,
* Set the bus id.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_unique structure.
* \return zero on success or a negative number on failure.
......@@ -83,11 +82,10 @@ int drm_getunique(struct inode *inode, struct file *filp,
* in interface version 1.1 and will return EBUSY when setversion has requested
* version 1.1 or greater.
*/
int drm_setunique(struct inode *inode, struct file *filp,
int drm_setunique(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_unique u;
int domain, bus, slot, func, ret;
......@@ -172,7 +170,7 @@ static int drm_set_busid(struct drm_device * dev)
* Get a mapping information.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_map structure.
*
......@@ -181,11 +179,10 @@ static int drm_set_busid(struct drm_device * dev)
* Searches for the mapping with the specified offset and copies its information
* into userspace
*/
int drm_getmap(struct inode *inode, struct file *filp,
int drm_getmap(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_map __user *argp = (void __user *)arg;
struct drm_map map;
struct drm_map_list *r_list = NULL;
......@@ -233,7 +230,7 @@ int drm_getmap(struct inode *inode, struct file *filp,
* Get client information.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_client structure.
*
......@@ -242,11 +239,10 @@ int drm_getmap(struct inode *inode, struct file *filp,
* Searches for the client with the specified index and copies its information
* into userspace
*/
int drm_getclient(struct inode *inode, struct file *filp,
int drm_getclient(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_client __user *argp = (struct drm_client __user *)arg;
struct drm_client client;
struct drm_file *pt;
......@@ -285,17 +281,16 @@ int drm_getclient(struct inode *inode, struct file *filp,
* Get statistics information.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_stats structure.
*
* \return zero on success or a negative number on failure.
*/
int drm_getstats(struct inode *inode, struct file *filp,
int drm_getstats(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_stats stats;
int i;
......@@ -325,7 +320,7 @@ int drm_getstats(struct inode *inode, struct file *filp,
* Setversion ioctl.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_lock structure.
* \return zero on success or negative number on failure.
......@@ -381,7 +376,7 @@ int drm_setversion(DRM_IOCTL_ARGS)
}
/** No-op ioctl. */
int drm_noop(struct inode *inode, struct file *filp, unsigned int cmd,
int drm_noop(struct inode *inode, struct drm_file *file_priv, unsigned int cmd,
unsigned long arg)
{
DRM_DEBUG("\n");
......
......@@ -41,7 +41,7 @@
* Get interrupt from bus id.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_irq_busid structure.
* \return zero on success or a negative number on failure.
......@@ -50,11 +50,10 @@
* This IOCTL is deprecated, and will now return EINVAL for any busid not equal
* to that of the device that this DRM instance attached to.
*/
int drm_irq_by_busid(struct inode *inode, struct file *filp,
int drm_irq_by_busid(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_irq_busid __user *argp = (void __user *)arg;
struct drm_irq_busid p;
......@@ -187,18 +186,17 @@ EXPORT_SYMBOL(drm_irq_uninstall);
* IRQ control ioctl.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_control structure.
* \return zero on success or a negative number on failure.
*
* Calls irq_install() or irq_uninstall() according to \p arg.
*/
int drm_control(struct inode *inode, struct file *filp,
int drm_control(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
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 */
......@@ -227,7 +225,7 @@ int drm_control(struct inode *inode, struct file *filp,
* Wait for VBLANK.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param data user argument, pointing to a drm_wait_vblank structure.
* \return zero on success or a negative number on failure.
......@@ -244,8 +242,7 @@ int drm_control(struct inode *inode, struct file *filp,
*/
int drm_wait_vblank(DRM_IOCTL_ARGS)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
union drm_wait_vblank __user *argp = (void __user *)data;
union drm_wait_vblank vblwait;
struct timeval now;
......
......@@ -41,23 +41,22 @@ static int drm_notifier(void *priv);
* Lock ioctl.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_lock structure.
* \return zero on success or negative number on failure.
*
* Add the current task to the lock wait queue, and attempt to take to lock.
*/
int drm_lock(struct inode *inode, struct file *filp,
int drm_lock(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
DECLARE_WAITQUEUE(entry, current);
struct drm_lock lock;
int ret = 0;
++priv->lock_count;
++file_priv->lock_count;
if (copy_from_user(&lock, (struct drm_lock __user *) arg, sizeof(lock)))
return -EFAULT;
......@@ -88,7 +87,7 @@ int drm_lock(struct inode *inode, struct file *filp,
break;
}
if (drm_lock_take(&dev->lock, lock.context)) {
dev->lock.filp = filp;
dev->lock.file_priv = file_priv;
dev->lock.lock_time = jiffies;
atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
break; /* Got lock */
......@@ -142,18 +141,17 @@ int drm_lock(struct inode *inode, struct file *filp,
* Unlock ioctl.
*
* \param inode device inode.
* \param filp file pointer.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_lock structure.
* \return zero on success or negative number on failure.
*
* Transfer and free the lock.
*/
int drm_unlock(struct inode *inode, struct file *filp,
int drm_unlock(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_lock lock;
unsigned long irqflags;
......@@ -257,7 +255,7 @@ static int drm_lock_transfer(struct drm_lock_data *lock_data,
unsigned int old, new, prev;
volatile unsigned int *lock = &lock_data->hw_lock->lock;
lock_data->filp = NULL;
lock_data->file_priv = NULL;
do {
old = *lock;
new = context | _DRM_LOCK_HELD;
......@@ -390,13 +388,13 @@ void drm_idlelock_release(struct drm_lock_data *lock_data)
EXPORT_SYMBOL(drm_idlelock_release);
int drm_i_have_hw_lock(struct file *filp)
int drm_i_have_hw_lock(struct drm_file *file_priv)
{
DRM_DEVICE;
return (priv->lock_count && dev->lock.hw_lock &&
return (file_priv->lock_count && dev->lock.hw_lock &&
_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&
dev->lock.filp == filp);
dev->lock.file_priv == file_priv);
}
EXPORT_SYMBOL(drm_i_have_hw_lock);
......@@ -6,10 +6,8 @@
#include <linux/interrupt.h> /* For task queue support */
#include <linux/delay.h>
/** File pointer type */
#define DRMFILE struct file *
/** Ioctl arguments */
#define DRM_IOCTL_ARGS struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data
#define DRM_IOCTL_ARGS struct inode *inode, struct drm_file *file_priv, unsigned int cmd, unsigned long data
/** Current process ID */
#define DRM_CURRENTPID current->pid
#define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
......@@ -33,8 +31,7 @@
/** Read/write memory barrier */
#define DRM_MEMORYBARRIER() mb()
/** DRM device local declaration */
#define DRM_DEVICE struct drm_file *priv = filp->private_data; \
struct drm_device *dev = priv->head->dev
#define DRM_DEVICE struct drm_device *dev = file_priv->head->dev
/** IRQ handler arguments and return type and values */
#define DRM_IRQ_ARGS int irq, void *arg
......@@ -93,8 +90,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
#define DRM_GET_USER_UNCHECKED(val, uaddr) \
__get_user(val, uaddr)
#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data
#define DRM_HZ HZ
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
......
......@@ -62,11 +62,10 @@ void drm_sg_cleanup(struct drm_sg_mem * entry)
# define ScatterHandle(x) (unsigned int)(x)
#endif
int drm_sg_alloc(struct inode *inode, struct file *filp,
int drm_sg_alloc(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_scatter_gather __user *argp = (void __user *)arg;
struct drm_scatter_gather request;
struct drm_sg_mem *entry;
......@@ -198,11 +197,10 @@ int drm_sg_alloc(struct inode *inode, struct file *filp,
return -ENOMEM;
}
int drm_sg_free(struct inode *inode, struct file *filp,
int drm_sg_free(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
struct drm_scatter_gather request;
struct drm_sg_mem *entry;
......
......@@ -463,7 +463,7 @@ static void drm_vm_close(struct vm_area_struct *vma)
/**
* mmap DMA memory.
*
* \param filp file pointer.
* \param file_priv DRM file private.
* \param vma virtual memory area.
* \return zero on success or a negative number on failure.
*
......@@ -533,7 +533,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
/**
* mmap DMA memory.
*
* \param filp file pointer.
* \param file_priv DRM file private.
* \param vma virtual memory area.
* \return zero on success or a negative number on failure.
*
......
This diff is collapsed.
......@@ -117,12 +117,13 @@ typedef struct drm_i810_private {
/* i810_dma.c */
extern int i810_driver_dma_quiescent(struct drm_device * dev);
extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev,
struct file *filp);
struct drm_file *file_priv);
extern int i810_driver_load(struct drm_device *, unsigned long flags);
extern void i810_driver_lastclose(struct drm_device * dev);
extern void i810_driver_preclose(struct drm_device * dev, DRMFILE filp);
extern void i810_driver_preclose(struct drm_device * dev,
struct drm_file *file_priv);
extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev,
struct file *filp);
struct drm_file *file_priv);
extern int i810_driver_device_is_agp(struct drm_device * dev);
extern drm_ioctl_desc_t i810_ioctls[];
......
This diff is collapsed.
......@@ -126,9 +126,9 @@ extern drm_ioctl_desc_t i830_ioctls[];
extern int i830_max_ioctl;
/* i830_irq.c */
extern int i830_irq_emit(struct inode *inode, struct file *filp,
extern int i830_irq_emit(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg);
extern int i830_irq_wait(struct inode *inode, struct file *filp,
extern int i830_irq_wait(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg);
extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS);
......@@ -136,10 +136,11 @@ extern void i830_driver_irq_preinstall(struct drm_device * dev);
extern void i830_driver_irq_postinstall(struct drm_device * dev);
extern void i830_driver_irq_uninstall(struct drm_device * dev);
extern int i830_driver_load(struct drm_device *, unsigned long flags);
extern void i830_driver_preclose(struct drm_device * dev, DRMFILE filp);
extern void i830_driver_preclose(struct drm_device * dev,
struct drm_file *file_priv);
extern void i830_driver_lastclose(struct drm_device * dev);
extern void i830_driver_reclaim_buffers_locked(struct drm_device * dev,
struct file *filp);
struct drm_file *file_priv);
extern int i830_driver_dma_quiescent(struct drm_device * dev);
extern int i830_driver_device_is_agp(struct drm_device * dev);
......
......@@ -114,16 +114,15 @@ static int i830_wait_irq(struct drm_device * dev, int irq_nr)
/* Needs the lock as it touches the ring.
*/
int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
int i830_irq_emit(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
drm_i830_private_t *dev_priv = dev->dev_private;
drm_i830_irq_emit_t emit;
int result;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
......@@ -146,11 +145,10 @@ int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd,
/* Doesn't need the hardware lock.
*/
int i830_irq_wait(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
int i830_irq_wait(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_device *dev = file_priv->head->dev;
drm_i830_private_t *dev_priv = dev->dev_private;
drm_i830_irq_wait_t irqwait;
......
......@@ -602,7 +602,7 @@ static int i915_flush_ioctl(DRM_IOCTL_ARGS)
{
DRM_DEVICE;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
return i915_quiescent(dev);
}
......@@ -628,7 +628,7 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS)
DRM_DEBUG("i915 batchbuffer, start %x used %d cliprects %d\n",
batch.start, batch.used, batch.num_cliprects);
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (batch.num_cliprects && DRM_VERIFYAREA_READ(batch.cliprects,
batch.num_cliprects *
......@@ -657,7 +657,7 @@ static int i915_cmdbuffer(DRM_IOCTL_ARGS)
DRM_DEBUG("i915 cmdbuffer, buf %p sz %d cliprects %d\n",
cmdbuf.buf, cmdbuf.sz, cmdbuf.num_cliprects);
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (cmdbuf.num_cliprects &&
DRM_VERIFYAREA_READ(cmdbuf.cliprects,
......@@ -683,7 +683,7 @@ static int i915_flip_bufs(DRM_IOCTL_ARGS)
DRM_DEBUG("%s\n", __FUNCTION__);
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
return i915_dispatch_flip(dev);
}
......@@ -821,11 +821,11 @@ void i915_driver_lastclose(struct drm_device * dev)
i915_dma_cleanup(dev);
}
void i915_driver_preclose(struct drm_device * dev, DRMFILE filp)
void i915_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
{
if (dev->dev_private) {
drm_i915_private_t *dev_priv = dev->dev_private;
i915_mem_release(dev, filp, dev_priv->agp_heap);
i915_mem_release(dev, file_priv, dev_priv->agp_heap);
}
}
......
......@@ -70,7 +70,7 @@ struct mem_block {
struct mem_block *prev;
int start;
int size;
DRMFILE filp; /* 0: free, -1: heap, other: real files */
struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
};
typedef struct _drm_i915_vbl_swap {
......@@ -123,7 +123,8 @@ extern int i915_max_ioctl;
extern void i915_kernel_lost_context(struct drm_device * dev);
extern int i915_driver_load(struct drm_device *, unsigned long flags);
extern void i915_driver_lastclose(struct drm_device * dev);
extern void i915_driver_preclose(struct drm_device * dev, DRMFILE filp);
extern void i915_driver_preclose(struct drm_device *dev,
struct drm_file *file_priv);
extern int i915_driver_device_is_agp(struct drm_device * dev);
extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg);
......@@ -149,7 +150,7 @@ extern int i915_mem_init_heap(DRM_IOCTL_ARGS);
extern int i915_mem_destroy_heap(DRM_IOCTL_ARGS);
extern void i915_mem_takedown(struct mem_block **heap);
extern void i915_mem_release(struct drm_device * dev,
DRMFILE filp, struct mem_block *heap);
struct drm_file *file_priv, struct mem_block *heap);
#define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg))
#define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, (reg), (val))
......
......@@ -362,7 +362,7 @@ int i915_irq_emit(DRM_IOCTL_ARGS)
drm_i915_irq_emit_t emit;
int result;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
......
......@@ -89,7 +89,7 @@ static void mark_block(struct drm_device * dev, struct mem_block *p, int in_use)
*/
static struct mem_block *split_block(struct mem_block *p, int start, int size,
DRMFILE filp)
struct drm_file *file_priv)
{
/* Maybe cut off the start of an existing block */
if (start > p->start) {
......@@ -99,7 +99,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out;
newblock->start = start;
newblock->size = p->size - (start - p->start);
newblock->filp = NULL;
newblock->file_priv = NULL;
newblock->next = p->next;
newblock->prev = p;
p->next->prev = newblock;
......@@ -116,7 +116,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out;
newblock->start = start + size;
newblock->size = p->size - size;
newblock->filp = NULL;
newblock->file_priv = NULL;
newblock->next = p->next;
newblock->prev = p;
p->next->prev = newblock;
......@@ -126,20 +126,20 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
out:
/* Our block is in the middle */
p->filp = filp;
p->file_priv = file_priv;
return p;
}
static struct mem_block *alloc_block(struct mem_block *heap, int size,
int align2, DRMFILE filp)
int align2, struct drm_file *file_priv)
{
struct mem_block *p;
int mask = (1 << align2) - 1;
for (p = heap->next; p != heap; p = p->next) {
int start = (p->start + mask) & ~mask;
if (p->filp == NULL && start + size <= p->start + p->size)
return split_block(p, start, size, filp);
if (p->file_priv == NULL && start + size <= p->start + p->size)
return split_block(p, start, size, file_priv);
}
return NULL;
......@@ -158,12 +158,12 @@ static struct mem_block *find_block(struct mem_block *heap, int start)
static void free_block(struct mem_block *p)
{
p->filp = NULL;
p->file_priv = NULL;
/* Assumes a single contiguous range. Needs a special filp in
/* Assumes a single contiguous range. Needs a special file_priv in
* 'heap' to stop it being subsumed.
*/
if (p->next->filp == NULL) {
if (p->next->file_priv == NULL) {
struct mem_block *q = p->next;
p->size += q->size;
p->next = q->next;
......@@ -171,7 +171,7 @@ static void free_block(struct mem_block *p)
drm_free(q, sizeof(*q), DRM_MEM_BUFLISTS);
}
if (p->prev->filp == NULL) {
if (p->prev->file_priv == NULL) {
struct mem_block *q = p->prev;
q->size += p->size;
q->next = p->next;
......@@ -197,18 +197,19 @@ static int init_heap(struct mem_block **heap, int start, int size)
blocks->start = start;
blocks->size = size;
blocks->filp = NULL;
blocks->file_priv = NULL;
blocks->next = blocks->prev = *heap;
memset(*heap, 0, sizeof(**heap));
(*heap)->filp = (DRMFILE) - 1;
(*heap)->file_priv = (struct drm_file *) - 1;
(*heap)->next = (*heap)->prev = blocks;
return 0;
}
/* Free all blocks associated with the releasing file.
*/
void i915_mem_release(struct drm_device * dev, DRMFILE filp, struct mem_block *heap)
void i915_mem_release(struct drm_device * dev, struct drm_file *file_priv,
struct mem_block *heap)
{
struct mem_block *p;
......@@ -216,17 +217,17 @@ void i915_mem_release(struct drm_device * dev, DRMFILE filp, struct mem_block *h
return;
for (p = heap->next; p != heap; p = p->next) {
if (p->filp == filp) {
p->filp = NULL;
if (p->file_priv == file_priv) {
p->file_priv = NULL;
mark_block(dev, p, 0);
}
}
/* Assumes a single contiguous range. Needs a special filp in
/* Assumes a single contiguous range. Needs a special file_priv in
* 'heap' to stop it being subsumed.
*/
for (p = heap->next; p != heap; p = p->next) {
while (p->filp == NULL && p->next->filp == NULL) {
while (p->file_priv == NULL && p->next->file_priv == NULL) {
struct mem_block *q = p->next;
p->size += q->size;
p->next = q->next;
......@@ -292,7 +293,7 @@ int i915_mem_alloc(DRM_IOCTL_ARGS)
if (alloc.alignment < 12)
alloc.alignment = 12;
block = alloc_block(*heap, alloc.size, alloc.alignment, filp);
block = alloc_block(*heap, alloc.size, alloc.alignment, file_priv);
if (!block)
return -ENOMEM;
......@@ -330,7 +331,7 @@ int i915_mem_free(DRM_IOCTL_ARGS)
if (!block)
return -EFAULT;
if (block->filp != filp)
if (block->file_priv != file_priv)
return -EPERM;
mark_block(dev, block, 0);
......
......@@ -1013,7 +1013,7 @@ int mga_dma_init(DRM_IOCTL_ARGS)
drm_mga_init_t init;
int err;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(init, (drm_mga_init_t __user *) data,
sizeof(init));
......@@ -1042,7 +1042,7 @@ int mga_dma_flush(DRM_IOCTL_ARGS)
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
struct drm_lock lock;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(lock, (struct drm_lock __user *) data,
sizeof(lock));
......@@ -1077,7 +1077,7 @@ int mga_dma_reset(DRM_IOCTL_ARGS)
DRM_DEVICE;
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
return mga_do_dma_reset(dev_priv);
}
......@@ -1086,7 +1086,8 @@ int mga_dma_reset(DRM_IOCTL_ARGS)
* DMA buffer management
*/
static int mga_dma_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm_dma * d)
static int mga_dma_get_buffers(struct drm_device * dev,
struct drm_file *file_priv, struct drm_dma * d)
{
struct drm_buf *buf;
int i;
......@@ -1096,7 +1097,7 @@ static int mga_dma_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm
if (!buf)
return -EAGAIN;
buf->filp = filp;
buf->file_priv = file_priv;
if (DRM_COPY_TO_USER(&d->request_indices[i],
&buf->idx, sizeof(buf->idx)))
......@@ -1119,7 +1120,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS)
struct drm_dma d;
int ret = 0;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(d, argp, sizeof(d));
......@@ -1144,7 +1145,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS)
d.granted_count = 0;
if (d.request_count) {
ret = mga_dma_get_buffers(filp, dev, &d);
ret = mga_dma_get_buffers(dev, file_priv, &d);
}
DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d));
......
......@@ -835,7 +835,7 @@ static int mga_dma_clear(DRM_IOCTL_ARGS)
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
drm_mga_clear_t clear;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(clear, (drm_mga_clear_t __user *) data,
sizeof(clear));
......@@ -860,7 +860,7 @@ static int mga_dma_swap(DRM_IOCTL_ARGS)
drm_mga_private_t *dev_priv = dev->dev_private;
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS)
sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
......@@ -885,7 +885,7 @@ static int mga_dma_vertex(DRM_IOCTL_ARGS)
drm_mga_buf_priv_t *buf_priv;
drm_mga_vertex_t vertex;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(vertex,
(drm_mga_vertex_t __user *) data,
......@@ -925,7 +925,7 @@ static int mga_dma_indices(DRM_IOCTL_ARGS)
drm_mga_buf_priv_t *buf_priv;
drm_mga_indices_t indices;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(indices,
(drm_mga_indices_t __user *) data,
......@@ -966,7 +966,7 @@ static int mga_dma_iload(DRM_IOCTL_ARGS)
drm_mga_iload_t iload;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(iload, (drm_mga_iload_t __user *) data,
sizeof(iload));
......@@ -1008,7 +1008,7 @@ static int mga_dma_blit(DRM_IOCTL_ARGS)
drm_mga_blit_t blit;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(blit, (drm_mga_blit_t __user *) data,
sizeof(blit));
......
......@@ -632,7 +632,7 @@ int r128_cce_init(DRM_IOCTL_ARGS)
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(init, (drm_r128_init_t __user *) data,
sizeof(init));
......@@ -653,7 +653,7 @@ int r128_cce_start(DRM_IOCTL_ARGS)
drm_r128_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4) {
DRM_DEBUG("%s while CCE running\n", __FUNCTION__);
......@@ -676,7 +676,7 @@ int r128_cce_stop(DRM_IOCTL_ARGS)
int ret;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(stop, (drm_r128_cce_stop_t __user *) data,
sizeof(stop));
......@@ -717,7 +717,7 @@ int r128_cce_reset(DRM_IOCTL_ARGS)
drm_r128_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) {
DRM_DEBUG("%s called before init done\n", __FUNCTION__);
......@@ -738,7 +738,7 @@ int r128_cce_idle(DRM_IOCTL_ARGS)
drm_r128_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (dev_priv->cce_running) {
r128_do_cce_flush(dev_priv);
......@@ -752,7 +752,7 @@ int r128_engine_reset(DRM_IOCTL_ARGS)
DRM_DEVICE;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
return r128_do_engine_reset(dev);
}
......@@ -828,7 +828,7 @@ static struct drm_buf *r128_freelist_get(struct drm_device * dev)
for (i = 0; i < dma->buf_count; i++) {
buf = dma->buflist[i];
buf_priv = buf->dev_private;
if (buf->filp == 0)
if (buf->file_priv == 0)
return buf;
}
......@@ -886,7 +886,9 @@ int r128_wait_ring(drm_r128_private_t * dev_priv, int n)
return -EBUSY;
}
static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm_dma * d)
static int r128_cce_get_buffers(struct drm_device * dev,
struct drm_file *file_priv,
struct drm_dma * d)
{
int i;
struct drm_buf *buf;
......@@ -896,7 +898,7 @@ static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct dr
if (!buf)
return -EAGAIN;
buf->filp = filp;
buf->file_priv = file_priv;
if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx,
sizeof(buf->idx)))
......@@ -918,7 +920,7 @@ int r128_cce_buffers(DRM_IOCTL_ARGS)
struct drm_dma __user *argp = (void __user *)data;
struct drm_dma d;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(d, argp, sizeof(d));
......@@ -941,7 +943,7 @@ int r128_cce_buffers(DRM_IOCTL_ARGS)
d.granted_count = 0;
if (d.request_count) {
ret = r128_cce_get_buffers(filp, dev, &d);
ret = r128_cce_get_buffers(dev, file_priv, &d);
}
DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d));
......
......@@ -156,7 +156,8 @@ extern void r128_driver_irq_preinstall(struct drm_device * dev);
extern void r128_driver_irq_postinstall(struct drm_device * dev);
extern void r128_driver_irq_uninstall(struct drm_device * dev);
extern void r128_driver_lastclose(struct drm_device * dev);
extern void r128_driver_preclose(struct drm_device * dev, DRMFILE filp);
extern void r128_driver_preclose(struct drm_device * dev,
struct drm_file *file_priv);
extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg);
......
......@@ -776,8 +776,9 @@ static void r128_cce_dispatch_indices(struct drm_device * dev,
sarea_priv->nbox = 0;
}
static int r128_cce_dispatch_blit(DRMFILE filp,
struct drm_device * dev, drm_r128_blit_t * blit)
static int r128_cce_dispatch_blit(struct drm_device * dev,
struct drm_file *file_priv,
drm_r128_blit_t * blit)
{
drm_r128_private_t *dev_priv = dev->dev_private;
struct drm_device_dma *dma = dev->dma;
......@@ -829,9 +830,9 @@ static int r128_cce_dispatch_blit(DRMFILE filp,
buf = dma->buflist[blit->idx];
buf_priv = buf->dev_private;
if (buf->filp != filp) {
if (buf->file_priv != file_priv) {
DRM_ERROR("process %d using buffer owned by %p\n",
DRM_CURRENTPID, buf->filp);
DRM_CURRENTPID, buf->file_priv);
return -EINVAL;
}
if (buf->pending) {
......@@ -1249,7 +1250,7 @@ static int r128_cce_clear(DRM_IOCTL_ARGS)
drm_r128_clear_t clear;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(clear, (drm_r128_clear_t __user *) data,
sizeof(clear));
......@@ -1315,7 +1316,7 @@ static int r128_cce_flip(DRM_IOCTL_ARGS)
drm_r128_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("%s\n", __FUNCTION__);
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
RING_SPACE_TEST_WITH_RETURN(dev_priv);
......@@ -1335,7 +1336,7 @@ static int r128_cce_swap(DRM_IOCTL_ARGS)
drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
DRM_DEBUG("%s\n", __FUNCTION__);
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
RING_SPACE_TEST_WITH_RETURN(dev_priv);
......@@ -1359,7 +1360,7 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS)
drm_r128_buf_priv_t *buf_priv;
drm_r128_vertex_t vertex;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
......@@ -1389,9 +1390,9 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS)
buf = dma->buflist[vertex.idx];
buf_priv = buf->dev_private;
if (buf->filp != filp) {
if (buf->file_priv != file_priv) {
DRM_ERROR("process %d using buffer owned by %p\n",
DRM_CURRENTPID, buf->filp);
DRM_CURRENTPID, buf->file_priv);
return -EINVAL;
}
if (buf->pending) {
......@@ -1419,7 +1420,7 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
drm_r128_indices_t elts;
int count;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
......@@ -1448,9 +1449,9 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
buf = dma->buflist[elts.idx];
buf_priv = buf->dev_private;
if (buf->filp != filp) {
if (buf->file_priv != file_priv) {
DRM_ERROR("process %d using buffer owned by %p\n",
DRM_CURRENTPID, buf->filp);
DRM_CURRENTPID, buf->file_priv);
return -EINVAL;
}
if (buf->pending) {
......@@ -1488,7 +1489,7 @@ static int r128_cce_blit(DRM_IOCTL_ARGS)
drm_r128_blit_t blit;
int ret;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(blit, (drm_r128_blit_t __user *) data,
sizeof(blit));
......@@ -1504,7 +1505,7 @@ static int r128_cce_blit(DRM_IOCTL_ARGS)
RING_SPACE_TEST_WITH_RETURN(dev_priv);
VB_AGE_TEST_WITH_RETURN(dev_priv);
ret = r128_cce_dispatch_blit(filp, dev, &blit);
ret = r128_cce_dispatch_blit(dev, file_priv, &blit);
COMMIT_RING();
return ret;
......@@ -1517,7 +1518,7 @@ static int r128_cce_depth(DRM_IOCTL_ARGS)
drm_r128_depth_t depth;
int ret;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(depth, (drm_r128_depth_t __user *) data,
sizeof(depth));
......@@ -1551,7 +1552,7 @@ static int r128_cce_stipple(DRM_IOCTL_ARGS)
drm_r128_stipple_t stipple;
u32 mask[32];
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(stipple, (drm_r128_stipple_t __user *) data,
sizeof(stipple));
......@@ -1579,7 +1580,7 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS)
RING_LOCALS;
#endif
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
......@@ -1601,9 +1602,9 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS)
buf = dma->buflist[indirect.idx];
buf_priv = buf->dev_private;
if (buf->filp != filp) {
if (buf->file_priv != file_priv) {
DRM_ERROR("process %d using buffer owned by %p\n",
DRM_CURRENTPID, buf->filp);
DRM_CURRENTPID, buf->file_priv);
return -EINVAL;
}
if (buf->pending) {
......@@ -1675,7 +1676,7 @@ static int r128_getparam(DRM_IOCTL_ARGS)
return 0;
}
void r128_driver_preclose(struct drm_device * dev, DRMFILE filp)
void r128_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
{
if (dev->dev_private) {
drm_r128_private_t *dev_priv = dev->dev_private;
......
......@@ -780,8 +780,7 @@ static int r300_scratch(drm_radeon_private_t *dev_priv,
* Called by the ioctl handler function radeon_cp_cmdbuf.
*/
int r300_do_cp_cmdbuf(struct drm_device *dev,
DRMFILE filp,
struct drm_file *filp_priv,
struct drm_file *file_priv,
drm_radeon_kcmd_buffer_t *cmdbuf)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
......@@ -884,9 +883,10 @@ int r300_do_cp_cmdbuf(struct drm_device *dev,
}
buf = dma->buflist[idx];
if (buf->filp != filp || buf->pending) {
if (buf->file_priv != file_priv || buf->pending) {
DRM_ERROR("bad buffer %p %p %d\n",
buf->filp, filp, buf->pending);
buf->file_priv, file_priv,
buf->pending);
ret = -EINVAL;
goto cleanup;
}
......
......@@ -1828,7 +1828,7 @@ int radeon_cp_init(DRM_IOCTL_ARGS)
DRM_DEVICE;
drm_radeon_init_t init;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(init, (drm_radeon_init_t __user *) data,
sizeof(init));
......@@ -1854,7 +1854,7 @@ int radeon_cp_start(DRM_IOCTL_ARGS)
drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (dev_priv->cp_running) {
DRM_DEBUG("%s while CP running\n", __FUNCTION__);
......@@ -1882,7 +1882,7 @@ int radeon_cp_stop(DRM_IOCTL_ARGS)
int ret;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(stop, (drm_radeon_cp_stop_t __user *) data,
sizeof(stop));
......@@ -1969,7 +1969,7 @@ int radeon_cp_reset(DRM_IOCTL_ARGS)
drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) {
DRM_DEBUG("%s called before init done\n", __FUNCTION__);
......@@ -1990,7 +1990,7 @@ int radeon_cp_idle(DRM_IOCTL_ARGS)
drm_radeon_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
return radeon_do_cp_idle(dev_priv);
}
......@@ -2009,7 +2009,7 @@ int radeon_engine_reset(DRM_IOCTL_ARGS)
DRM_DEVICE;
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
return radeon_do_engine_reset(dev);
}
......@@ -2066,8 +2066,9 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev)
for (i = start; i < dma->buf_count; i++) {
buf = dma->buflist[i];
buf_priv = buf->dev_private;
if (buf->filp == 0 || (buf->pending &&
buf_priv->age <= done_age)) {
if (buf->file_priv == NULL || (buf->pending &&
buf_priv->age <=
done_age)) {
dev_priv->stats.requested_bufs++;
buf->pending = 0;
return buf;
......@@ -2106,8 +2107,9 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev)
for (i = start; i < dma->buf_count; i++) {
buf = dma->buflist[i];
buf_priv = buf->dev_private;
if (buf->filp == 0 || (buf->pending &&
buf_priv->age <= done_age)) {
if (buf->file_priv == 0 || (buf->pending &&
buf_priv->age <=
done_age)) {
dev_priv->stats.requested_bufs++;
buf->pending = 0;
return buf;
......@@ -2170,7 +2172,8 @@ int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n)
return -EBUSY;
}
static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev,
static int radeon_cp_get_buffers(struct drm_device *dev,
struct drm_file *file_priv,
struct drm_dma * d)
{
int i;
......@@ -2181,7 +2184,7 @@ static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev,
if (!buf)
return -EBUSY; /* NOTE: broken client */
buf->filp = filp;
buf->file_priv = file_priv;
if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx,
sizeof(buf->idx)))
......@@ -2203,7 +2206,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
struct drm_dma __user *argp = (void __user *)data;
struct drm_dma d;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(d, argp, sizeof(d));
......@@ -2226,7 +2229,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
d.granted_count = 0;
if (d.request_count) {
ret = radeon_cp_get_buffers(filp, dev, &d);
ret = radeon_cp_get_buffers(dev, file_priv, &d);
}
DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d));
......
......@@ -188,7 +188,7 @@ struct mem_block {
struct mem_block *prev;
int start;
int size;
DRMFILE filp; /* 0: free, -1: heap, other: real files */
struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
};
struct radeon_surface {
......@@ -203,7 +203,7 @@ struct radeon_virt_surface {
u32 lower;
u32 upper;
u32 flags;
DRMFILE filp;
struct drm_file *file_priv;
};
typedef struct drm_radeon_private {
......@@ -351,7 +351,8 @@ extern int radeon_mem_alloc(DRM_IOCTL_ARGS);
extern int radeon_mem_free(DRM_IOCTL_ARGS);
extern int radeon_mem_init_heap(DRM_IOCTL_ARGS);
extern void radeon_mem_takedown(struct mem_block **heap);
extern void radeon_mem_release(DRMFILE filp, struct mem_block *heap);
extern void radeon_mem_release(struct drm_file *file_priv,
struct mem_block *heap);
/* radeon_irq.c */
extern int radeon_irq_emit(DRM_IOCTL_ARGS);
......@@ -372,7 +373,7 @@ extern int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value);
extern int radeon_driver_load(struct drm_device *dev, unsigned long flags);
extern int radeon_driver_unload(struct drm_device *dev);
extern int radeon_driver_firstopen(struct drm_device *dev);
extern void radeon_driver_preclose(struct drm_device * dev, DRMFILE filp);
extern void radeon_driver_preclose(struct drm_device * dev, struct drm_file *file_priv);
extern void radeon_driver_postclose(struct drm_device * dev, struct drm_file * filp);
extern void radeon_driver_lastclose(struct drm_device * dev);
extern int radeon_driver_open(struct drm_device * dev, struct drm_file * filp_priv);
......@@ -382,8 +383,8 @@ extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
/* r300_cmdbuf.c */
extern void r300_init_reg_flags(void);
extern int r300_do_cp_cmdbuf(struct drm_device * dev, DRMFILE filp,
struct drm_file * filp_priv,
extern int r300_do_cp_cmdbuf(struct drm_device * dev,
struct drm_file *file_priv,
drm_radeon_kcmd_buffer_t * cmdbuf);
/* Flags for stats.boxes
......
......@@ -203,7 +203,7 @@ int radeon_irq_emit(DRM_IOCTL_ARGS)
drm_radeon_irq_emit_t emit;
int result;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
......
......@@ -39,7 +39,7 @@
*/
static struct mem_block *split_block(struct mem_block *p, int start, int size,
DRMFILE filp)
struct drm_file *file_priv)
{
/* Maybe cut off the start of an existing block */
if (start > p->start) {
......@@ -49,7 +49,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out;
newblock->start = start;
newblock->size = p->size - (start - p->start);
newblock->filp = NULL;
newblock->file_priv = NULL;
newblock->next = p->next;
newblock->prev = p;
p->next->prev = newblock;
......@@ -66,7 +66,7 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
goto out;
newblock->start = start + size;
newblock->size = p->size - size;
newblock->filp = NULL;
newblock->file_priv = NULL;
newblock->next = p->next;
newblock->prev = p;
p->next->prev = newblock;
......@@ -76,20 +76,20 @@ static struct mem_block *split_block(struct mem_block *p, int start, int size,
out:
/* Our block is in the middle */
p->filp = filp;
p->file_priv = file_priv;
return p;
}
static struct mem_block *alloc_block(struct mem_block *heap, int size,
int align2, DRMFILE filp)
int align2, struct drm_file *file_priv)
{
struct mem_block *p;
int mask = (1 << align2) - 1;
list_for_each(p, heap) {
int start = (p->start + mask) & ~mask;
if (p->filp == 0 && start + size <= p->start + p->size)
return split_block(p, start, size, filp);
if (p->file_priv == 0 && start + size <= p->start + p->size)
return split_block(p, start, size, file_priv);
}
return NULL;
......@@ -108,12 +108,12 @@ static struct mem_block *find_block(struct mem_block *heap, int start)
static void free_block(struct mem_block *p)
{
p->filp = NULL;
p->file_priv = NULL;
/* Assumes a single contiguous range. Needs a special filp in
/* Assumes a single contiguous range. Needs a special file_priv in
* 'heap' to stop it being subsumed.
*/
if (p->next->filp == 0) {
if (p->next->file_priv == 0) {
struct mem_block *q = p->next;
p->size += q->size;
p->next = q->next;
......@@ -121,7 +121,7 @@ static void free_block(struct mem_block *p)
drm_free(q, sizeof(*q), DRM_MEM_BUFS);
}
if (p->prev->filp == 0) {
if (p->prev->file_priv == 0) {
struct mem_block *q = p->prev;
q->size += p->size;
q->next = p->next;
......@@ -147,18 +147,18 @@ static int init_heap(struct mem_block **heap, int start, int size)
blocks->start = start;
blocks->size = size;
blocks->filp = NULL;
blocks->file_priv = NULL;
blocks->next = blocks->prev = *heap;
memset(*heap, 0, sizeof(**heap));
(*heap)->filp = (DRMFILE) - 1;
(*heap)->file_priv = (struct drm_file *) - 1;
(*heap)->next = (*heap)->prev = blocks;
return 0;
}
/* Free all blocks associated with the releasing file.
*/
void radeon_mem_release(DRMFILE filp, struct mem_block *heap)
void radeon_mem_release(struct drm_file *file_priv, struct mem_block *heap)
{
struct mem_block *p;
......@@ -166,15 +166,15 @@ void radeon_mem_release(DRMFILE filp, struct mem_block *heap)
return;
list_for_each(p, heap) {
if (p->filp == filp)
p->filp = NULL;
if (p->file_priv == file_priv)
p->file_priv = NULL;
}
/* Assumes a single contiguous range. Needs a special filp in
/* Assumes a single contiguous range. Needs a special file_priv in
* 'heap' to stop it being subsumed.
*/
list_for_each(p, heap) {
while (p->filp == 0 && p->next->filp == 0) {
while (p->file_priv == 0 && p->next->file_priv == 0) {
struct mem_block *q = p->next;
p->size += q->size;
p->next = q->next;
......@@ -242,7 +242,7 @@ int radeon_mem_alloc(DRM_IOCTL_ARGS)
if (alloc.alignment < 12)
alloc.alignment = 12;
block = alloc_block(*heap, alloc.size, alloc.alignment, filp);
block = alloc_block(*heap, alloc.size, alloc.alignment, file_priv);
if (!block)
return -ENOMEM;
......@@ -278,7 +278,7 @@ int radeon_mem_free(DRM_IOCTL_ARGS)
if (!block)
return -EFAULT;
if (block->filp != filp)
if (block->file_priv != file_priv)
return -EPERM;
free_block(block);
......
This diff is collapsed.
......@@ -933,7 +933,7 @@ static int savage_bci_init(DRM_IOCTL_ARGS)
DRM_DEVICE;
drm_savage_init_t init;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(init, (drm_savage_init_t __user *) data,
sizeof(init));
......@@ -956,7 +956,7 @@ static int savage_bci_event_emit(DRM_IOCTL_ARGS)
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(event, (drm_savage_event_emit_t __user *) data,
sizeof(event));
......@@ -1007,7 +1007,9 @@ static int savage_bci_event_wait(DRM_IOCTL_ARGS)
* DMA buffer management
*/
static int savage_bci_get_buffers(DRMFILE filp, struct drm_device *dev, struct drm_dma *d)
static int savage_bci_get_buffers(struct drm_device *dev,
struct drm_file *file_priv,
struct drm_dma *d)
{
struct drm_buf *buf;
int i;
......@@ -1017,7 +1019,7 @@ static int savage_bci_get_buffers(DRMFILE filp, struct drm_device *dev, struct d
if (!buf)
return -EAGAIN;
buf->filp = filp;
buf->file_priv = file_priv;
if (DRM_COPY_TO_USER(&d->request_indices[i],
&buf->idx, sizeof(buf->idx)))
......@@ -1038,7 +1040,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS)
struct drm_dma d;
int ret = 0;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(d, (struct drm_dma __user *) data, sizeof(d));
......@@ -1061,7 +1063,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS)
d.granted_count = 0;
if (d.request_count) {
ret = savage_bci_get_buffers(filp, dev, &d);
ret = savage_bci_get_buffers(dev, file_priv, &d);
}
DRM_COPY_TO_USER_IOCTL((struct drm_dma __user *) data, d, sizeof(d));
......@@ -1069,7 +1071,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS)
return ret;
}
void savage_reclaim_buffers(struct drm_device *dev, DRMFILE filp)
void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)
{
struct drm_device_dma *dma = dev->dma;
drm_savage_private_t *dev_priv = dev->dev_private;
......@@ -1088,7 +1090,7 @@ void savage_reclaim_buffers(struct drm_device *dev, DRMFILE filp)
struct drm_buf *buf = dma->buflist[i];
drm_savage_buf_priv_t *buf_priv = buf->dev_private;
if (buf->filp == filp && buf_priv &&
if (buf->file_priv == file_priv && buf_priv &&
buf_priv->next == NULL && buf_priv->prev == NULL) {
uint16_t event;
DRM_DEBUG("reclaimed from client\n");
......@@ -1098,7 +1100,7 @@ void savage_reclaim_buffers(struct drm_device *dev, DRMFILE filp)
}
}
drm_core_reclaim_buffers(dev, filp);
drm_core_reclaim_buffers(dev, file_priv);
}
drm_ioctl_desc_t savage_ioctls[] = {
......
......@@ -212,7 +212,8 @@ extern int savage_driver_load(struct drm_device *dev, unsigned long chipset);
extern int savage_driver_firstopen(struct drm_device *dev);
extern void savage_driver_lastclose(struct drm_device *dev);
extern int savage_driver_unload(struct drm_device *dev);
extern void savage_reclaim_buffers(struct drm_device * dev, DRMFILE filp);
extern void savage_reclaim_buffers(struct drm_device *dev,
struct drm_file *file_priv);
/* state functions */
extern void savage_emit_clip_rect_s3d(drm_savage_private_t * dev_priv,
......
......@@ -969,7 +969,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS)
DRM_DEBUG("\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_savage_cmdbuf_t __user *) data,
sizeof(cmdbuf));
......
......@@ -63,7 +63,8 @@ typedef struct drm_sis_private {
} drm_sis_private_t;
extern int sis_idle(struct drm_device *dev);
extern void sis_reclaim_buffers_locked(struct drm_device *dev, struct file *filp);
extern void sis_reclaim_buffers_locked(struct drm_device *dev,
struct drm_file *file_priv);
extern void sis_lastclose(struct drm_device *dev);
extern drm_ioctl_desc_t sis_ioctls[];
......
......@@ -123,7 +123,7 @@ static int sis_fb_init(DRM_IOCTL_ARGS)
return 0;
}
static int sis_drm_alloc(struct drm_device *dev, struct drm_file * priv,
static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file_priv,
unsigned long data, int pool)
{
drm_sis_private_t *dev_priv = dev->dev_private;
......@@ -145,7 +145,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file * priv,
mem.size = (mem.size + SIS_MM_ALIGN_MASK) >> SIS_MM_ALIGN_SHIFT;
item = drm_sman_alloc(&dev_priv->sman, pool, mem.size, 0,
(unsigned long)priv);
(unsigned long)file_priv);
mutex_unlock(&dev->struct_mutex);
if (item) {
......@@ -191,7 +191,7 @@ static int sis_drm_free(DRM_IOCTL_ARGS)
static int sis_fb_alloc(DRM_IOCTL_ARGS)
{
DRM_DEVICE;
return sis_drm_alloc(dev, priv, data, VIDEO_TYPE);
return sis_drm_alloc(dev, file_priv, data, VIDEO_TYPE);
}
static int sis_ioctl_agp_init(DRM_IOCTL_ARGS)
......@@ -226,7 +226,7 @@ static int sis_ioctl_agp_alloc(DRM_IOCTL_ARGS)
{
DRM_DEVICE;
return sis_drm_alloc(dev, priv, data, AGP_TYPE);
return sis_drm_alloc(dev, file_priv, data, AGP_TYPE);
}
static drm_local_map_t *sis_reg_init(struct drm_device *dev)
......@@ -314,13 +314,13 @@ void sis_lastclose(struct drm_device *dev)
mutex_unlock(&dev->struct_mutex);
}
void sis_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
void sis_reclaim_buffers_locked(struct drm_device * dev,
struct drm_file *file_priv)
{
drm_sis_private_t *dev_priv = dev->dev_private;
struct drm_file *priv = filp->private_data;
mutex_lock(&dev->struct_mutex);
if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)priv)) {
if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)file_priv)) {
mutex_unlock(&dev->struct_mutex);
return;
}
......@@ -329,7 +329,7 @@ void sis_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
dev->driver->dma_quiescent(dev);
}
drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)priv);
drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)file_priv);
mutex_unlock(&dev->struct_mutex);
return;
}
......
......@@ -330,7 +330,7 @@ static int via_flush_ioctl(DRM_IOCTL_ARGS)
{
DRM_DEVICE;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
return via_driver_dma_quiescent(dev);
}
......@@ -341,7 +341,7 @@ static int via_cmdbuffer(DRM_IOCTL_ARGS)
drm_via_cmdbuffer_t cmdbuf;
int ret;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_via_cmdbuffer_t __user *) data,
sizeof(cmdbuf));
......@@ -386,7 +386,7 @@ static int via_pci_cmdbuffer(DRM_IOCTL_ARGS)
drm_via_cmdbuffer_t cmdbuf;
int ret;
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_via_cmdbuffer_t __user *) data,
sizeof(cmdbuf));
......@@ -662,7 +662,7 @@ static int via_cmdbuf_size(DRM_IOCTL_ARGS)
drm_via_private_t *dev_priv;
DRM_DEBUG("via cmdbuf_size\n");
LOCK_TEST_WITH_RETURN(dev, filp);
LOCK_TEST_WITH_RETURN(dev, file_priv);
dev_priv = (drm_via_private_t *) dev->dev_private;
......
......@@ -144,7 +144,7 @@ extern void via_init_futex(drm_via_private_t * dev_priv);
extern void via_cleanup_futex(drm_via_private_t * dev_priv);
extern void via_release_futex(drm_via_private_t * dev_priv, int context);
extern void via_reclaim_buffers_locked(struct drm_device *dev, struct file *filp);
extern void via_reclaim_buffers_locked(struct drm_device *dev, struct drm_file *file_priv);
extern void via_lastclose(struct drm_device *dev);
extern void via_dmablit_handler(struct drm_device *dev, int engine, int from_irq);
......
......@@ -149,7 +149,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS)
tmpSize = (mem.size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT;
item = drm_sman_alloc(&dev_priv->sman, mem.type, tmpSize, 0,
(unsigned long)priv);
(unsigned long)file_priv);
mutex_unlock(&dev->struct_mutex);
if (item) {
mem.offset = ((mem.type == VIA_MEM_VIDEO) ?
......@@ -188,13 +188,13 @@ int via_mem_free(DRM_IOCTL_ARGS)
}
void via_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
void via_reclaim_buffers_locked(struct drm_device * dev,
struct drm_file *file_priv)
{
drm_via_private_t *dev_priv = dev->dev_private;
struct drm_file *priv = filp->private_data;
mutex_lock(&dev->struct_mutex);
if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)priv)) {
if (drm_sman_owner_clean(&dev_priv->sman, (unsigned long)file_priv)) {
mutex_unlock(&dev->struct_mutex);
return;
}
......@@ -203,7 +203,7 @@ void via_reclaim_buffers_locked(struct drm_device * dev, struct file *filp)
dev->driver->dma_quiescent(dev);
}
drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)priv);
drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)file_priv);
mutex_unlock(&dev->struct_mutex);
return;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment