[modesetting-101] update mode count after fill_modes.
[platform/upstream/libdrm.git] / linux-core / radeon_ms_compat.c
1 /*
2  * Copyright 2007 Dave Airlie
3  * Copyright 2007 Alex Deucher
4  * Copyright 2007 Michel Dänzer
5  * Copyright 2007 Roland Scheidegger
6  * Copyright 2007 Vladimir Dergachev
7  * Copyright 2007 Nicolai Haehnle
8  * Copyright 2007 Aapo Tahkola
9  * Copyright 2007 Ben Skeggs
10  * Copyright 2007 Jérôme Glisse
11  * All Rights Reserved.
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice (including the next
21  * paragraph) shall be included in all copies or substantial portions of the
22  * Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
27  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
28  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30  * DEALINGS IN THE SOFTWARE.
31  */
32 /*
33  * Authors:
34  *    Jerome Glisse <glisse@freedesktop.org>
35  */
36 #include "drmP.h"
37 #include "drm.h"
38 #include "radeon_ms.h"
39
40 /**
41  * Called whenever a 32-bit process running under a 64-bit kernel
42  * 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  */
49 long radeon_ms_compat_ioctl(struct file *filp, unsigned int cmd,
50                             unsigned long arg)
51 {
52         unsigned int nr = DRM_IOCTL_NR(cmd);
53         drm_ioctl_compat_t *fn = NULL;
54         int ret;
55
56         if (nr < DRM_COMMAND_BASE)
57                 return drm_compat_ioctl(filp, cmd, arg);
58
59         lock_kernel();
60         if (fn != NULL)
61                 ret = (*fn)(filp, cmd, arg);
62         else
63                 ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
64         unlock_kernel();
65
66         return ret;
67 }