summaryrefslogtreecommitdiff
path: root/linux-core/drm_ioctl.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-05-26 04:26:24 +1000
committerDave Airlie <airlied@linux.ie>2007-05-26 04:26:24 +1000
commit7b48f0022a24bc5f565ae64b450dda77dee616c1 (patch)
treebefe9424d3da96b792edce5ee0d2c2594f4273b7 /linux-core/drm_ioctl.c
parentea98d7e79657469545b865a353784d79fc8cff9d (diff)
drm: cleanup use of Linux list handling macros
This makes the drms use of the list handling macros a lot cleaner and more along the lines of how they should be used.
Diffstat (limited to 'linux-core/drm_ioctl.c')
-rw-r--r--linux-core/drm_ioctl.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c
index f790a4b3..97df972f 100644
--- a/linux-core/drm_ioctl.c
+++ b/linux-core/drm_ioctl.c
@@ -199,7 +199,7 @@ int drm_getmap(struct inode *inode, struct file *filp,
}
i = 0;
- list_for_each(list, &dev->maplist->head) {
+ list_for_each(list, &dev->maplist) {
if (i == idx) {
r_list = list_entry(list, drm_map_list_t, head);
break;
@@ -252,12 +252,18 @@ int drm_getclient(struct inode *inode, struct file *filp,
return -EFAULT;
idx = client.idx;
mutex_lock(&dev->struct_mutex);
- for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) ;
-
- if (!pt) {
+
+ if (list_empty(&dev->filelist)) {
mutex_unlock(&dev->struct_mutex);
return -EINVAL;
}
+
+ i = 0;
+ list_for_each_entry(pt, &dev->filelist, lhead) {
+ if (i++ >= idx)
+ break;
+ }
+
client.auth = pt->authenticated;
client.pid = pt->pid;
client.uid = pt->uid;