diff options
author | Arjan van de Ven <arjan@infradead.org> | 2011-10-31 10:28:57 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-11-11 06:14:47 -0500 |
commit | e08e96de986ceb2c6b683df0bd0c4ddd4f91dcfd (patch) | |
tree | 632e9e5dc117204b0f1e78f57be6abdc6f4750f3 /drivers/gpu | |
parent | d68752cf7bb92eafbbe6a0df0d0fab67e87523f6 (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')
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i810/i810_drv.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 31 | ||||
-rw-r--r-- | drivers/gpu/drm/mga/mga_drv.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.c | 31 | ||||
-rw-r--r-- | drivers/gpu/drm/r128/r128_drv.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_drv.c | 60 | ||||
-rw-r--r-- | drivers/gpu/drm/savage/savage_drv.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/sis/sis_drv.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/tdfx/tdfx_drv.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/via/via_drv.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 30 |
12 files changed, 170 insertions, 158 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 4911e1d1dcf2..c00cf154cc0b 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -182,7 +182,7 @@ int drm_stub_open(struct inode *inode, struct file *filp) | |||
182 | goto out; | 182 | goto out; |
183 | 183 | ||
184 | old_fops = filp->f_op; | 184 | old_fops = filp->f_op; |
185 | filp->f_op = fops_get(&dev->driver->fops); | 185 | filp->f_op = fops_get(dev->driver->fops); |
186 | if (filp->f_op == NULL) { | 186 | if (filp->f_op == NULL) { |
187 | filp->f_op = old_fops; | 187 | filp->f_op = old_fops; |
188 | goto out; | 188 | goto out; |
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c index d4266bdf6fb4..ec12f7dc717a 100644 --- a/drivers/gpu/drm/i810/i810_drv.c +++ b/drivers/gpu/drm/i810/i810_drv.c | |||
@@ -43,6 +43,17 @@ static struct pci_device_id pciidlist[] = { | |||
43 | i810_PCI_IDS | 43 | i810_PCI_IDS |
44 | }; | 44 | }; |
45 | 45 | ||
46 | static const struct file_operations i810_driver_fops = { | ||
47 | .owner = THIS_MODULE, | ||
48 | .open = drm_open, | ||
49 | .release = drm_release, | ||
50 | .unlocked_ioctl = drm_ioctl, | ||
51 | .mmap = drm_mmap, | ||
52 | .poll = drm_poll, | ||
53 | .fasync = drm_fasync, | ||
54 | .llseek = noop_llseek, | ||
55 | }; | ||
56 | |||
46 | static struct drm_driver driver = { | 57 | static struct drm_driver driver = { |
47 | .driver_features = | 58 | .driver_features = |
48 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | | 59 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | |
@@ -55,17 +66,7 @@ static struct drm_driver driver = { | |||
55 | .reclaim_buffers_locked = i810_driver_reclaim_buffers_locked, | 66 | .reclaim_buffers_locked = i810_driver_reclaim_buffers_locked, |
56 | .dma_quiescent = i810_driver_dma_quiescent, | 67 | .dma_quiescent = i810_driver_dma_quiescent, |
57 | .ioctls = i810_ioctls, | 68 | .ioctls = i810_ioctls, |
58 | .fops = { | 69 | .fops = &i810_driver_fops, |
59 | .owner = THIS_MODULE, | ||
60 | .open = drm_open, | ||
61 | .release = drm_release, | ||
62 | .unlocked_ioctl = drm_ioctl, | ||
63 | .mmap = drm_mmap, | ||
64 | .poll = drm_poll, | ||
65 | .fasync = drm_fasync, | ||
66 | .llseek = noop_llseek, | ||
67 | }, | ||
68 | |||
69 | .name = DRIVER_NAME, | 70 | .name = DRIVER_NAME, |
70 | .desc = DRIVER_DESC, | 71 | .desc = DRIVER_DESC, |
71 | .date = DRIVER_DATE, | 72 | .date = DRIVER_DATE, |
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 | ||
791 | static 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 | |||
791 | static struct drm_driver driver = { | 806 | static 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, |
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c index 33daa29eea66..f9a925d58819 100644 --- a/drivers/gpu/drm/mga/mga_drv.c +++ b/drivers/gpu/drm/mga/mga_drv.c | |||
@@ -44,6 +44,20 @@ static struct pci_device_id pciidlist[] = { | |||
44 | mga_PCI_IDS | 44 | mga_PCI_IDS |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static const struct file_operations mga_driver_fops = { | ||
48 | .owner = THIS_MODULE, | ||
49 | .open = drm_open, | ||
50 | .release = drm_release, | ||
51 | .unlocked_ioctl = drm_ioctl, | ||
52 | .mmap = drm_mmap, | ||
53 | .poll = drm_poll, | ||
54 | .fasync = drm_fasync, | ||
55 | #ifdef CONFIG_COMPAT | ||
56 | .compat_ioctl = mga_compat_ioctl, | ||
57 | #endif | ||
58 | .llseek = noop_llseek, | ||
59 | }; | ||
60 | |||
47 | static struct drm_driver driver = { | 61 | static struct drm_driver driver = { |
48 | .driver_features = | 62 | .driver_features = |
49 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | | 63 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | |
@@ -64,20 +78,7 @@ static struct drm_driver driver = { | |||
64 | .reclaim_buffers = drm_core_reclaim_buffers, | 78 | .reclaim_buffers = drm_core_reclaim_buffers, |
65 | .ioctls = mga_ioctls, | 79 | .ioctls = mga_ioctls, |
66 | .dma_ioctl = mga_dma_buffers, | 80 | .dma_ioctl = mga_dma_buffers, |
67 | .fops = { | 81 | .fops = &mga_driver_fops, |
68 | .owner = THIS_MODULE, | ||
69 | .open = drm_open, | ||
70 | .release = drm_release, | ||
71 | .unlocked_ioctl = drm_ioctl, | ||
72 | .mmap = drm_mmap, | ||
73 | .poll = drm_poll, | ||
74 | .fasync = drm_fasync, | ||
75 | #ifdef CONFIG_COMPAT | ||
76 | .compat_ioctl = mga_compat_ioctl, | ||
77 | #endif | ||
78 | .llseek = noop_llseek, | ||
79 | }, | ||
80 | |||
81 | .name = DRIVER_NAME, | 82 | .name = DRIVER_NAME, |
82 | .desc = DRIVER_DESC, | 83 | .desc = DRIVER_DESC, |
83 | .date = DRIVER_DATE, | 84 | .date = DRIVER_DATE, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 9f7bb1295262..d661bc5e3945 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -388,6 +388,21 @@ nouveau_pci_resume(struct pci_dev *pdev) | |||
388 | return 0; | 388 | return 0; |
389 | } | 389 | } |
390 | 390 | ||
391 | static const struct file_operations nouveau_driver_fops = { | ||
392 | .owner = THIS_MODULE, | ||
393 | .open = drm_open, | ||
394 | .release = drm_release, | ||
395 | .unlocked_ioctl = drm_ioctl, | ||
396 | .mmap = nouveau_ttm_mmap, | ||
397 | .poll = drm_poll, | ||
398 | .fasync = drm_fasync, | ||
399 | .read = drm_read, | ||
400 | #if defined(CONFIG_COMPAT) | ||
401 | .compat_ioctl = nouveau_compat_ioctl, | ||
402 | #endif | ||
403 | .llseek = noop_llseek, | ||
404 | }; | ||
405 | |||
391 | static struct drm_driver driver = { | 406 | static struct drm_driver driver = { |
392 | .driver_features = | 407 | .driver_features = |
393 | DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | | 408 | DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | |
@@ -413,21 +428,7 @@ static struct drm_driver driver = { | |||
413 | .disable_vblank = nouveau_vblank_disable, | 428 | .disable_vblank = nouveau_vblank_disable, |
414 | .reclaim_buffers = drm_core_reclaim_buffers, | 429 | .reclaim_buffers = drm_core_reclaim_buffers, |
415 | .ioctls = nouveau_ioctls, | 430 | .ioctls = nouveau_ioctls, |
416 | .fops = { | 431 | .fops = &nouveau_driver_fops, |
417 | .owner = THIS_MODULE, | ||
418 | .open = drm_open, | ||
419 | .release = drm_release, | ||
420 | .unlocked_ioctl = drm_ioctl, | ||
421 | .mmap = nouveau_ttm_mmap, | ||
422 | .poll = drm_poll, | ||
423 | .fasync = drm_fasync, | ||
424 | .read = drm_read, | ||
425 | #if defined(CONFIG_COMPAT) | ||
426 | .compat_ioctl = nouveau_compat_ioctl, | ||
427 | #endif | ||
428 | .llseek = noop_llseek, | ||
429 | }, | ||
430 | |||
431 | .gem_init_object = nouveau_gem_object_new, | 432 | .gem_init_object = nouveau_gem_object_new, |
432 | .gem_free_object = nouveau_gem_object_del, | 433 | .gem_free_object = nouveau_gem_object_del, |
433 | .gem_open_object = nouveau_gem_object_open, | 434 | .gem_open_object = nouveau_gem_object_open, |
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c index 4c8796ba6dd8..6a5f4395838f 100644 --- a/drivers/gpu/drm/r128/r128_drv.c +++ b/drivers/gpu/drm/r128/r128_drv.c | |||
@@ -42,6 +42,20 @@ static struct pci_device_id pciidlist[] = { | |||
42 | r128_PCI_IDS | 42 | r128_PCI_IDS |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static const struct file_operations r128_driver_fops = { | ||
46 | .owner = THIS_MODULE, | ||
47 | .open = drm_open, | ||
48 | .release = drm_release, | ||
49 | .unlocked_ioctl = drm_ioctl, | ||
50 | .mmap = drm_mmap, | ||
51 | .poll = drm_poll, | ||
52 | .fasync = drm_fasync, | ||
53 | #ifdef CONFIG_COMPAT | ||
54 | .compat_ioctl = r128_compat_ioctl, | ||
55 | #endif | ||
56 | .llseek = noop_llseek, | ||
57 | }; | ||
58 | |||
45 | static struct drm_driver driver = { | 59 | static struct drm_driver driver = { |
46 | .driver_features = | 60 | .driver_features = |
47 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | | 61 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | |
@@ -60,21 +74,7 @@ static struct drm_driver driver = { | |||
60 | .reclaim_buffers = drm_core_reclaim_buffers, | 74 | .reclaim_buffers = drm_core_reclaim_buffers, |
61 | .ioctls = r128_ioctls, | 75 | .ioctls = r128_ioctls, |
62 | .dma_ioctl = r128_cce_buffers, | 76 | .dma_ioctl = r128_cce_buffers, |
63 | .fops = { | 77 | .fops = &r128_driver_fops, |
64 | .owner = THIS_MODULE, | ||
65 | .open = drm_open, | ||
66 | .release = drm_release, | ||
67 | .unlocked_ioctl = drm_ioctl, | ||
68 | .mmap = drm_mmap, | ||
69 | .poll = drm_poll, | ||
70 | .fasync = drm_fasync, | ||
71 | #ifdef CONFIG_COMPAT | ||
72 | .compat_ioctl = r128_compat_ioctl, | ||
73 | #endif | ||
74 | .llseek = noop_llseek, | ||
75 | }, | ||
76 | |||
77 | |||
78 | .name = DRIVER_NAME, | 78 | .name = DRIVER_NAME, |
79 | .desc = DRIVER_DESC, | 79 | .desc = DRIVER_DESC, |
80 | .date = DRIVER_DATE, | 80 | .date = DRIVER_DATE, |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index a0b35e909489..e42c34b98c7b 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -205,6 +205,21 @@ static struct pci_device_id pciidlist[] = { | |||
205 | MODULE_DEVICE_TABLE(pci, pciidlist); | 205 | MODULE_DEVICE_TABLE(pci, pciidlist); |
206 | #endif | 206 | #endif |
207 | 207 | ||
208 | static const struct file_operations radeon_driver_old_fops = { | ||
209 | .owner = THIS_MODULE, | ||
210 | .open = drm_open, | ||
211 | .release = drm_release, | ||
212 | .unlocked_ioctl = drm_ioctl, | ||
213 | .mmap = drm_mmap, | ||
214 | .poll = drm_poll, | ||
215 | .fasync = drm_fasync, | ||
216 | .read = drm_read, | ||
217 | #ifdef CONFIG_COMPAT | ||
218 | .compat_ioctl = radeon_compat_ioctl, | ||
219 | #endif | ||
220 | .llseek = noop_llseek, | ||
221 | }; | ||
222 | |||
208 | static struct drm_driver driver_old = { | 223 | static struct drm_driver driver_old = { |
209 | .driver_features = | 224 | .driver_features = |
210 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | | 225 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | |
@@ -231,21 +246,7 @@ static struct drm_driver driver_old = { | |||
231 | .reclaim_buffers = drm_core_reclaim_buffers, | 246 | .reclaim_buffers = drm_core_reclaim_buffers, |
232 | .ioctls = radeon_ioctls, | 247 | .ioctls = radeon_ioctls, |
233 | .dma_ioctl = radeon_cp_buffers, | 248 | .dma_ioctl = radeon_cp_buffers, |
234 | .fops = { | 249 | .fops = &radeon_driver_old_fops, |
235 | .owner = THIS_MODULE, | ||
236 | .open = drm_open, | ||
237 | .release = drm_release, | ||
238 | .unlocked_ioctl = drm_ioctl, | ||
239 | .mmap = drm_mmap, | ||
240 | .poll = drm_poll, | ||
241 | .fasync = drm_fasync, | ||
242 | .read = drm_read, | ||
243 | #ifdef CONFIG_COMPAT | ||
244 | .compat_ioctl = radeon_compat_ioctl, | ||
245 | #endif | ||
246 | .llseek = noop_llseek, | ||
247 | }, | ||
248 | |||
249 | .name = DRIVER_NAME, | 250 | .name = DRIVER_NAME, |
250 | .desc = DRIVER_DESC, | 251 | .desc = DRIVER_DESC, |
251 | .date = DRIVER_DATE, | 252 | .date = DRIVER_DATE, |
@@ -303,6 +304,20 @@ radeon_pci_resume(struct pci_dev *pdev) | |||
303 | return radeon_resume_kms(dev); | 304 | return radeon_resume_kms(dev); |
304 | } | 305 | } |
305 | 306 | ||
307 | static const struct file_operations radeon_driver_kms_fops = { | ||
308 | .owner = THIS_MODULE, | ||
309 | .open = drm_open, | ||
310 | .release = drm_release, | ||
311 | .unlocked_ioctl = drm_ioctl, | ||
312 | .mmap = radeon_mmap, | ||
313 | .poll = drm_poll, | ||
314 | .fasync = drm_fasync, | ||
315 | .read = drm_read, | ||
316 | #ifdef CONFIG_COMPAT | ||
317 | .compat_ioctl = radeon_kms_compat_ioctl, | ||
318 | #endif | ||
319 | }; | ||
320 | |||
306 | static struct drm_driver kms_driver = { | 321 | static struct drm_driver kms_driver = { |
307 | .driver_features = | 322 | .driver_features = |
308 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | | 323 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | |
@@ -338,20 +353,7 @@ static struct drm_driver kms_driver = { | |||
338 | .dumb_create = radeon_mode_dumb_create, | 353 | .dumb_create = radeon_mode_dumb_create, |
339 | .dumb_map_offset = radeon_mode_dumb_mmap, | 354 | .dumb_map_offset = radeon_mode_dumb_mmap, |
340 | .dumb_destroy = radeon_mode_dumb_destroy, | 355 | .dumb_destroy = radeon_mode_dumb_destroy, |
341 | .fops = { | 356 | .fops = &radeon_driver_kms_fops, |
342 | .owner = THIS_MODULE, | ||
343 | .open = drm_open, | ||
344 | .release = drm_release, | ||
345 | .unlocked_ioctl = drm_ioctl, | ||
346 | .mmap = radeon_mmap, | ||
347 | .poll = drm_poll, | ||
348 | .fasync = drm_fasync, | ||
349 | .read = drm_read, | ||
350 | #ifdef CONFIG_COMPAT | ||
351 | .compat_ioctl = radeon_kms_compat_ioctl, | ||
352 | #endif | ||
353 | }, | ||
354 | |||
355 | .name = DRIVER_NAME, | 357 | .name = DRIVER_NAME, |
356 | .desc = DRIVER_DESC, | 358 | .desc = DRIVER_DESC, |
357 | .date = DRIVER_DATE, | 359 | .date = DRIVER_DATE, |
diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c index 5468d1cd3296..89afe0b83643 100644 --- a/drivers/gpu/drm/savage/savage_drv.c +++ b/drivers/gpu/drm/savage/savage_drv.c | |||
@@ -35,6 +35,17 @@ static struct pci_device_id pciidlist[] = { | |||
35 | savage_PCI_IDS | 35 | savage_PCI_IDS |
36 | }; | 36 | }; |
37 | 37 | ||
38 | static const struct file_operations savage_driver_fops = { | ||
39 | .owner = THIS_MODULE, | ||
40 | .open = drm_open, | ||
41 | .release = drm_release, | ||
42 | .unlocked_ioctl = drm_ioctl, | ||
43 | .mmap = drm_mmap, | ||
44 | .poll = drm_poll, | ||
45 | .fasync = drm_fasync, | ||
46 | .llseek = noop_llseek, | ||
47 | }; | ||
48 | |||
38 | static struct drm_driver driver = { | 49 | static struct drm_driver driver = { |
39 | .driver_features = | 50 | .driver_features = |
40 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_PCI_DMA, | 51 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_PCI_DMA, |
@@ -46,17 +57,7 @@ static struct drm_driver driver = { | |||
46 | .reclaim_buffers = savage_reclaim_buffers, | 57 | .reclaim_buffers = savage_reclaim_buffers, |
47 | .ioctls = savage_ioctls, | 58 | .ioctls = savage_ioctls, |
48 | .dma_ioctl = savage_bci_buffers, | 59 | .dma_ioctl = savage_bci_buffers, |
49 | .fops = { | 60 | .fops = &savage_driver_fops, |
50 | .owner = THIS_MODULE, | ||
51 | .open = drm_open, | ||
52 | .release = drm_release, | ||
53 | .unlocked_ioctl = drm_ioctl, | ||
54 | .mmap = drm_mmap, | ||
55 | .poll = drm_poll, | ||
56 | .fasync = drm_fasync, | ||
57 | .llseek = noop_llseek, | ||
58 | }, | ||
59 | |||
60 | .name = DRIVER_NAME, | 61 | .name = DRIVER_NAME, |
61 | .desc = DRIVER_DESC, | 62 | .desc = DRIVER_DESC, |
62 | .date = DRIVER_DATE, | 63 | .date = DRIVER_DATE, |
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c index a9c5716bea4e..bda96a8cd939 100644 --- a/drivers/gpu/drm/sis/sis_drv.c +++ b/drivers/gpu/drm/sis/sis_drv.c | |||
@@ -65,6 +65,17 @@ static int sis_driver_unload(struct drm_device *dev) | |||
65 | return 0; | 65 | return 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | static const struct file_operations sis_driver_fops = { | ||
69 | .owner = THIS_MODULE, | ||
70 | .open = drm_open, | ||
71 | .release = drm_release, | ||
72 | .unlocked_ioctl = drm_ioctl, | ||
73 | .mmap = drm_mmap, | ||
74 | .poll = drm_poll, | ||
75 | .fasync = drm_fasync, | ||
76 | .llseek = noop_llseek, | ||
77 | }; | ||
78 | |||
68 | static struct drm_driver driver = { | 79 | static struct drm_driver driver = { |
69 | .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR, | 80 | .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR, |
70 | .load = sis_driver_load, | 81 | .load = sis_driver_load, |
@@ -74,17 +85,7 @@ static struct drm_driver driver = { | |||
74 | .reclaim_buffers_idlelocked = sis_reclaim_buffers_locked, | 85 | .reclaim_buffers_idlelocked = sis_reclaim_buffers_locked, |
75 | .lastclose = sis_lastclose, | 86 | .lastclose = sis_lastclose, |
76 | .ioctls = sis_ioctls, | 87 | .ioctls = sis_ioctls, |
77 | .fops = { | 88 | .fops = &sis_driver_fops, |
78 | .owner = THIS_MODULE, | ||
79 | .open = drm_open, | ||
80 | .release = drm_release, | ||
81 | .unlocked_ioctl = drm_ioctl, | ||
82 | .mmap = drm_mmap, | ||
83 | .poll = drm_poll, | ||
84 | .fasync = drm_fasync, | ||
85 | .llseek = noop_llseek, | ||
86 | }, | ||
87 | |||
88 | .name = DRIVER_NAME, | 89 | .name = DRIVER_NAME, |
89 | .desc = DRIVER_DESC, | 90 | .desc = DRIVER_DESC, |
90 | .date = DRIVER_DATE, | 91 | .date = DRIVER_DATE, |
diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c index cda29911e332..1613c78544c0 100644 --- a/drivers/gpu/drm/tdfx/tdfx_drv.c +++ b/drivers/gpu/drm/tdfx/tdfx_drv.c | |||
@@ -41,20 +41,21 @@ static struct pci_device_id pciidlist[] = { | |||
41 | tdfx_PCI_IDS | 41 | tdfx_PCI_IDS |
42 | }; | 42 | }; |
43 | 43 | ||
44 | static const struct file_operations tdfx_driver_fops = { | ||
45 | .owner = THIS_MODULE, | ||
46 | .open = drm_open, | ||
47 | .release = drm_release, | ||
48 | .unlocked_ioctl = drm_ioctl, | ||
49 | .mmap = drm_mmap, | ||
50 | .poll = drm_poll, | ||
51 | .fasync = drm_fasync, | ||
52 | .llseek = noop_llseek, | ||
53 | }; | ||
54 | |||
44 | static struct drm_driver driver = { | 55 | static struct drm_driver driver = { |
45 | .driver_features = DRIVER_USE_MTRR, | 56 | .driver_features = DRIVER_USE_MTRR, |
46 | .reclaim_buffers = drm_core_reclaim_buffers, | 57 | .reclaim_buffers = drm_core_reclaim_buffers, |
47 | .fops = { | 58 | .fops = &tdfx_driver_fops, |
48 | .owner = THIS_MODULE, | ||
49 | .open = drm_open, | ||
50 | .release = drm_release, | ||
51 | .unlocked_ioctl = drm_ioctl, | ||
52 | .mmap = drm_mmap, | ||
53 | .poll = drm_poll, | ||
54 | .fasync = drm_fasync, | ||
55 | .llseek = noop_llseek, | ||
56 | }, | ||
57 | |||
58 | .name = DRIVER_NAME, | 59 | .name = DRIVER_NAME, |
59 | .desc = DRIVER_DESC, | 60 | .desc = DRIVER_DESC, |
60 | .date = DRIVER_DATE, | 61 | .date = DRIVER_DATE, |
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c index a83e86d3956c..fb43fd368ce1 100644 --- a/drivers/gpu/drm/via/via_drv.c +++ b/drivers/gpu/drm/via/via_drv.c | |||
@@ -34,6 +34,17 @@ static struct pci_device_id pciidlist[] = { | |||
34 | viadrv_PCI_IDS | 34 | viadrv_PCI_IDS |
35 | }; | 35 | }; |
36 | 36 | ||
37 | static const struct file_operations via_driver_fops = { | ||
38 | .owner = THIS_MODULE, | ||
39 | .open = drm_open, | ||
40 | .release = drm_release, | ||
41 | .unlocked_ioctl = drm_ioctl, | ||
42 | .mmap = drm_mmap, | ||
43 | .poll = drm_poll, | ||
44 | .fasync = drm_fasync, | ||
45 | .llseek = noop_llseek, | ||
46 | }; | ||
47 | |||
37 | static struct drm_driver driver = { | 48 | static struct drm_driver driver = { |
38 | .driver_features = | 49 | .driver_features = |
39 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | | 50 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | |
@@ -54,17 +65,7 @@ static struct drm_driver driver = { | |||
54 | .reclaim_buffers_idlelocked = via_reclaim_buffers_locked, | 65 | .reclaim_buffers_idlelocked = via_reclaim_buffers_locked, |
55 | .lastclose = via_lastclose, | 66 | .lastclose = via_lastclose, |
56 | .ioctls = via_ioctls, | 67 | .ioctls = via_ioctls, |
57 | .fops = { | 68 | .fops = &via_driver_fops, |
58 | .owner = THIS_MODULE, | ||
59 | .open = drm_open, | ||
60 | .release = drm_release, | ||
61 | .unlocked_ioctl = drm_ioctl, | ||
62 | .mmap = drm_mmap, | ||
63 | .poll = drm_poll, | ||
64 | .fasync = drm_fasync, | ||
65 | .llseek = noop_llseek, | ||
66 | }, | ||
67 | |||
68 | .name = DRIVER_NAME, | 69 | .name = DRIVER_NAME, |
69 | .desc = DRIVER_DESC, | 70 | .desc = DRIVER_DESC, |
70 | .date = DRIVER_DATE, | 71 | .date = DRIVER_DATE, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index dff8fc767152..f390f5f9cb68 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -1064,6 +1064,21 @@ static const struct dev_pm_ops vmw_pm_ops = { | |||
1064 | .resume = vmw_pm_resume, | 1064 | .resume = vmw_pm_resume, |
1065 | }; | 1065 | }; |
1066 | 1066 | ||
1067 | static const struct file_operations vmwgfx_driver_fops = { | ||
1068 | .owner = THIS_MODULE, | ||
1069 | .open = drm_open, | ||
1070 | .release = drm_release, | ||
1071 | .unlocked_ioctl = vmw_unlocked_ioctl, | ||
1072 | .mmap = vmw_mmap, | ||
1073 | .poll = vmw_fops_poll, | ||
1074 | .read = vmw_fops_read, | ||
1075 | .fasync = drm_fasync, | ||
1076 | #if defined(CONFIG_COMPAT) | ||
1077 | .compat_ioctl = drm_compat_ioctl, | ||
1078 | #endif | ||
1079 | .llseek = noop_llseek, | ||
1080 | }; | ||
1081 | |||
1067 | static struct drm_driver driver = { | 1082 | static struct drm_driver driver = { |
1068 | .driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | | 1083 | .driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | |
1069 | DRIVER_MODESET, | 1084 | DRIVER_MODESET, |
@@ -1088,20 +1103,7 @@ static struct drm_driver driver = { | |||
1088 | .master_drop = vmw_master_drop, | 1103 | .master_drop = vmw_master_drop, |
1089 | .open = vmw_driver_open, | 1104 | .open = vmw_driver_open, |
1090 | .postclose = vmw_postclose, | 1105 | .postclose = vmw_postclose, |
1091 | .fops = { | 1106 | .fops = &vmwgfx_driver_fops, |
1092 | .owner = THIS_MODULE, | ||
1093 | .open = drm_open, | ||
1094 | .release = drm_release, | ||
1095 | .unlocked_ioctl = vmw_unlocked_ioctl, | ||
1096 | .mmap = vmw_mmap, | ||
1097 | .poll = vmw_fops_poll, | ||
1098 | .read = vmw_fops_read, | ||
1099 | .fasync = drm_fasync, | ||
1100 | #if defined(CONFIG_COMPAT) | ||
1101 | .compat_ioctl = drm_compat_ioctl, | ||
1102 | #endif | ||
1103 | .llseek = noop_llseek, | ||
1104 | }, | ||
1105 | .name = VMWGFX_DRIVER_NAME, | 1107 | .name = VMWGFX_DRIVER_NAME, |
1106 | .desc = VMWGFX_DRIVER_DESC, | 1108 | .desc = VMWGFX_DRIVER_DESC, |
1107 | .date = VMWGFX_DRIVER_DATE, | 1109 | .date = VMWGFX_DRIVER_DATE, |