aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_fops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_fops.c')
-rw-r--r--drivers/char/drm/drm_fops.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c
index 7bc51bac450d..1100c51aa4d6 100644
--- a/drivers/char/drm/drm_fops.c
+++ b/drivers/char/drm/drm_fops.c
@@ -242,6 +242,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
242 242
243 memset(priv, 0, sizeof(*priv)); 243 memset(priv, 0, sizeof(*priv));
244 filp->private_data = priv; 244 filp->private_data = priv;
245 priv->filp = filp;
245 priv->uid = current->euid; 246 priv->uid = current->euid;
246 priv->pid = current->pid; 247 priv->pid = current->pid;
247 priv->minor = minor; 248 priv->minor = minor;
@@ -312,7 +313,7 @@ EXPORT_SYMBOL(drm_fasync);
312 * Release file. 313 * Release file.
313 * 314 *
314 * \param inode device inode 315 * \param inode device inode
315 * \param filp file pointer. 316 * \param file_priv DRM file private.
316 * \return zero on success or a negative number on failure. 317 * \return zero on success or a negative number on failure.
317 * 318 *
318 * If the hardware lock is held then free it, and take it again for the kernel 319 * If the hardware lock is held then free it, and take it again for the kernel
@@ -322,29 +323,28 @@ EXPORT_SYMBOL(drm_fasync);
322 */ 323 */
323int drm_release(struct inode *inode, struct file *filp) 324int drm_release(struct inode *inode, struct file *filp)
324{ 325{
325 struct drm_file *priv = filp->private_data; 326 struct drm_file *file_priv = filp->private_data;
326 struct drm_device *dev; 327 struct drm_device *dev = file_priv->head->dev;
327 int retcode = 0; 328 int retcode = 0;
328 329
329 lock_kernel(); 330 lock_kernel();
330 dev = priv->head->dev;
331 331
332 DRM_DEBUG("open_count = %d\n", dev->open_count); 332 DRM_DEBUG("open_count = %d\n", dev->open_count);
333 333
334 if (dev->driver->preclose) 334 if (dev->driver->preclose)
335 dev->driver->preclose(dev, filp); 335 dev->driver->preclose(dev, file_priv);
336 336
337 /* ======================================================== 337 /* ========================================================
338 * Begin inline drm_release 338 * Begin inline drm_release
339 */ 339 */
340 340
341 DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", 341 DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
342 current->pid, (long)old_encode_dev(priv->head->device), 342 current->pid, (long)old_encode_dev(file_priv->head->device),
343 dev->open_count); 343 dev->open_count);
344 344
345 if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) { 345 if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) {
346 if (drm_i_have_hw_lock(filp)) { 346 if (drm_i_have_hw_lock(file_priv)) {
347 dev->driver->reclaim_buffers_locked(dev, filp); 347 dev->driver->reclaim_buffers_locked(dev, file_priv);
348 } else { 348 } else {
349 unsigned long _end=jiffies + 3*DRM_HZ; 349 unsigned long _end=jiffies + 3*DRM_HZ;
350 int locked = 0; 350 int locked = 0;
@@ -370,7 +370,7 @@ int drm_release(struct inode *inode, struct file *filp)
370 "\tI will go on reclaiming the buffers anyway.\n"); 370 "\tI will go on reclaiming the buffers anyway.\n");
371 } 371 }
372 372
373 dev->driver->reclaim_buffers_locked(dev, filp); 373 dev->driver->reclaim_buffers_locked(dev, file_priv);
374 drm_idlelock_release(&dev->lock); 374 drm_idlelock_release(&dev->lock);
375 } 375 }
376 } 376 }
@@ -378,12 +378,12 @@ int drm_release(struct inode *inode, struct file *filp)
378 if (dev->driver->reclaim_buffers_idlelocked && dev->lock.hw_lock) { 378 if (dev->driver->reclaim_buffers_idlelocked && dev->lock.hw_lock) {
379 379
380 drm_idlelock_take(&dev->lock); 380 drm_idlelock_take(&dev->lock);
381 dev->driver->reclaim_buffers_idlelocked(dev, filp); 381 dev->driver->reclaim_buffers_idlelocked(dev, file_priv);
382 drm_idlelock_release(&dev->lock); 382 drm_idlelock_release(&dev->lock);
383 383
384 } 384 }
385 385
386 if (drm_i_have_hw_lock(filp)) { 386 if (drm_i_have_hw_lock(file_priv)) {
387 DRM_DEBUG("File %p released, freeing lock for context %d\n", 387 DRM_DEBUG("File %p released, freeing lock for context %d\n",
388 filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); 388 filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
389 389
@@ -394,7 +394,7 @@ int drm_release(struct inode *inode, struct file *filp)
394 394
395 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && 395 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
396 !dev->driver->reclaim_buffers_locked) { 396 !dev->driver->reclaim_buffers_locked) {
397 dev->driver->reclaim_buffers(dev, filp); 397 dev->driver->reclaim_buffers(dev, file_priv);
398 } 398 }
399 399
400 drm_fasync(-1, filp, 0); 400 drm_fasync(-1, filp, 0);
@@ -404,7 +404,7 @@ int drm_release(struct inode *inode, struct file *filp)
404 struct drm_ctx_list *pos, *n; 404 struct drm_ctx_list *pos, *n;
405 405
406 list_for_each_entry_safe(pos, n, &dev->ctxlist, head) { 406 list_for_each_entry_safe(pos, n, &dev->ctxlist, head) {
407 if (pos->tag == priv && 407 if (pos->tag == file_priv &&
408 pos->handle != DRM_KERNEL_CONTEXT) { 408 pos->handle != DRM_KERNEL_CONTEXT) {
409 if (dev->driver->context_dtor) 409 if (dev->driver->context_dtor)
410 dev->driver->context_dtor(dev, 410 dev->driver->context_dtor(dev,
@@ -421,18 +421,18 @@ int drm_release(struct inode *inode, struct file *filp)
421 mutex_unlock(&dev->ctxlist_mutex); 421 mutex_unlock(&dev->ctxlist_mutex);
422 422
423 mutex_lock(&dev->struct_mutex); 423 mutex_lock(&dev->struct_mutex);
424 if (priv->remove_auth_on_close == 1) { 424 if (file_priv->remove_auth_on_close == 1) {
425 struct drm_file *temp; 425 struct drm_file *temp;
426 426
427 list_for_each_entry(temp, &dev->filelist, lhead) 427 list_for_each_entry(temp, &dev->filelist, lhead)
428 temp->authenticated = 0; 428 temp->authenticated = 0;
429 } 429 }
430 list_del(&priv->lhead); 430 list_del(&file_priv->lhead);
431 mutex_unlock(&dev->struct_mutex); 431 mutex_unlock(&dev->struct_mutex);
432 432
433 if (dev->driver->postclose) 433 if (dev->driver->postclose)
434 dev->driver->postclose(dev, priv); 434 dev->driver->postclose(dev, file_priv);
435 drm_free(priv, sizeof(*priv), DRM_MEM_FILES); 435 drm_free(file_priv, sizeof(*file_priv), DRM_MEM_FILES);
436 436
437 /* ======================================================== 437 /* ========================================================
438 * End inline drm_release 438 * End inline drm_release