From 5cfbd5dbab4fe9668771377cb22da04c6103459e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 24 Jul 2006 10:51:27 +1000 Subject: switch drm to use Linux mutexes instead of semaphore. I hope the fallback compat code works if not shout at me. --- linux-core/drm_ioctl.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'linux-core/drm_ioctl.c') diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c index e0998d53..54024e1b 100644 --- a/linux-core/drm_ioctl.c +++ b/linux-core/drm_ioctl.c @@ -188,9 +188,9 @@ int drm_getmap(struct inode *inode, struct file *filp, return -EFAULT; idx = map.offset; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); if (idx < 0) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; } @@ -203,7 +203,7 @@ int drm_getmap(struct inode *inode, struct file *filp, i++; } if (!r_list || !r_list->map) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; } @@ -213,7 +213,7 @@ int drm_getmap(struct inode *inode, struct file *filp, map.flags = r_list->map->flags; map.handle = (void *)(unsigned long) r_list->user_token; map.mtrr = r_list->map->mtrr; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); if (copy_to_user(argp, &map, sizeof(map))) return -EFAULT; @@ -247,11 +247,11 @@ int drm_getclient(struct inode *inode, struct file *filp, if (copy_from_user(&client, argp, sizeof(client))) return -EFAULT; idx = client.idx; - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) ; if (!pt) { - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); return -EINVAL; } client.auth = pt->authenticated; @@ -259,7 +259,7 @@ int drm_getclient(struct inode *inode, struct file *filp, client.uid = pt->uid; client.magic = pt->magic; client.iocs = pt->ioctl_count; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); if (copy_to_user(argp, &client, sizeof(client))) return -EFAULT; @@ -286,7 +286,7 @@ int drm_getstats(struct inode *inode, struct file *filp, memset(&stats, 0, sizeof(stats)); - down(&dev->struct_sem); + mutex_lock(&dev->struct_mutex); for (i = 0; i < dev->counters; i++) { if (dev->types[i] == _DRM_STAT_LOCK) @@ -299,7 +299,7 @@ int drm_getstats(struct inode *inode, struct file *filp, stats.count = dev->counters; - up(&dev->struct_sem); + mutex_unlock(&dev->struct_mutex); if (copy_to_user((drm_stats_t __user *) arg, &stats, sizeof(stats))) return -EFAULT; -- cgit v1.2.3