| .. | .. |
|---|
| 28 | 28 | */ |
|---|
| 29 | 29 | #include <linux/compat.h> |
|---|
| 30 | 30 | |
|---|
| 31 | | -#include <drm/drmP.h> |
|---|
| 32 | | -#include <drm/i915_drm.h> |
|---|
| 31 | +#include <drm/drm_ioctl.h> |
|---|
| 32 | + |
|---|
| 33 | 33 | #include "i915_drv.h" |
|---|
| 34 | +#include "i915_ioc32.h" |
|---|
| 34 | 35 | |
|---|
| 35 | 36 | struct drm_i915_getparam32 { |
|---|
| 36 | 37 | s32 param; |
|---|
| .. | .. |
|---|
| 46 | 47 | unsigned long arg) |
|---|
| 47 | 48 | { |
|---|
| 48 | 49 | struct drm_i915_getparam32 req32; |
|---|
| 49 | | - drm_i915_getparam_t __user *request; |
|---|
| 50 | + struct drm_i915_getparam req; |
|---|
| 50 | 51 | |
|---|
| 51 | 52 | if (copy_from_user(&req32, (void __user *)arg, sizeof(req32))) |
|---|
| 52 | 53 | return -EFAULT; |
|---|
| 53 | 54 | |
|---|
| 54 | | - request = compat_alloc_user_space(sizeof(*request)); |
|---|
| 55 | | - if (!access_ok(VERIFY_WRITE, request, sizeof(*request)) || |
|---|
| 56 | | - __put_user(req32.param, &request->param) || |
|---|
| 57 | | - __put_user((void __user *)(unsigned long)req32.value, |
|---|
| 58 | | - &request->value)) |
|---|
| 59 | | - return -EFAULT; |
|---|
| 55 | + req.param = req32.param; |
|---|
| 56 | + req.value = compat_ptr(req32.value); |
|---|
| 60 | 57 | |
|---|
| 61 | | - return drm_ioctl(file, DRM_IOCTL_I915_GETPARAM, |
|---|
| 62 | | - (unsigned long)request); |
|---|
| 58 | + return drm_ioctl_kernel(file, i915_getparam_ioctl, &req, |
|---|
| 59 | + DRM_RENDER_ALLOW); |
|---|
| 63 | 60 | } |
|---|
| 64 | 61 | |
|---|
| 65 | 62 | static drm_ioctl_compat_t *i915_compat_ioctls[] = { |
|---|
| .. | .. |
|---|
| 67 | 64 | }; |
|---|
| 68 | 65 | |
|---|
| 69 | 66 | /** |
|---|
| 70 | | - * i915_compat_ioctl - handle the mistakes of the past |
|---|
| 67 | + * i915_ioc32_compat_ioctl - handle the mistakes of the past |
|---|
| 71 | 68 | * @filp: the file pointer |
|---|
| 72 | 69 | * @cmd: the ioctl command (and encoded flags) |
|---|
| 73 | 70 | * @arg: the ioctl argument (from userspace) |
|---|
| .. | .. |
|---|
| 75 | 72 | * Called whenever a 32-bit process running under a 64-bit kernel |
|---|
| 76 | 73 | * performs an ioctl on /dev/dri/card<n>. |
|---|
| 77 | 74 | */ |
|---|
| 78 | | -long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
|---|
| 75 | +long i915_ioc32_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
|---|
| 79 | 76 | { |
|---|
| 80 | 77 | unsigned int nr = DRM_IOCTL_NR(cmd); |
|---|
| 81 | 78 | drm_ioctl_compat_t *fn = NULL; |
|---|