aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_drv.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2011-10-31 10:28:57 -0400
committerDave Airlie <airlied@redhat.com>2011-11-11 06:14:47 -0500
commite08e96de986ceb2c6b683df0bd0c4ddd4f91dcfd (patch)
tree632e9e5dc117204b0f1e78f57be6abdc6f4750f3 /drivers/gpu/drm/i915/i915_drv.c
parentd68752cf7bb92eafbbe6a0df0d0fab67e87523f6 (diff)
drm: Make the per-driver file_operations struct const
From fdf1fdebaa00f81de18c227f32f8074c8b352d50 Mon Sep 17 00:00:00 2001 From: Arjan van de Ven <arjan@linux.intel.com> Date: Sun, 30 Oct 2011 19:06:07 -0700 Subject: [PATCH] drm: Make the per-driver file_operations struct const The DRM layer keeps a copy of struct file_operations inside its big driver struct... which prevents it from being consistent and static. For consistency (and the general security objective of having such things static), it's desirable to get this fixed. This patch splits out the file_operations field to its own struct, which is then "static const", and just stick a pointer to this into the driver struct, making it more consistent with how the rest of the kernel does this. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.c')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index cc531bb59c26..9f592703c369 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -788,6 +788,21 @@ static struct vm_operations_struct i915_gem_vm_ops = {
788 .close = drm_gem_vm_close, 788 .close = drm_gem_vm_close,
789}; 789};
790 790
791static const struct file_operations i915_driver_fops = {
792 .owner = THIS_MODULE,
793 .open = drm_open,
794 .release = drm_release,
795 .unlocked_ioctl = drm_ioctl,
796 .mmap = drm_gem_mmap,
797 .poll = drm_poll,
798 .fasync = drm_fasync,
799 .read = drm_read,
800#ifdef CONFIG_COMPAT
801 .compat_ioctl = i915_compat_ioctl,
802#endif
803 .llseek = noop_llseek,
804};
805
791static struct drm_driver driver = { 806static struct drm_driver driver = {
792 /* don't use mtrr's here, the Xserver or user space app should 807 /* don't use mtrr's here, the Xserver or user space app should
793 * deal with them for intel hardware. 808 * deal with them for intel hardware.
@@ -821,21 +836,7 @@ static struct drm_driver driver = {
821 .dumb_map_offset = i915_gem_mmap_gtt, 836 .dumb_map_offset = i915_gem_mmap_gtt,
822 .dumb_destroy = i915_gem_dumb_destroy, 837 .dumb_destroy = i915_gem_dumb_destroy,
823 .ioctls = i915_ioctls, 838 .ioctls = i915_ioctls,
824 .fops = { 839 .fops = &i915_driver_fops,
825 .owner = THIS_MODULE,
826 .open = drm_open,
827 .release = drm_release,
828 .unlocked_ioctl = drm_ioctl,
829 .mmap = drm_gem_mmap,
830 .poll = drm_poll,
831 .fasync = drm_fasync,
832 .read = drm_read,
833#ifdef CONFIG_COMPAT
834 .compat_ioctl = i915_compat_ioctl,
835#endif
836 .llseek = noop_llseek,
837 },
838
839 .name = DRIVER_NAME, 840 .name = DRIVER_NAME,
840 .desc = DRIVER_DESC, 841 .desc = DRIVER_DESC,
841 .date = DRIVER_DATE, 842 .date = DRIVER_DATE,