Path: blob/master/drivers/gpu/drm/nouveau/nouveau_ioc32.c
15112 views
/**1* \file mga_ioc32.c2*3* 32-bit ioctl compatibility routines for the MGA DRM.4*5* \author Dave Airlie <[email protected]> with code from patches by Egbert Eich6*7*8* Copyright (C) Paul Mackerras 20059* Copyright (C) Egbert Eich 2003,200410* Copyright (C) Dave Airlie 200511* All Rights Reserved.12*13* Permission is hereby granted, free of charge, to any person obtaining a14* copy of this software and associated documentation files (the "Software"),15* to deal in the Software without restriction, including without limitation16* the rights to use, copy, modify, merge, publish, distribute, sublicense,17* and/or sell copies of the Software, and to permit persons to whom the18* Software is furnished to do so, subject to the following conditions:19*20* The above copyright notice and this permission notice (including the next21* paragraph) shall be included in all copies or substantial portions of the22* Software.23*24* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR25* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,26* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL27* THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,28* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,29* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS30* IN THE SOFTWARE.31*/3233#include <linux/compat.h>3435#include "drmP.h"36#include "drm.h"3738#include "nouveau_drv.h"3940/**41* Called whenever a 32-bit process running under a 64-bit kernel42* performs an ioctl on /dev/dri/card<n>.43*44* \param filp file pointer.45* \param cmd command.46* \param arg user argument.47* \return zero on success or negative number on failure.48*/49long nouveau_compat_ioctl(struct file *filp, unsigned int cmd,50unsigned long arg)51{52unsigned int nr = DRM_IOCTL_NR(cmd);53drm_ioctl_compat_t *fn = NULL;54int ret;5556if (nr < DRM_COMMAND_BASE)57return drm_compat_ioctl(filp, cmd, arg);5859#if 060if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls))61fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE];62#endif63if (fn != NULL)64ret = (*fn)(filp, cmd, arg);65else66ret = drm_ioctl(filp, cmd, arg);6768return ret;69}707172