diff options
author | Eric Anholt <eric@anholt.net> | 2007-08-25 06:23:09 -0400 |
---|---|---|
committer | Dave Airlie <airlied@optimus.(none)> | 2007-10-14 20:38:20 -0400 |
commit | 6c340eac0285f3d62406d2d902d0e96fbf2a5dc0 (patch) | |
tree | a92039951cb7eaced306cfff2bad6af0ac5257ad /drivers/char/drm/drm_drv.c | |
parent | 20caafa6ecb2487d9b223aa33e7cc704f912a758 (diff) |
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: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_drv.c')
-rw-r--r-- | drivers/char/drm/drm_drv.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c index 19994cd865de..e7809237c53d 100644 --- a/drivers/char/drm/drm_drv.c +++ b/drivers/char/drm/drm_drv.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #include "drmP.h" | 49 | #include "drmP.h" |
50 | #include "drm_core.h" | 50 | #include "drm_core.h" |
51 | 51 | ||
52 | static int drm_version(struct inode *inode, struct file *filp, | 52 | static int drm_version(struct inode *inode, struct drm_file *file_priv, |
53 | unsigned int cmd, unsigned long arg); | 53 | unsigned int cmd, unsigned long arg); |
54 | 54 | ||
55 | /** Ioctl table */ | 55 | /** Ioctl table */ |
@@ -224,7 +224,7 @@ int drm_lastclose(struct drm_device * dev) | |||
224 | 224 | ||
225 | if (dev->lock.hw_lock) { | 225 | if (dev->lock.hw_lock) { |
226 | dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */ | 226 | dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */ |
227 | dev->lock.filp = NULL; | 227 | dev->lock.file_priv = NULL; |
228 | wake_up_interruptible(&dev->lock.lock_queue); | 228 | wake_up_interruptible(&dev->lock.lock_queue); |
229 | } | 229 | } |
230 | mutex_unlock(&dev->struct_mutex); | 230 | mutex_unlock(&dev->struct_mutex); |
@@ -418,11 +418,10 @@ module_exit(drm_core_exit); | |||
418 | * | 418 | * |
419 | * Fills in the version information in \p arg. | 419 | * Fills in the version information in \p arg. |
420 | */ | 420 | */ |
421 | static int drm_version(struct inode *inode, struct file *filp, | 421 | static int drm_version(struct inode *inode, struct drm_file *file_priv, |
422 | unsigned int cmd, unsigned long arg) | 422 | unsigned int cmd, unsigned long arg) |
423 | { | 423 | { |
424 | struct drm_file *priv = filp->private_data; | 424 | struct drm_device *dev = file_priv->head->dev; |
425 | struct drm_device *dev = priv->head->dev; | ||
426 | struct drm_version __user *argp = (void __user *)arg; | 425 | struct drm_version __user *argp = (void __user *)arg; |
427 | struct drm_version version; | 426 | struct drm_version version; |
428 | int len; | 427 | int len; |
@@ -446,7 +445,7 @@ static int drm_version(struct inode *inode, struct file *filp, | |||
446 | * Called whenever a process performs an ioctl on /dev/drm. | 445 | * Called whenever a process performs an ioctl on /dev/drm. |
447 | * | 446 | * |
448 | * \param inode device inode. | 447 | * \param inode device inode. |
449 | * \param filp file pointer. | 448 | * \param file_priv DRM file private. |
450 | * \param cmd command. | 449 | * \param cmd command. |
451 | * \param arg user argument. | 450 | * \param arg user argument. |
452 | * \return zero on success or negative number on failure. | 451 | * \return zero on success or negative number on failure. |
@@ -457,8 +456,8 @@ static int drm_version(struct inode *inode, struct file *filp, | |||
457 | int drm_ioctl(struct inode *inode, struct file *filp, | 456 | int drm_ioctl(struct inode *inode, struct file *filp, |
458 | unsigned int cmd, unsigned long arg) | 457 | unsigned int cmd, unsigned long arg) |
459 | { | 458 | { |
460 | struct drm_file *priv = filp->private_data; | 459 | struct drm_file *file_priv = filp->private_data; |
461 | struct drm_device *dev = priv->head->dev; | 460 | struct drm_device *dev = file_priv->head->dev; |
462 | drm_ioctl_desc_t *ioctl; | 461 | drm_ioctl_desc_t *ioctl; |
463 | drm_ioctl_t *func; | 462 | drm_ioctl_t *func; |
464 | unsigned int nr = DRM_IOCTL_NR(cmd); | 463 | unsigned int nr = DRM_IOCTL_NR(cmd); |
@@ -466,12 +465,12 @@ int drm_ioctl(struct inode *inode, struct file *filp, | |||
466 | 465 | ||
467 | atomic_inc(&dev->ioctl_count); | 466 | atomic_inc(&dev->ioctl_count); |
468 | atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); | 467 | atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); |
469 | ++priv->ioctl_count; | 468 | ++file_priv->ioctl_count; |
470 | 469 | ||
471 | DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", | 470 | DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", |
472 | current->pid, cmd, nr, | 471 | current->pid, cmd, nr, |
473 | (long)old_encode_dev(priv->head->device), | 472 | (long)old_encode_dev(file_priv->head->device), |
474 | priv->authenticated); | 473 | file_priv->authenticated); |
475 | 474 | ||
476 | if ((nr >= DRM_CORE_IOCTL_COUNT) && | 475 | if ((nr >= DRM_CORE_IOCTL_COUNT) && |
477 | ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END))) | 476 | ((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END))) |
@@ -493,11 +492,11 @@ int drm_ioctl(struct inode *inode, struct file *filp, | |||
493 | DRM_DEBUG("no function\n"); | 492 | DRM_DEBUG("no function\n"); |
494 | retcode = -EINVAL; | 493 | retcode = -EINVAL; |
495 | } else if (((ioctl->flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN)) || | 494 | } else if (((ioctl->flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN)) || |
496 | ((ioctl->flags & DRM_AUTH) && !priv->authenticated) || | 495 | ((ioctl->flags & DRM_AUTH) && !file_priv->authenticated) || |
497 | ((ioctl->flags & DRM_MASTER) && !priv->master)) { | 496 | ((ioctl->flags & DRM_MASTER) && !file_priv->master)) { |
498 | retcode = -EACCES; | 497 | retcode = -EACCES; |
499 | } else { | 498 | } else { |
500 | retcode = func(inode, filp, cmd, arg); | 499 | retcode = func(inode, file_priv, cmd, arg); |
501 | } | 500 | } |
502 | 501 | ||
503 | err_i1: | 502 | err_i1: |