aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
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/radeon
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/radeon')
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c60
1 files changed, 31 insertions, 29 deletions
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[] = {
205MODULE_DEVICE_TABLE(pci, pciidlist); 205MODULE_DEVICE_TABLE(pci, pciidlist);
206#endif 206#endif
207 207
208static 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
208static struct drm_driver driver_old = { 223static 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
307static 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
306static struct drm_driver kms_driver = { 321static 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,