Skip to content

Commit 7cfdf71

Browse files
committed
drm: Extract drm_ioctl.h
To match the drm_ioctl.c we already have. v2: Remove spurious space (Ville). Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
1 parent 33e5b66 commit 7cfdf71

3 files changed

Lines changed: 104 additions & 60 deletions

File tree

‎drivers/gpu/drm/drm_ioctl.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* OTHER DEALINGS IN THE SOFTWARE.
2929
*/
3030

31+
#include <drm/drm_ioctl.h>
3132
#include <drm/drmP.h>
3233
#include <drm/drm_auth.h>
3334
#include "drm_legacy.h"

‎include/drm/drmP.h‎

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#include <drm/drm_pci.h>
8080
#include <drm/drm_file.h>
8181
#include <drm/drm_debugfs.h>
82+
#include <drm/drm_ioctl.h>
8283

8384
struct module;
8485

@@ -317,49 +318,6 @@ struct pci_controller;
317318

318319
#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
319320

320-
/**
321-
* Ioctl function type.
322-
*
323-
* \param inode device inode.
324-
* \param file_priv DRM file private pointer.
325-
* \param cmd command.
326-
* \param arg argument.
327-
*/
328-
typedef int drm_ioctl_t(struct drm_device *dev, void *data,
329-
struct drm_file *file_priv);
330-
331-
typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
332-
unsigned long arg);
333-
334-
#define DRM_IOCTL_NR(n) _IOC_NR(n)
335-
#define DRM_MAJOR 226
336-
337-
#define DRM_AUTH 0x1
338-
#define DRM_MASTER 0x2
339-
#define DRM_ROOT_ONLY 0x4
340-
#define DRM_CONTROL_ALLOW 0x8
341-
#define DRM_UNLOCKED 0x10
342-
#define DRM_RENDER_ALLOW 0x20
343-
344-
struct drm_ioctl_desc {
345-
unsigned int cmd;
346-
int flags;
347-
drm_ioctl_t *func;
348-
const char *name;
349-
};
350-
351-
/**
352-
* Creates a driver or general drm_ioctl_desc array entry for the given
353-
* ioctl, for use by drm_ioctl().
354-
*/
355-
356-
#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \
357-
[DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE] = { \
358-
.cmd = DRM_IOCTL_##ioctl, \
359-
.func = _func, \
360-
.flags = _flags, \
361-
.name = #ioctl \
362-
}
363321

364322
/* Flags and return codes for get_vblank_timestamp() driver function. */
365323
#define DRM_CALLED_FROM_VBLIRQ 1
@@ -549,23 +507,6 @@ static inline int drm_device_is_unplugged(struct drm_device *dev)
549507
/*@{*/
550508

551509
/* Driver support (drm_drv.h) */
552-
extern int drm_ioctl_permit(u32 flags, struct drm_file *file_priv);
553-
extern long drm_ioctl(struct file *filp,
554-
unsigned int cmd, unsigned long arg);
555-
#ifdef CONFIG_COMPAT
556-
extern long drm_compat_ioctl(struct file *filp,
557-
unsigned int cmd, unsigned long arg);
558-
#else
559-
/* Let drm_compat_ioctl be assigned to .compat_ioctl unconditionally */
560-
#define drm_compat_ioctl NULL
561-
#endif
562-
extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
563-
564-
/* Misc. IOCTL support (drm_ioctl.c) */
565-
int drm_noop(struct drm_device *dev, void *data,
566-
struct drm_file *file_priv);
567-
int drm_invalid_op(struct drm_device *dev, void *data,
568-
struct drm_file *file_priv);
569510

570511
/*
571512
* These are exported to drivers so that they can implement fencing using

‎include/drm/drm_ioctl.h‎

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* Internal Header for the Direct Rendering Manager
3+
*
4+
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5+
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6+
* Copyright (c) 2009-2010, Code Aurora Forum.
7+
* All rights reserved.
8+
*
9+
* Author: Rickard E. (Rik) Faith <faith@valinux.com>
10+
* Author: Gareth Hughes <gareth@valinux.com>
11+
*
12+
* Permission is hereby granted, free of charge, to any person obtaining a
13+
* copy of this software and associated documentation files (the "Software"),
14+
* to deal in the Software without restriction, including without limitation
15+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
16+
* and/or sell copies of the Software, and to permit persons to whom the
17+
* Software is furnished to do so, subject to the following conditions:
18+
*
19+
* The above copyright notice and this permission notice (including the next
20+
* paragraph) shall be included in all copies or substantial portions of the
21+
* Software.
22+
*
23+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26+
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29+
* OTHER DEALINGS IN THE SOFTWARE.
30+
*/
31+
32+
#ifndef _DRM_IOCTL_H_
33+
#define _DRM_IOCTL_H_
34+
35+
#include <linux/types.h>
36+
37+
#include <asm/ioctl.h>
38+
39+
struct drm_device;
40+
struct drm_file;
41+
struct file;
42+
43+
/**
44+
* Ioctl function type.
45+
*
46+
* \param inode device inode.
47+
* \param file_priv DRM file private pointer.
48+
* \param cmd command.
49+
* \param arg argument.
50+
*/
51+
typedef int drm_ioctl_t(struct drm_device *dev, void *data,
52+
struct drm_file *file_priv);
53+
54+
typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
55+
unsigned long arg);
56+
57+
#define DRM_IOCTL_NR(n) _IOC_NR(n)
58+
#define DRM_MAJOR 226
59+
60+
#define DRM_AUTH 0x1
61+
#define DRM_MASTER 0x2
62+
#define DRM_ROOT_ONLY 0x4
63+
#define DRM_CONTROL_ALLOW 0x8
64+
#define DRM_UNLOCKED 0x10
65+
#define DRM_RENDER_ALLOW 0x20
66+
67+
struct drm_ioctl_desc {
68+
unsigned int cmd;
69+
int flags;
70+
drm_ioctl_t *func;
71+
const char *name;
72+
};
73+
74+
/**
75+
* Creates a driver or general drm_ioctl_desc array entry for the given
76+
* ioctl, for use by drm_ioctl().
77+
*/
78+
79+
#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \
80+
[DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE] = { \
81+
.cmd = DRM_IOCTL_##ioctl, \
82+
.func = _func, \
83+
.flags = _flags, \
84+
.name = #ioctl \
85+
}
86+
87+
int drm_ioctl_permit(u32 flags, struct drm_file *file_priv);
88+
long drm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
89+
#ifdef CONFIG_COMPAT
90+
long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
91+
#else
92+
/* Let drm_compat_ioctl be assigned to .compat_ioctl unconditionally */
93+
#define drm_compat_ioctl NULL
94+
#endif
95+
bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
96+
97+
int drm_noop(struct drm_device *dev, void *data,
98+
struct drm_file *file_priv);
99+
int drm_invalid_op(struct drm_device *dev, void *data,
100+
struct drm_file *file_priv);
101+
102+
#endif /* _DRM_IOCTL_H_ */

0 commit comments

Comments
 (0)