DRM: misc cleanup
PATCH 1/1 DRM: misc cleanup
I've seen that part of this is already in recent kernels.
Below is as a FYI a version against 2.6.13-rc1-mm1.
<-- snip -->
This patch contains the following cleanups:
- make needlessly global functions static
- remove the following unused global functions:
- drm_fops.c: drm_read
- i915_dma.c: i915_do_cleanup_pageflip
Signed-off-by Adrian Bunk <[email protected]>
---
drivers/char/drm/ati_pcigart.c | 2 drivers/char/drm/drmP.h | 22 ------- drivers/char/drm/drm_auth.c | 4 - drivers/char/drm/drm_bufs.c | 12 ++-- drivers/char/drm/drm_context.c | 6 +- drivers/char/drm/drm_drv.c | 9 ++- drivers/char/drm/drm_fops.c | 10 +-- drivers/char/drm/drm_irq.c | 2 drivers/char/drm/drm_lock.c | 12 +++- drivers/char/drm/drm_proc.c | 2 drivers/char/drm/drm_stub.c | 92 ++++++++++++++++----------------- drivers/char/drm/drm_vm.c | 10 ++- drivers/char/drm/i810_dma.c | 24 ++++---- drivers/char/drm/i810_drv.h | 1 drivers/char/drm/i830_dma.c | 20 +++---- drivers/char/drm/i830_drv.c | 2 drivers/char/drm/i830_drv.h | 2 drivers/char/drm/i830_irq.c | 4 - drivers/char/drm/i915_dma.c | 60 ++++++++------------- drivers/char/drm/i915_drv.c | 2 drivers/char/drm/i915_drv.h | 10 --- drivers/char/drm/i915_irq.c | 4 - drivers/char/drm/r128_state.c | 2 drivers/char/drm/via_ds.c | 1 24 files changed, 137 insertions(+), 178 deletions(-)
drivers/char/drm/drmP.h renamed from drivers/char/drm/drmP.h.old +0 -22
@@ -774,8 +774,6 @@/* Driver support (drm_drv.h) */ extern int drm_init (struct drm_driver *driver);extern void drm_exit (struct drm_driver *driver); -extern int drm_version (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg);extern int drm_ioctl (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg); extern long drm_compat_ioctl(struct file *filp,
@@ -785,21 +783,13 @@/* Device support (drm_fops.h) */ extern int drm_open (struct inode *inode,struct file *filp);extern int drm_stub_open (struct inode *inode,struct file *filp); -extern int drm_open_helper (struct inode *inode,struct file *filp, -drm_device_t *dev);extern int drm_flush (struct file *filp);extern int drm_fasync (int fd,struct file *filp,int on);extern int drm_release (struct inode *inode,struct file *filp);/* Mapping support (drm_vm.h) */ -extern void drm_vm_open (struct vm_area_struct *vma); -extern void drm_vm_close (struct vm_area_struct *vma); -extern void drm_vm_shm_close (struct vm_area_struct *vma); -extern int drm_mmap_dma (struct file *filp, -struct vm_area_struct *vma);extern int drm_mmap (struct file *filp,struct vm_area_struct *vma);extern unsigned int drm_poll (struct file *filp,struct poll_table_struct *wait); -extern ssize_t drm_read (struct file *filp,char __user *buf,size_t count,loff_t *off);/* Memory management support (drm_memory.h) */ #include "drm_memory.h"
@@ -854,9 +844,6 @@extern int drm_rmctx (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg ); -extern int drm_context_switch (drm_device_t *dev,int old,int new); -extern int drm_context_switch_complete (drm_device_t *dev,int new); -extern int drm_ctxbitmap_init (drm_device_t *dev );extern void drm_ctxbitmap_cleanup (drm_device_t *dev );extern void drm_ctxbitmap_free (drm_device_t *dev,int ctx_handle );
@@ -874,9 +861,6 @@/* Authentication IOCTL support (drm_auth.h) */ -extern int drm_add_magic (drm_device_t *dev,drm_file_t *priv, -drm_magic_t magic); -extern int drm_remove_magic (drm_device_t *dev,drm_magic_t magic);extern int drm_getmagic (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg); extern int drm_authmagic(struct inode *inode, struct file *filp,
@@ -893,13 +877,9 @@ unsigned int cmd, unsigned long arg); extern int drm_lock_take(__volatile__ unsigned int *lock,unsigned int context); -extern int drm_lock_transfer (drm_device_t *dev, - __volatile__ unsigned int *lock, -unsigned int context);extern int drm_lock_free (drm_device_t *dev, __volatile__ unsigned int *lock,unsigned int context); -extern int drm_notifier (void *priv);/* Buffer management support (drm_bufs.h) */ extern int drm_order (unsigned long size );
@@ -927,7 +907,6 @@/* IRQ support (drm_irq.h) */ extern int drm_control (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg ); -extern int drm_irq_install (drm_device_t *dev );extern int drm_irq_uninstall (drm_device_t *dev );extern irqreturn_t drm_irq_handler (DRM_IRQ_ARGS );extern void drm_driver_irq_preinstall (drm_device_t *dev );
@@ -967,7 +946,6 @@extern int drm_get_dev (struct pci_dev *pdev,const struct pci_device_id *ent,struct drm_driver *driver);extern int drm_put_dev (drm_device_t * dev); -extern int drm_get_head (drm_device_t * dev,drm_head_t *head);extern int drm_put_head (drm_head_t * head);extern unsigned int drm_debug;extern unsigned int drm_cards_limit;
drivers/char/drm/drm_stub.c renamed from drivers/char/drm/drm_stub.c.old +46 -46
110 lines not on this page · raw message
drivers/char/drm/i810_drv.h renamed from drivers/char/drm/i810_drv.h.old +0 -1
@@ -115,7 +115,6 @@/* i810_dma.c */ extern void i810_reclaim_buffers (drm_device_t *dev,struct file *filp); -extern int i810_mmap_buffers (struct file *filp,struct vm_area_struct *vma);extern int i810_driver_dma_quiescent (drm_device_t *dev);extern void i810_driver_release (drm_device_t *dev,struct file *filp);
drivers/char/drm/i810_dma.c renamed from drivers/char/drm/i810_dma.c.old +12 -12
@@ -90,16 +90,7 @@return 0 ; } -static struct file_operations i810_buffer_fops = { - .open = drm_open, - .flush = drm_flush, - .release = drm_release, - .ioctl = drm_ioctl, - .mmap = i810_mmap_buffers, - .fasync = drm_fasync, -}; - -int i810_mmap_buffers (struct file *filp,struct vm_area_struct *vma) +static int i810_mmap_buffers (struct file *filp,struct vm_area_struct *vma) {drm_file_t *priv = filp->private_data;drm_device_t *dev;
@@ -126,6 +117,15 @@return 0 ; } +static struct file_operations i810_buffer_fops = { + .open = drm_open, + .flush = drm_flush, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = i810_mmap_buffers, + .fasync = drm_fasync, +}; +static int i810_map_buffer (drm_buf_t *buf,struct file *filp) {drm_file_t *priv = filp->private_data;
@@ -1003,8 +1003,8 @@ } } -int i810_flush_ioctl (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg) +static int i810_flush_ioctl (struct inode *inode,struct file *filp, +unsigned int cmd,unsigned long arg) {drm_file_t *priv = filp->private_data;drm_device_t *dev = priv->head->dev;
drivers/char/drm/r128_state.c renamed from drivers/char/drm/r128_state.c.old +1 -1
@@ -1307,7 +1307,7 @@return 0 ; } -int r128_do_cleanup_pageflip (drm_device_t *dev ) +static int r128_do_cleanup_pageflip (drm_device_t *dev ) {drm_r128_private_t *dev_priv = dev->dev_private;DRM_DEBUG ("\n" );
drivers/char/drm/ati_pcigart.c renamed from drivers/char/drm/ati_pcigart.c.old +1 -1
@@ -52,7 +52,7 @@# define ATI_MAX_PCIGART_PAGES 8192/**< 32 MB aperture, 4K pages */ # define ATI_PCIGART_PAGE_SIZE 4096/**< PCI GART page size */ -unsigned long drm_ati_alloc_pcigart_table (void ) +static unsigned long drm_ati_alloc_pcigart_table (void ) {unsigned long address;struct page *page;
drivers/char/drm/drm_auth.c renamed from drivers/char/drm/drm_auth.c.old +2 -2
@@ -87,7 +87,7 @@* associated the magic number hash key in drm_device::magiclist, while holding * the drm_device::struct_sem lock. */ -int drm_add_magic (drm_device_t *dev,drm_file_t *priv,drm_magic_t magic) +static int drm_add_magic (drm_device_t *dev,drm_file_t *priv,drm_magic_t magic) {int hash;drm_magic_entry_t *entry;
@@ -124,7 +124,7 @@* Searches and unlinks the entry in drm_device::magiclist with the magic * number hash key, while holding the drm_device::struct_sem lock. */ -int drm_remove_magic (drm_device_t *dev,drm_magic_t magic) +static int drm_remove_magic (drm_device_t *dev,drm_magic_t magic) {drm_magic_entry_t *prev =NULL ;drm_magic_entry_t *pt;
drivers/char/drm/drm_bufs.c renamed from drivers/char/drm/drm_bufs.c.old +6 -6
@@ -345,8 +345,8 @@* reallocates the buffer list of the same size order to accommodate the new * buffers. */ -int drm_addbufs_agp (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg ) +static int drm_addbufs_agp (struct inode *inode,struct file *filp, +unsigned int cmd,unsigned long arg ) {drm_file_t *priv = filp->private_data;drm_device_t *dev = priv->dev;
@@ -510,8 +510,8 @@ }#endif /* __OS_HAS_AGP */ -int drm_addbufs_pci (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg ) +static int drm_addbufs_pci (struct inode *inode,struct file *filp, +unsigned int cmd,unsigned long arg ) {drm_file_t *priv = filp->private_data;drm_device_t *dev = priv->dev;
@@ -740,8 +740,8 @@ } -int drm_addbufs_sg (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg ) +static int drm_addbufs_sg (struct inode *inode,struct file *filp, +unsigned int cmd,unsigned long arg ) {drm_file_t *priv = filp->private_data;drm_device_t *dev = priv->dev;
drivers/char/drm/drm_context.c renamed from drivers/char/drm/drm_context.c.old +3 -3
@@ -84,7 +84,7 @@* drm_device::context_sareas to accommodate the new entry while holding the * drm_device::struct_sem lock. */ -int drm_ctxbitmap_next (drm_device_t *dev ) +static int drm_ctxbitmap_next (drm_device_t *dev ) {int bit;
@@ -297,7 +297,7 @@* * Attempt to set drm_device::context_flag. */ -int drm_context_switch (drm_device_t *dev,int old,int new ) +static int drm_context_switch (drm_device_t *dev,int old,int new ) {if (test_and_set_bit (0 , &dev->context_flag ) ) {DRM_ERROR ("Reentering -- FIXME\n" );
@@ -326,7 +326,7 @@* hardware lock is held, clears the drm_device::context_flag and wakes up * drm_device::context_wait. */ -int drm_context_switch_complete (drm_device_t *dev,int new ) +static int drm_context_switch_complete (drm_device_t *dev,int new ) { dev->last_context = new;/* PRE/POST: This is the _only_ writer. */ dev->last_switch = jiffies;
drivers/char/drm/drm_drv.c renamed from drivers/char/drm/drm_drv.c.old +6 -3
@@ -55,8 +55,11 @@#include "drmP.h" #include "drm_core.h" +static int drm_version (struct inode *inode,struct file *filp, +unsigned int cmd,unsigned long arg ); +/** Ioctl table */ -drm_ioctl_desc_t drm_ioctls[] = { +static drm_ioctl_desc_t drm_ioctls[] = { [DRM_IOCTL_NR (DRM_IOCTL_VERSION )] = { drm_version,0 ,0 }, [DRM_IOCTL_NR (DRM_IOCTL_GET_UNIQUE )] = { drm_getunique,0 ,0 }, [DRM_IOCTL_NR (DRM_IOCTL_GET_MAGIC )] = { drm_getmagic,0 ,0 },
@@ -461,8 +464,8 @@* * Fills in the version information in \p arg. */ -int drm_version (struct inode *inode,struct file *filp, -unsigned int cmd,unsigned long arg ) +static int drm_version (struct inode *inode,struct file *filp, +unsigned int cmd,unsigned long arg ) {drm_file_t *priv = filp->private_data;drm_device_t *dev = priv->dev;
drivers/char/drm/drm_fops.c renamed from drivers/char/drm/drm_fops.c.old +3 -7
@@ -37,6 +37,8 @@#include "drmP.h" #include <linux/poll.h> +static int drm_open_helper (struct inode *inode,struct file *filp,drm_device_t *dev); +static int drm_setup (drm_device_t *dev ) {int i;
@@ -339,7 +341,7 @@* Creates and initializes a drm_file structure for the file private data in \p * filp and add it into the double linked list in \p dev. */ -int drm_open_helper (struct inode *inode,struct file *filp,drm_device_t *dev) +static int drm_open_helper (struct inode *inode,struct file *filp,drm_device_t *dev) {int minor =iminor (inode);drm_file_t *priv;
@@ -441,9 +443,3 @@ }EXPORT_SYMBOL (drm_poll); - -/** No-op. */ -ssize_t drm_read (struct file *filp,char __user *buf,size_t count,loff_t *off) -{ -return 0 ; -}
drivers/char/drm/drm_irq.c renamed from drivers/char/drm/drm_irq.c.old +1 -1
@@ -89,7 +89,7 @@* \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions * before and after the installation. */ -int drm_irq_install (drm_device_t *dev ) +static int drm_irq_install (drm_device_t *dev ) {int ret;unsigned long sh_flags=0 ;
drivers/char/drm/drm_lock.c renamed from drivers/char/drm/drm_lock.c.old +9 -3
@@ -35,6 +35,11 @@#include "drmP.h" +static int drm_lock_transfer (drm_device_t *dev, + __volatile__ unsigned int *lock, +unsigned int context); +static int drm_notifier (void *priv); +/** * Lock ioctl. *
@@ -225,8 +230,9 @@* Resets the lock file pointer. * Marks the lock as held by the given context, via the \p cmpxchg instruction. */ -int drm_lock_transfer (drm_device_t *dev, - __volatile__ unsigned int *lock, unsigned int context) +static int drm_lock_transfer (drm_device_t *dev, + __volatile__ unsigned int *lock, +unsigned int context) {unsigned int old, new, prev;
@@ -282,7 +288,7 @@* \return one if the signal should be delivered normally, or zero if the * signal should be blocked. */ -int drm_notifier (void *priv) +static int drm_notifier (void *priv) {drm_sigdata_t *s = (drm_sigdata_t *)priv;unsigned int old, new, prev;
drivers/char/drm/drm_proc.c renamed from drivers/char/drm/drm_proc.c.old +1 -1
@@ -57,7 +57,7 @@/** * Proc file list. */ -struct drm_proc_list { +static struct drm_proc_list {const char *name;/**< file name */ int (*f)(char *,char **,off_t ,int ,int *,void *);/**< proc callback*/ } drm_proc_list[] = {
drivers/char/drm/drm_vm.c renamed from drivers/char/drm/drm_vm.c.old +6 -4
@@ -38,6 +38,8 @@#include <linux/efi.h> #endif +static void drm_vm_close (struct vm_area_struct *vma); +static void drm_vm_open (struct vm_area_struct *vma);/** * \c nopage method for AGP virtual memory.
@@ -163,7 +165,7 @@* Deletes map information if we are the last * person to close a mapping and it's not in the global maplist. */ -void drm_vm_shm_close (struct vm_area_struct *vma) +static void drm_vm_shm_close (struct vm_area_struct *vma) {drm_file_t *priv = vma->vm_file->private_data;drm_device_t *dev = priv->dev;
@@ -399,7 +401,7 @@* Create a new drm_vma_entry structure as the \p vma private data entry and * add it to drm_device::vmalist. */ -void drm_vm_open (struct vm_area_struct *vma) +static void drm_vm_open (struct vm_area_struct *vma) {drm_file_t *priv = vma->vm_file->private_data;drm_device_t *dev = priv->dev;
@@ -428,7 +430,7 @@* Search the \p vma private data entry in drm_device::vmalist, unlink it, and * free it. */ -void drm_vm_close (struct vm_area_struct *vma) +static void drm_vm_close (struct vm_area_struct *vma) {drm_file_t *priv = vma->vm_file->private_data;drm_device_t *dev = priv->dev;
@@ -463,7 +465,7 @@* Sets the virtual memory area operations structure to vm_dma_ops, the file * pointer, and calls vm_open(). */ -int drm_mmap_dma (struct file *filp,struct vm_area_struct *vma) +static int drm_mmap_dma (struct file *filp,struct vm_area_struct *vma) {drm_file_t *priv = filp->private_data;drm_device_t *dev;
drivers/char/drm/i915_drv.h renamed from drivers/char/drm/i915_drv.h.old +0 -10
@@ -79,14 +79,6 @@ } drm_i915_private_t;/* i915_dma.c */ -extern int i915_dma_init (DRM_IOCTL_ARGS ); -extern int i915_dma_cleanup (drm_device_t * dev); -extern int i915_flush_ioctl (DRM_IOCTL_ARGS ); -extern int i915_batchbuffer (DRM_IOCTL_ARGS ); -extern int i915_flip_bufs (DRM_IOCTL_ARGS ); -extern int i915_getparam (DRM_IOCTL_ARGS ); -extern int i915_setparam (DRM_IOCTL_ARGS ); -extern int i915_cmdbuffer (DRM_IOCTL_ARGS );extern void i915_kernel_lost_context (drm_device_t * dev);extern void i915_driver_pretakedown (drm_device_t *dev);extern void i915_driver_prerelease (drm_device_t *dev,DRMFILE filp);
@@ -94,8 +86,6 @@/* i915_irq.c */ extern int i915_irq_emit (DRM_IOCTL_ARGS );extern int i915_irq_wait (DRM_IOCTL_ARGS ); -extern int i915_wait_irq (drm_device_t * dev,int irq_nr); -extern int i915_emit_irq (drm_device_t * dev);extern irqreturn_t i915_driver_irq_handler (DRM_IRQ_ARGS );extern void i915_driver_irq_preinstall (drm_device_t *dev);
drivers/char/drm/i915_dma.c renamed from drivers/char/drm/i915_dma.c.old +24 -36
117 lines not on this page · raw message
drivers/char/drm/i915_drv.c renamed from drivers/char/drm/i915_drv.c.old +1 -1
@@ -15,7 +15,7 @@#include "drm_pciids.h" -int postinit (struct drm_device *dev,unsigned long flags ) +static int postinit (struct drm_device *dev,unsigned long flags ) { dev->counters +=4 ; dev->types[6 ] = _DRM_STAT_IRQ;
drivers/char/drm/i915_irq.c renamed from drivers/char/drm/i915_irq.c.old +2 -2
@@ -36,7 +36,7 @@return IRQ_HANDLED ; } -int i915_emit_irq (drm_device_t * dev) +static int i915_emit_irq (drm_device_t * dev) {drm_i915_private_t *dev_priv = dev->dev_private;u32 ret;
@@ -56,7 +56,7 @@return ret; } -int i915_wait_irq (drm_device_t * dev,int irq_nr) +static int i915_wait_irq (drm_device_t * dev,int irq_nr) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;int ret =0 ;
drivers/char/drm/via_ds.c renamed from drivers/char/drm/via_ds.c.old +0 -1
@@ -32,7 +32,6 @@#include <asm/io.h> #include "via_ds.h" -extern unsigned int VIA_DEBUG ;set_t *via_setInit (void ) {
drivers/char/drm/i830_drv.h renamed from drivers/char/drm/i830_drv.h.old +0 -2
@@ -123,8 +123,6 @@/* i830_dma.c */ extern void i830_reclaim_buffers (drm_device_t *dev,struct file *filp); -extern int i830_mmap_buffers (struct file *filp,struct vm_area_struct *vma); -/* i830_irq.c */ extern int i830_irq_emit (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg );
drivers/char/drm/i830_dma.c renamed from drivers/char/drm/i830_dma.c.old +10 -10
@@ -92,16 +92,7 @@return 0 ; } -static struct file_operations i830_buffer_fops = { - .open = drm_open, - .flush = drm_flush, - .release = drm_release, - .ioctl = drm_ioctl, - .mmap = i830_mmap_buffers, - .fasync = drm_fasync, -}; - -int i830_mmap_buffers (struct file *filp,struct vm_area_struct *vma) +static int i830_mmap_buffers (struct file *filp,struct vm_area_struct *vma) {drm_file_t *priv = filp->private_data;drm_device_t *dev;
@@ -128,6 +119,15 @@return 0 ; } +static struct file_operations i830_buffer_fops = { + .open = drm_open, + .flush = drm_flush, + .release = drm_release, + .ioctl = drm_ioctl, + .mmap = i830_mmap_buffers, + .fasync = drm_fasync, +}; +static int i830_map_buffer (drm_buf_t *buf,struct file *filp) {drm_file_t *priv = filp->private_data;
drivers/char/drm/i830_drv.c renamed from drivers/char/drm/i830_drv.c.old +1 -1
@@ -40,7 +40,7 @@#include "drm_pciids.h" -int postinit (struct drm_device *dev,unsigned long flags ) +static int postinit (struct drm_device *dev,unsigned long flags ) { dev->counters +=4 ; dev->types[6 ] = _DRM_STAT_IRQ;
drivers/char/drm/i830_irq.c renamed from drivers/char/drm/i830_irq.c.old +2 -2
@@ -55,7 +55,7 @@ } -int i830_emit_irq (drm_device_t *dev) +static int i830_emit_irq (drm_device_t *dev) {drm_i830_private_t *dev_priv = dev->dev_private;RING_LOCALS ;
@@ -73,7 +73,7 @@ } -int i830_wait_irq (drm_device_t *dev,int irq_nr) +static int i830_wait_irq (drm_device_t *dev,int irq_nr) {drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;