]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/drm/drm_ioctl.c
Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
[linux-2.6-omap-h63xx.git] / drivers / char / drm / drm_ioctl.c
index 565895547d75b2c254db4eafaab91c344d14780e..b195e102e73797b2c6a316bdbe583091ced3dabe 100644 (file)
 int drm_getunique(struct inode *inode, struct file *filp,
                  unsigned int cmd, unsigned long arg)
 {
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->head->dev;
-       drm_unique_t __user *argp = (void __user *)arg;
-       drm_unique_t u;
+       struct drm_file *priv = filp->private_data;
+       struct drm_device *dev = priv->head->dev;
+       struct drm_unique __user *argp = (void __user *)arg;
+       struct drm_unique u;
 
        if (copy_from_user(&u, argp, sizeof(u)))
                return -EFAULT;
@@ -86,15 +86,15 @@ int drm_getunique(struct inode *inode, struct file *filp,
 int drm_setunique(struct inode *inode, struct file *filp,
                  unsigned int cmd, unsigned long arg)
 {
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->head->dev;
-       drm_unique_t u;
+       struct drm_file *priv = filp->private_data;
+       struct drm_device *dev = priv->head->dev;
+       struct drm_unique u;
        int domain, bus, slot, func, ret;
 
        if (dev->unique_len || dev->unique)
                return -EBUSY;
 
-       if (copy_from_user(&u, (drm_unique_t __user *) arg, sizeof(u)))
+       if (copy_from_user(&u, (struct drm_unique __user *) arg, sizeof(u)))
                return -EFAULT;
 
        if (!u.unique_len || u.unique_len > 1024)
@@ -136,7 +136,7 @@ int drm_setunique(struct inode *inode, struct file *filp,
        return 0;
 }
 
-static int drm_set_busid(drm_device_t * dev)
+static int drm_set_busid(struct drm_device * dev)
 {
        int len;
 
@@ -184,11 +184,11 @@ static int drm_set_busid(drm_device_t * dev)
 int drm_getmap(struct inode *inode, struct file *filp,
               unsigned int cmd, unsigned long arg)
 {
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->head->dev;
-       drm_map_t __user *argp = (void __user *)arg;
-       drm_map_t map;
-       drm_map_list_t *r_list = NULL;
+       struct drm_file *priv = filp->private_data;
+       struct drm_device *dev = priv->head->dev;
+       struct drm_map __user *argp = (void __user *)arg;
+       struct drm_map map;
+       struct drm_map_list *r_list = NULL;
        struct list_head *list;
        int idx;
        int i;
@@ -204,9 +204,9 @@ 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);
+                       r_list = list_entry(list, struct drm_map_list, head);
                        break;
                }
                i++;
@@ -245,11 +245,11 @@ int drm_getmap(struct inode *inode, struct file *filp,
 int drm_getclient(struct inode *inode, struct file *filp,
                  unsigned int cmd, unsigned long arg)
 {
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->head->dev;
-       drm_client_t __user *argp = (drm_client_t __user *)arg;
-       drm_client_t client;
-       drm_file_t *pt;
+       struct drm_file *priv = filp->private_data;
+       struct drm_device *dev = priv->head->dev;
+       struct drm_client __user *argp = (struct drm_client __user *)arg;
+       struct drm_client client;
+       struct drm_file *pt;
        int idx;
        int i;
 
@@ -257,12 +257,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;
@@ -288,9 +294,9 @@ int drm_getclient(struct inode *inode, struct file *filp,
 int drm_getstats(struct inode *inode, struct file *filp,
                 unsigned int cmd, unsigned long arg)
 {
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->head->dev;
-       drm_stats_t stats;
+       struct drm_file *priv = filp->private_data;
+       struct drm_device *dev = priv->head->dev;
+       struct drm_stats stats;
        int i;
 
        memset(&stats, 0, sizeof(stats));
@@ -310,7 +316,7 @@ int drm_getstats(struct inode *inode, struct file *filp,
 
        mutex_unlock(&dev->struct_mutex);
 
-       if (copy_to_user((drm_stats_t __user *) arg, &stats, sizeof(stats)))
+       if (copy_to_user((struct drm_stats __user *) arg, &stats, sizeof(stats)))
                return -EFAULT;
        return 0;
 }
@@ -329,10 +335,10 @@ int drm_getstats(struct inode *inode, struct file *filp,
 int drm_setversion(DRM_IOCTL_ARGS)
 {
        DRM_DEVICE;
-       drm_set_version_t sv;
-       drm_set_version_t retv;
+       struct drm_set_version sv;
+       struct drm_set_version retv;
        int if_version;
-       drm_set_version_t __user *argp = (void __user *)data;
+       struct drm_set_version __user *argp = (void __user *)data;
        int ret;
 
        if (copy_from_user(&sv, argp, sizeof(sv)))