diff options
author | Dave Airlie <airlied@linux.ie> | 2007-05-25 15:01:51 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2007-07-10 21:58:02 -0400 |
commit | bd1b331fae2813d9f03ceee649296f02edc0b893 (patch) | |
tree | 6139f72ebae88c332c754745f3d98cbe794ae4de /drivers/char/drm/drm_ioctl.c | |
parent | 4eb6bf6bfb580afaf1e1a1d30cba17a078530cf4 (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 and uses them
in some more places.
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_ioctl.c')
-rw-r--r-- | drivers/char/drm/drm_ioctl.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c index 565895547d75..96b982f1f4a4 100644 --- a/drivers/char/drm/drm_ioctl.c +++ b/drivers/char/drm/drm_ioctl.c | |||
@@ -204,7 +204,7 @@ int drm_getmap(struct inode *inode, struct file *filp, | |||
204 | } | 204 | } |
205 | 205 | ||
206 | i = 0; | 206 | i = 0; |
207 | list_for_each(list, &dev->maplist->head) { | 207 | list_for_each(list, &dev->maplist) { |
208 | if (i == idx) { | 208 | if (i == idx) { |
209 | r_list = list_entry(list, drm_map_list_t, head); | 209 | r_list = list_entry(list, drm_map_list_t, head); |
210 | break; | 210 | break; |
@@ -257,12 +257,18 @@ int drm_getclient(struct inode *inode, struct file *filp, | |||
257 | return -EFAULT; | 257 | return -EFAULT; |
258 | idx = client.idx; | 258 | idx = client.idx; |
259 | mutex_lock(&dev->struct_mutex); | 259 | mutex_lock(&dev->struct_mutex); |
260 | for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) ; | 260 | |
261 | 261 | if (list_empty(&dev->filelist)) { | |
262 | if (!pt) { | ||
263 | mutex_unlock(&dev->struct_mutex); | 262 | mutex_unlock(&dev->struct_mutex); |
264 | return -EINVAL; | 263 | return -EINVAL; |
265 | } | 264 | } |
265 | |||
266 | i = 0; | ||
267 | list_for_each_entry(pt, &dev->filelist, lhead) { | ||
268 | if (i++ >= idx) | ||
269 | break; | ||
270 | } | ||
271 | |||
266 | client.auth = pt->authenticated; | 272 | client.auth = pt->authenticated; |
267 | client.pid = pt->pid; | 273 | client.pid = pt->pid; |
268 | client.uid = pt->uid; | 274 | client.uid = pt->uid; |