forked from Minki/linux
fcd70cd36b
Having the probe helper stuff (which pretty much everyone needs) in the drm_crtc_helper.h file (which atomic drivers should never need) is confusing. Split them out. To make sure I actually achieved the goal here I went through all drivers. And indeed, all atomic drivers are now free of drm_crtc_helper.h includes. v2: Make it compile. There was so much compile fail on arm drivers that I figured I'll better not include any of the acks on v1. v3: Massive rebase because i915 has lost a lot of drmP.h includes, but not all: Through drm_crtc_helper.h > drm_modeset_helper.h -> drmP.h there was still one, which this patch largely removes. Which means rolling out lots more includes all over. This will also conflict with ongoing drmP.h cleanup by others I expect. v3: Rebase on top of atomic bochs. v4: Review from Laurent for bridge/rcar/omap/shmob/core bits: - (re)move some of the added includes, use the better include files in other places (all suggested from Laurent adopted unchanged). - sort alphabetically v5: Actually try to sort them, and while at it, sort all the ones I touch. v6: Rebase onto i915 changes. v7: Rebase once more. Acked-by: Harry Wentland <harry.wentland@amd.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Acked-by: CK Hu <ck.hu@mediatek.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Liviu Dudau <liviu.dudau@arm.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: linux-arm-kernel@lists.infradead.org Cc: virtualization@lists.linux-foundation.org Cc: etnaviv@lists.freedesktop.org Cc: linux-samsung-soc@vger.kernel.org Cc: intel-gfx@lists.freedesktop.org Cc: linux-mediatek@lists.infradead.org Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: spice-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org Cc: linux-rockchip@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-tegra@vger.kernel.org Cc: xen-devel@lists.xen.org Link: https://patchwork.freedesktop.org/patch/msgid/20190117210334.13234-1-daniel.vetter@ffwll.ch
97 lines
3.0 KiB
C
97 lines
3.0 KiB
C
/*
|
|
* 32-bit ioctl compatibility routines for the i915 DRM.
|
|
*
|
|
* Copyright (C) Paul Mackerras 2005
|
|
* Copyright (C) Alan Hourihane 2005
|
|
* All Rights Reserved.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice (including the next
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
* Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
* IN THE SOFTWARE.
|
|
*
|
|
* Author: Alan Hourihane <alanh@fairlite.demon.co.uk>
|
|
*/
|
|
#include <linux/compat.h>
|
|
|
|
#include <drm/i915_drm.h>
|
|
#include <drm/drm_ioctl.h>
|
|
#include "i915_drv.h"
|
|
|
|
struct drm_i915_getparam32 {
|
|
s32 param;
|
|
/*
|
|
* We screwed up the generic ioctl struct here and used a variable-sized
|
|
* pointer. Use u32 in the compat struct to match the 32bit pointer
|
|
* userspace expects.
|
|
*/
|
|
u32 value;
|
|
};
|
|
|
|
static int compat_i915_getparam(struct file *file, unsigned int cmd,
|
|
unsigned long arg)
|
|
{
|
|
struct drm_i915_getparam32 req32;
|
|
drm_i915_getparam_t __user *request;
|
|
|
|
if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
|
|
return -EFAULT;
|
|
|
|
request = compat_alloc_user_space(sizeof(*request));
|
|
if (!access_ok(request, sizeof(*request)) ||
|
|
__put_user(req32.param, &request->param) ||
|
|
__put_user((void __user *)(unsigned long)req32.value,
|
|
&request->value))
|
|
return -EFAULT;
|
|
|
|
return drm_ioctl(file, DRM_IOCTL_I915_GETPARAM,
|
|
(unsigned long)request);
|
|
}
|
|
|
|
static drm_ioctl_compat_t *i915_compat_ioctls[] = {
|
|
[DRM_I915_GETPARAM] = compat_i915_getparam,
|
|
};
|
|
|
|
/**
|
|
* i915_compat_ioctl - handle the mistakes of the past
|
|
* @filp: the file pointer
|
|
* @cmd: the ioctl command (and encoded flags)
|
|
* @arg: the ioctl argument (from userspace)
|
|
*
|
|
* Called whenever a 32-bit process running under a 64-bit kernel
|
|
* performs an ioctl on /dev/dri/card<n>.
|
|
*/
|
|
long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|
{
|
|
unsigned int nr = DRM_IOCTL_NR(cmd);
|
|
drm_ioctl_compat_t *fn = NULL;
|
|
int ret;
|
|
|
|
if (nr < DRM_COMMAND_BASE || nr >= DRM_COMMAND_END)
|
|
return drm_compat_ioctl(filp, cmd, arg);
|
|
|
|
if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(i915_compat_ioctls))
|
|
fn = i915_compat_ioctls[nr - DRM_COMMAND_BASE];
|
|
|
|
if (fn != NULL)
|
|
ret = (*fn) (filp, cmd, arg);
|
|
else
|
|
ret = drm_ioctl(filp, cmd, arg);
|
|
|
|
return ret;
|
|
}
|