drm: Kill DRM_SUSER
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 11 Dec 2013 10:34:46 +0000 (11:34 +0100)
committerDave Airlie <airlied@redhat.com>
Wed, 18 Dec 2013 01:35:45 +0000 (11:35 +1000)
Checking directly for the right capability is simpler. Also this rids
us of a few places that use DRM_CURRENTPID.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/gpu/drm/via/via_dma.c
include/drm/drm_os_linux.h

index 15b86a94949dcb875d3cd716322875ad8c763e88..99aab8639089f33786467a4faf55239c9ac8caa4 100644 (file)
@@ -593,7 +593,7 @@ int ttm_bo_kmap(struct ttm_buffer_object *bo,
        if (start_page > bo->num_pages)
                return -EINVAL;
 #if 0
-       if (num_pages > 1 && !DRM_SUSER(DRM_CURPROC))
+       if (num_pages > 1 && !capable(CAP_SYS_ADMIN))
                return -EPERM;
 #endif
        (void) ttm_mem_io_lock(man, false);
index 5d4179284964022262fb5f1ec74a516a6d2fe96a..a18479c6b6dae3dfdbb3d3e6e238f129dc79a3ad 100644 (file)
@@ -234,13 +234,13 @@ static int via_dma_init(struct drm_device *dev, void *data, struct drm_file *fil
 
        switch (init->func) {
        case VIA_INIT_DMA:
-               if (!DRM_SUSER(DRM_CURPROC))
+               if (!capable(CAP_SYS_ADMIN))
                        retcode = -EPERM;
                else
                        retcode = via_initialize(dev, dev_priv, init);
                break;
        case VIA_CLEANUP_DMA:
-               if (!DRM_SUSER(DRM_CURPROC))
+               if (!capable(CAP_SYS_ADMIN))
                        retcode = -EPERM;
                else
                        retcode = via_dma_cleanup(dev);
index 43008938b6b2323ad025034d0b0336bd868f8c6f..86ab99bc0ac50e560b5f31c55fd3f91231607244 100644 (file)
@@ -21,7 +21,6 @@ static inline void writeq(u64 val, void __iomem *reg)
 
 /** Current process ID */
 #define DRM_CURRENTPID                 task_pid_nr(current)
-#define DRM_SUSER(p)                   capable(CAP_SYS_ADMIN)
 #define DRM_UDELAY(d)                  udelay(d)
 /** Read a byte from a MMIO region */
 #define DRM_READ8(map, offset)         readb(((void __iomem *)(map)->handle) + (offset))