]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/drm/drm_scatter.c
drm: Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.
[linux-2.6-omap-h63xx.git] / drivers / char / drm / drm_scatter.c
index 0c2188367e698a669e3a7ce6e8e785fa4c627be1..eb7fa437355e4068a52d48d2f7e7afbdad9e2f00 100644 (file)
@@ -62,12 +62,8 @@ void drm_sg_cleanup(struct drm_sg_mem * entry)
 # define ScatterHandle(x) (unsigned int)(x)
 #endif
 
-int drm_sg_alloc(struct inode *inode, struct drm_file *file_priv,
-                unsigned int cmd, unsigned long arg)
+int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request)
 {
-       struct drm_device *dev = file_priv->head->dev;
-       struct drm_scatter_gather __user *argp = (void __user *)arg;
-       struct drm_scatter_gather request;
        struct drm_sg_mem *entry;
        unsigned long pages, i, j;
 
@@ -79,17 +75,13 @@ int drm_sg_alloc(struct inode *inode, struct drm_file *file_priv,
        if (dev->sg)
                return -EINVAL;
 
-       if (copy_from_user(&request, argp, sizeof(request)))
-               return -EFAULT;
-
        entry = drm_alloc(sizeof(*entry), DRM_MEM_SGLISTS);
        if (!entry)
                return -ENOMEM;
 
        memset(entry, 0, sizeof(*entry));
-
-       pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
-       DRM_DEBUG("sg size=%ld pages=%ld\n", request.size, pages);
+       pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
+       DRM_DEBUG("sg size=%ld pages=%ld\n", request->size, pages);
 
        entry->pages = pages;
        entry->pagelist = drm_alloc(pages * sizeof(*entry->pagelist),
@@ -141,12 +133,7 @@ int drm_sg_alloc(struct inode *inode, struct drm_file *file_priv,
                SetPageReserved(entry->pagelist[j]);
        }
 
-       request.handle = entry->handle;
-
-       if (copy_to_user(argp, &request, sizeof(request))) {
-               drm_sg_cleanup(entry);
-               return -EFAULT;
-       }
+       request->handle = entry->handle;
 
        dev->sg = entry;
 
@@ -196,26 +183,31 @@ int drm_sg_alloc(struct inode *inode, struct drm_file *file_priv,
        drm_sg_cleanup(entry);
        return -ENOMEM;
 }
+EXPORT_SYMBOL(drm_sg_alloc);
+
 
-int drm_sg_free(struct inode *inode, struct drm_file *file_priv,
-               unsigned int cmd, unsigned long arg)
+int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
+                      struct drm_file *file_priv)
 {
-       struct drm_device *dev = file_priv->head->dev;
-       struct drm_scatter_gather request;
+       struct drm_scatter_gather *request = data;
+
+       return drm_sg_alloc(dev, request);
+
+}
+
+int drm_sg_free(struct drm_device *dev, void *data,
+               struct drm_file *file_priv)
+{
+       struct drm_scatter_gather *request = data;
        struct drm_sg_mem *entry;
 
        if (!drm_core_check_feature(dev, DRIVER_SG))
                return -EINVAL;
 
-       if (copy_from_user(&request,
-                          (struct drm_scatter_gather __user *) arg,
-                          sizeof(request)))
-               return -EFAULT;
-
        entry = dev->sg;
        dev->sg = NULL;
 
-       if (!entry || entry->handle != request.handle)
+       if (!entry || entry->handle != request->handle)
                return -EINVAL;
 
        DRM_DEBUG("sg free virtual  = %p\n", entry->virtual);