diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2015-07-11 01:31:08 -0400 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2015-08-12 13:06:18 -0400 |
commit | 5101020c78c9f242fe77bd7986bc24f7b800172a (patch) | |
tree | 21c4b7350c58d48b492d7cc87c55bdc57ff538b9 | |
parent | 05c9501859c8bd80635d7299c384e2a8db7c0ce1 (diff) |
drm: export the DRM permission check code
This way drm_ioctl_permit() can be used by drivers
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
-rw-r--r-- | drivers/gpu/drm/drm_ioctl.c | 3 | ||||
-rw-r--r-- | include/drm/drmP.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index b1d303fa2327..9a860ca1e9d7 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c | |||
@@ -480,7 +480,7 @@ static int drm_version(struct drm_device *dev, void *data, | |||
480 | * indicated permissions. If so, returns zero. Otherwise returns an | 480 | * indicated permissions. If so, returns zero. Otherwise returns an |
481 | * error code suitable for ioctl return. | 481 | * error code suitable for ioctl return. |
482 | */ | 482 | */ |
483 | static int drm_ioctl_permit(u32 flags, struct drm_file *file_priv) | 483 | int drm_ioctl_permit(u32 flags, struct drm_file *file_priv) |
484 | { | 484 | { |
485 | /* ROOT_ONLY is only for CAP_SYS_ADMIN */ | 485 | /* ROOT_ONLY is only for CAP_SYS_ADMIN */ |
486 | if (unlikely((flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN))) | 486 | if (unlikely((flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN))) |
@@ -508,6 +508,7 @@ static int drm_ioctl_permit(u32 flags, struct drm_file *file_priv) | |||
508 | 508 | ||
509 | return 0; | 509 | return 0; |
510 | } | 510 | } |
511 | EXPORT_SYMBOL(drm_ioctl_permit); | ||
511 | 512 | ||
512 | #define DRM_IOCTL_DEF(ioctl, _func, _flags) \ | 513 | #define DRM_IOCTL_DEF(ioctl, _func, _flags) \ |
513 | [DRM_IOCTL_NR(ioctl)] = { \ | 514 | [DRM_IOCTL_NR(ioctl)] = { \ |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 4717449d6aa9..3b0c50f7412a 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -887,6 +887,7 @@ static inline bool drm_is_primary_client(const struct drm_file *file_priv) | |||
887 | /*@{*/ | 887 | /*@{*/ |
888 | 888 | ||
889 | /* Driver support (drm_drv.h) */ | 889 | /* Driver support (drm_drv.h) */ |
890 | extern int drm_ioctl_permit(u32 flags, struct drm_file *file_priv); | ||
890 | extern long drm_ioctl(struct file *filp, | 891 | extern long drm_ioctl(struct file *filp, |
891 | unsigned int cmd, unsigned long arg); | 892 | unsigned int cmd, unsigned long arg); |
892 | extern long drm_compat_ioctl(struct file *filp, | 893 | extern long drm_compat_ioctl(struct file *filp, |