Commit c94f7029 authored by Dave Airlie's avatar Dave Airlie Committed by Dave Airlie

drm: misc cleanup

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: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent b9523249
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
# define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */ # define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */
# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ # 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; unsigned long address;
struct page *page; struct page *page;
......
...@@ -774,8 +774,6 @@ extern int drm_cpu_valid( void ); ...@@ -774,8 +774,6 @@ extern int drm_cpu_valid( void );
/* Driver support (drm_drv.h) */ /* Driver support (drm_drv.h) */
extern int drm_init(struct drm_driver *driver); extern int drm_init(struct drm_driver *driver);
extern void drm_exit(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, extern int drm_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern long drm_compat_ioctl(struct file *filp, extern long drm_compat_ioctl(struct file *filp,
...@@ -785,21 +783,13 @@ extern int drm_takedown(drm_device_t * dev); ...@@ -785,21 +783,13 @@ extern int drm_takedown(drm_device_t * dev);
/* Device support (drm_fops.h) */ /* Device support (drm_fops.h) */
extern int drm_open(struct inode *inode, struct file *filp); extern int drm_open(struct inode *inode, struct file *filp);
extern int drm_stub_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_flush(struct file *filp);
extern int drm_fasync(int fd, struct file *filp, int on); extern int drm_fasync(int fd, struct file *filp, int on);
extern int drm_release(struct inode *inode, struct file *filp); extern int drm_release(struct inode *inode, struct file *filp);
/* Mapping support (drm_vm.h) */ /* 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 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 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) */ /* Memory management support (drm_memory.h) */
#include "drm_memory.h" #include "drm_memory.h"
...@@ -853,9 +843,6 @@ extern int drm_newctx( struct inode *inode, struct file *filp, ...@@ -853,9 +843,6 @@ extern int drm_newctx( struct inode *inode, struct file *filp,
extern int drm_rmctx( struct inode *inode, struct file *filp, extern int drm_rmctx( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ); 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 int drm_ctxbitmap_init( drm_device_t *dev );
extern void drm_ctxbitmap_cleanup( 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 ); extern void drm_ctxbitmap_free( drm_device_t *dev, int ctx_handle );
...@@ -873,9 +860,6 @@ extern int drm_rmdraw(struct inode *inode, struct file *filp, ...@@ -873,9 +860,6 @@ extern int drm_rmdraw(struct inode *inode, struct file *filp,
/* Authentication IOCTL support (drm_auth.h) */ /* 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, extern int drm_getmagic(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern int drm_authmagic(struct inode *inode, struct file *filp, extern int drm_authmagic(struct inode *inode, struct file *filp,
...@@ -892,13 +876,9 @@ extern int drm_unlock(struct inode *inode, struct file *filp, ...@@ -892,13 +876,9 @@ extern int drm_unlock(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern int drm_lock_take(__volatile__ unsigned int *lock, extern int drm_lock_take(__volatile__ unsigned int *lock,
unsigned int context); 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, extern int drm_lock_free(drm_device_t *dev,
__volatile__ unsigned int *lock, __volatile__ unsigned int *lock,
unsigned int context); unsigned int context);
extern int drm_notifier(void *priv);
/* Buffer management support (drm_bufs.h) */ /* Buffer management support (drm_bufs.h) */
extern int drm_order( unsigned long size ); extern int drm_order( unsigned long size );
...@@ -926,7 +906,6 @@ extern void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp); ...@@ -926,7 +906,6 @@ extern void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp);
/* IRQ support (drm_irq.h) */ /* IRQ support (drm_irq.h) */
extern int drm_control( struct inode *inode, struct file *filp, extern int drm_control( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ); 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 int drm_irq_uninstall( drm_device_t *dev );
extern irqreturn_t drm_irq_handler( DRM_IRQ_ARGS ); extern irqreturn_t drm_irq_handler( DRM_IRQ_ARGS );
extern void drm_driver_irq_preinstall( drm_device_t *dev ); extern void drm_driver_irq_preinstall( drm_device_t *dev );
...@@ -966,7 +945,6 @@ extern int drm_agp_unbind_memory(DRM_AGP_MEM *handle); ...@@ -966,7 +945,6 @@ extern int drm_agp_unbind_memory(DRM_AGP_MEM *handle);
extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
struct drm_driver *driver); struct drm_driver *driver);
extern int drm_put_dev(drm_device_t * dev); 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 int drm_put_head(drm_head_t * head);
extern unsigned int drm_debug; extern unsigned int drm_debug;
extern unsigned int drm_cards_limit; extern unsigned int drm_cards_limit;
......
...@@ -87,7 +87,7 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) ...@@ -87,7 +87,7 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
* associated the magic number hash key in drm_device::magiclist, while holding * associated the magic number hash key in drm_device::magiclist, while holding
* the drm_device::struct_sem lock. * 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; int hash;
drm_magic_entry_t *entry; drm_magic_entry_t *entry;
...@@ -124,7 +124,7 @@ int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) ...@@ -124,7 +124,7 @@ int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
* Searches and unlinks the entry in drm_device::magiclist with the magic * Searches and unlinks the entry in drm_device::magiclist with the magic
* number hash key, while holding the drm_device::struct_sem lock. * 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 *prev = NULL;
drm_magic_entry_t *pt; drm_magic_entry_t *pt;
......
...@@ -356,7 +356,7 @@ static void drm_cleanup_buf_error(drm_device_t *dev, drm_buf_entry_t *entry) ...@@ -356,7 +356,7 @@ static void drm_cleanup_buf_error(drm_device_t *dev, drm_buf_entry_t *entry)
* reallocates the buffer list of the same size order to accommodate the new * reallocates the buffer list of the same size order to accommodate the new
* buffers. * buffers.
*/ */
int drm_addbufs_agp( struct inode *inode, struct file *filp, static int drm_addbufs_agp( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
...@@ -521,7 +521,7 @@ int drm_addbufs_agp( struct inode *inode, struct file *filp, ...@@ -521,7 +521,7 @@ int drm_addbufs_agp( struct inode *inode, struct file *filp,
} }
#endif /* __OS_HAS_AGP */ #endif /* __OS_HAS_AGP */
int drm_addbufs_pci( struct inode *inode, struct file *filp, static int drm_addbufs_pci( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
...@@ -751,7 +751,7 @@ int drm_addbufs_pci( struct inode *inode, struct file *filp, ...@@ -751,7 +751,7 @@ int drm_addbufs_pci( struct inode *inode, struct file *filp,
} }
int drm_addbufs_sg( struct inode *inode, struct file *filp, static int drm_addbufs_sg( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
......
...@@ -84,7 +84,7 @@ void drm_ctxbitmap_free( drm_device_t *dev, int ctx_handle ) ...@@ -84,7 +84,7 @@ void drm_ctxbitmap_free( drm_device_t *dev, int ctx_handle )
* drm_device::context_sareas to accommodate the new entry while holding the * drm_device::context_sareas to accommodate the new entry while holding the
* drm_device::struct_sem lock. * drm_device::struct_sem lock.
*/ */
int drm_ctxbitmap_next( drm_device_t *dev ) static int drm_ctxbitmap_next( drm_device_t *dev )
{ {
int bit; int bit;
...@@ -326,7 +326,7 @@ int drm_context_switch( drm_device_t *dev, int old, int new ) ...@@ -326,7 +326,7 @@ int drm_context_switch( drm_device_t *dev, int old, int new )
* hardware lock is held, clears the drm_device::context_flag and wakes up * hardware lock is held, clears the drm_device::context_flag and wakes up
* drm_device::context_wait. * 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_context = new; /* PRE/POST: This is the _only_ writer. */
dev->last_switch = jiffies; dev->last_switch = jiffies;
......
...@@ -51,8 +51,11 @@ ...@@ -51,8 +51,11 @@
#include "drmP.h" #include "drmP.h"
#include "drm_core.h" #include "drm_core.h"
static int drm_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
/** Ioctl table */ /** 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_VERSION)] = { drm_version, 0, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 },
...@@ -447,7 +450,7 @@ module_exit( drm_core_exit ); ...@@ -447,7 +450,7 @@ module_exit( drm_core_exit );
* *
* Fills in the version information in \p arg. * Fills in the version information in \p arg.
*/ */
int drm_version( struct inode *inode, struct file *filp, static int drm_version( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include "drmP.h" #include "drmP.h"
#include <linux/poll.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 ) static int drm_setup( drm_device_t *dev )
{ {
int i; int i;
...@@ -341,7 +343,7 @@ EXPORT_SYMBOL(drm_release); ...@@ -341,7 +343,7 @@ EXPORT_SYMBOL(drm_release);
* Creates and initializes a drm_file structure for the file private data in \p * 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. * 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); int minor = iminor(inode);
drm_file_t *priv; drm_file_t *priv;
...@@ -443,9 +445,3 @@ unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait) ...@@ -443,9 +445,3 @@ unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
} }
EXPORT_SYMBOL(drm_poll); EXPORT_SYMBOL(drm_poll);
/** No-op. */
ssize_t drm_read(struct file *filp, char __user *buf, size_t count, loff_t *off)
{
return 0;
}
...@@ -89,7 +89,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp, ...@@ -89,7 +89,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
* \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions * \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions
* before and after the installation. * before and after the installation.
*/ */
int drm_irq_install( drm_device_t *dev ) static int drm_irq_install( drm_device_t *dev )
{ {
int ret; int ret;
unsigned long sh_flags=0; unsigned long sh_flags=0;
......
...@@ -35,6 +35,11 @@ ...@@ -35,6 +35,11 @@
#include "drmP.h" #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. * Lock ioctl.
* *
...@@ -225,8 +230,9 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context) ...@@ -225,8 +230,9 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
* Resets the lock file pointer. * Resets the lock file pointer.
* Marks the lock as held by the given context, via the \p cmpxchg instruction. * Marks the lock as held by the given context, via the \p cmpxchg instruction.
*/ */
int drm_lock_transfer(drm_device_t *dev, static int drm_lock_transfer(drm_device_t *dev,
__volatile__ unsigned int *lock, unsigned int context) __volatile__ unsigned int *lock,
unsigned int context)
{ {
unsigned int old, new, prev; unsigned int old, new, prev;
...@@ -282,7 +288,7 @@ int drm_lock_free(drm_device_t *dev, ...@@ -282,7 +288,7 @@ int drm_lock_free(drm_device_t *dev,
* \return one if the signal should be delivered normally, or zero if the * \return one if the signal should be delivered normally, or zero if the
* signal should be blocked. * signal should be blocked.
*/ */
int drm_notifier(void *priv) static int drm_notifier(void *priv)
{ {
drm_sigdata_t *s = (drm_sigdata_t *)priv; drm_sigdata_t *s = (drm_sigdata_t *)priv;
unsigned int old, new, prev; unsigned int old, new, prev;
......
...@@ -57,7 +57,7 @@ static int drm_vma_info(char *buf, char **start, off_t offset, ...@@ -57,7 +57,7 @@ static int drm_vma_info(char *buf, char **start, off_t offset,
/** /**
* Proc file list. * Proc file list.
*/ */
struct drm_proc_list { static struct drm_proc_list {
const char *name; /**< file name */ const char *name; /**< file name */
int (*f)(char *, char **, off_t, int, int *, void *); /**< proc callback*/ int (*f)(char *, char **, off_t, int, int *, void *); /**< proc callback*/
} drm_proc_list[] = { } drm_proc_list[] = {
......
...@@ -157,52 +157,6 @@ int drm_stub_open(struct inode *inode, struct file *filp) ...@@ -157,52 +157,6 @@ int drm_stub_open(struct inode *inode, struct file *filp)
return err; return err;
} }
/**
* Register.
*
* \param pdev - PCI device structure
* \param ent entry from the PCI ID table with device type flags
* \return zero on success or a negative number on failure.
*
* Attempt to gets inter module "drm" information. If we are first
* then register the character device and inter module information.
* Try and register, if we fail to register, backout previous work.
*/
int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
struct drm_driver *driver)
{
drm_device_t *dev;
int ret;
DRM_DEBUG("\n");
dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB);
if (!dev)
return -ENOMEM;
pci_enable_device(pdev);
if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
goto err_g1;
}
if ((ret = drm_get_head(dev, &dev->primary)))
goto err_g1;
/* postinit is a required function to display the signon banner */
/* drivers add secondary heads here if needed */
if ((ret = dev->driver->postinit(dev, ent->driver_data)))
goto err_g1;
return 0;
err_g1:
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
return ret;
}
EXPORT_SYMBOL(drm_get_dev);
/** /**
* Get a secondary minor number. * Get a secondary minor number.
* *
...@@ -214,7 +168,7 @@ EXPORT_SYMBOL(drm_get_dev); ...@@ -214,7 +168,7 @@ EXPORT_SYMBOL(drm_get_dev);
* create the proc init entry via proc_init(). This routines assigns * create the proc init entry via proc_init(). This routines assigns
* minor numbers to secondary heads of multi-headed cards * minor numbers to secondary heads of multi-headed cards
*/ */
int drm_get_head(drm_device_t *dev, drm_head_t *head) static int drm_get_head(drm_device_t *dev, drm_head_t *head)
{ {
drm_head_t **heads = drm_heads; drm_head_t **heads = drm_heads;
int ret; int ret;
...@@ -262,6 +216,50 @@ int drm_get_head(drm_device_t *dev, drm_head_t *head) ...@@ -262,6 +216,50 @@ int drm_get_head(drm_device_t *dev, drm_head_t *head)
return ret; return ret;
} }
/**
* Register.
*
* \param pdev - PCI device structure
* \param ent entry from the PCI ID table with device type flags
* \return zero on success or a negative number on failure.
*
* Attempt to gets inter module "drm" information. If we are first
* then register the character device and inter module information.
* Try and register, if we fail to register, backout previous work.
*/
int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
struct drm_driver *driver)
{
drm_device_t *dev;
int ret;
DRM_DEBUG("\n");
dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB);
if (!dev)
return -ENOMEM;
pci_enable_device(pdev);
if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
goto err_g1;
}
if ((ret = drm_get_head(dev, &dev->primary)))
goto err_g1;
/* postinit is a required function to display the signon banner */
/* drivers add secondary heads here if needed */
if ((ret = dev->driver->postinit(dev, ent->driver_data)))
goto err_g1;
return 0;
err_g1:
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
return ret;
}
EXPORT_SYMBOL(drm_get_dev);
/** /**
* Put a device minor number. * Put a device minor number.
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <linux/efi.h> #include <linux/efi.h>
#endif #endif
static void drm_vm_open(struct vm_area_struct *vma);
static void drm_vm_close(struct vm_area_struct *vma);
/** /**
* \c nopage method for AGP virtual memory. * \c nopage method for AGP virtual memory.
...@@ -163,7 +165,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, ...@@ -163,7 +165,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
* Deletes map information if we are the last * Deletes map information if we are the last
* person to close a mapping and it's not in the global maplist. * 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_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
...@@ -399,7 +401,7 @@ static struct vm_operations_struct drm_vm_sg_ops = { ...@@ -399,7 +401,7 @@ static struct vm_operations_struct drm_vm_sg_ops = {
* Create a new drm_vma_entry structure as the \p vma private data entry and * Create a new drm_vma_entry structure as the \p vma private data entry and
* add it to drm_device::vmalist. * 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_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
...@@ -428,7 +430,7 @@ void drm_vm_open(struct vm_area_struct *vma) ...@@ -428,7 +430,7 @@ void drm_vm_open(struct vm_area_struct *vma)
* Search the \p vma private data entry in drm_device::vmalist, unlink it, and * Search the \p vma private data entry in drm_device::vmalist, unlink it, and
* free it. * 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_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
...@@ -463,7 +465,7 @@ void drm_vm_close(struct vm_area_struct *vma) ...@@ -463,7 +465,7 @@ void drm_vm_close(struct vm_area_struct *vma)
* Sets the virtual memory area operations structure to vm_dma_ops, the file * Sets the virtual memory area operations structure to vm_dma_ops, the file
* pointer, and calls vm_open(). * 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_file_t *priv = filp->private_data;
drm_device_t *dev; drm_device_t *dev;
......
...@@ -90,16 +90,7 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf) ...@@ -90,16 +90,7 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf)
return 0; return 0;
} }
static struct file_operations i810_buffer_fops = { static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
.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)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev; drm_device_t *dev;
...@@ -126,6 +117,15 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) ...@@ -126,6 +117,15 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
return 0; 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) static int i810_map_buffer(drm_buf_t *buf, struct file *filp)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
...@@ -1003,7 +1003,7 @@ void i810_reclaim_buffers(drm_device_t *dev, struct file *filp) ...@@ -1003,7 +1003,7 @@ void i810_reclaim_buffers(drm_device_t *dev, struct file *filp)
} }
} }
int i810_flush_ioctl(struct inode *inode, struct file *filp, static int i810_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
......
...@@ -115,7 +115,6 @@ typedef struct drm_i810_private { ...@@ -115,7 +115,6 @@ typedef struct drm_i810_private {
/* i810_dma.c */ /* i810_dma.c */
extern void i810_reclaim_buffers(drm_device_t *dev, struct file *filp); 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 int i810_driver_dma_quiescent(drm_device_t *dev);
extern void i810_driver_release(drm_device_t *dev, struct file *filp); extern void i810_driver_release(drm_device_t *dev, struct file *filp);
......
...@@ -92,16 +92,7 @@ static int i830_freelist_put(drm_device_t *dev, drm_buf_t *buf) ...@@ -92,16 +92,7 @@ static int i830_freelist_put(drm_device_t *dev, drm_buf_t *buf)
return 0; return 0;
} }
static struct file_operations i830_buffer_fops = { static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
.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)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev; drm_device_t *dev;
...@@ -128,6 +119,15 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) ...@@ -128,6 +119,15 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
return 0; 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) static int i830_map_buffer(drm_buf_t *buf, struct file *filp)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include "drm_pciids.h" #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->counters += 4;
dev->types[6] = _DRM_STAT_IRQ; dev->types[6] = _DRM_STAT_IRQ;
......
...@@ -123,8 +123,6 @@ typedef struct drm_i830_private { ...@@ -123,8 +123,6 @@ typedef struct drm_i830_private {
/* i830_dma.c */ /* i830_dma.c */
extern void i830_reclaim_buffers(drm_device_t *dev, struct file *filp); 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 */ /* i830_irq.c */
extern int i830_irq_emit( struct inode *inode, struct file *filp, extern int i830_irq_emit( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ); unsigned int cmd, unsigned long arg );
......
...@@ -54,8 +54,7 @@ irqreturn_t i830_driver_irq_handler( DRM_IRQ_ARGS ) ...@@ -54,8 +54,7 @@ irqreturn_t i830_driver_irq_handler( DRM_IRQ_ARGS )
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int i830_emit_irq(drm_device_t *dev)
int i830_emit_irq(drm_device_t *dev)
{ {
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
RING_LOCALS; RING_LOCALS;
...@@ -73,7 +72,7 @@ int i830_emit_irq(drm_device_t *dev) ...@@ -73,7 +72,7 @@ int i830_emit_irq(drm_device_t *dev)
} }
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_priv =
(drm_i830_private_t *)dev->dev_private; (drm_i830_private_t *)dev->dev_private;
......
...@@ -32,23 +32,6 @@ ...@@ -32,23 +32,6 @@
#include "i915_drm.h" #include "i915_drm.h"
#include "i915_drv.h" #include "i915_drv.h"
drm_ioctl_desc_t i915_ioctls[] = {
[DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1},
[DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0},
[DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0},
[DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0},
[DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0},
[DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0},
[DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0},
[DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1},
[DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0},
[DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0},
[DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1},
[DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0}
};
int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
/* Really want an OS-independent resettable timer. Would like to have /* Really want an OS-independent resettable timer. Would like to have
* this loop run for (eg) 3 sec, but have the timer reset every time * this loop run for (eg) 3 sec, but have the timer reset every time
* the head pointer changes, so that EBUSY only happens if the ring * the head pointer changes, so that EBUSY only happens if the ring
...@@ -95,7 +78,7 @@ void i915_kernel_lost_context(drm_device_t * dev) ...@@ -95,7 +78,7 @@ void i915_kernel_lost_context(drm_device_t * dev)
dev_priv->sarea_priv->perf_boxes |= I915_BOX_RING_EMPTY; dev_priv->sarea_priv->perf_boxes |= I915_BOX_RING_EMPTY;
} }
int i915_dma_cleanup(drm_device_t * dev) static int i915_dma_cleanup(drm_device_t * dev)
{ {
/* Make sure interrupts are disabled here because the uninstall ioctl /* Make sure interrupts are disabled here because the uninstall ioctl
* may not have been called from userspace and after dev_private * may not have been called from userspace and after dev_private
...@@ -247,7 +230,7 @@ static int i915_resume(drm_device_t * dev) ...@@ -247,7 +230,7 @@ static int i915_resume(drm_device_t * dev)
return 0; return 0;
} }
int i915_dma_init(DRM_IOCTL_ARGS) static int i915_dma_init(DRM_IOCTL_ARGS)
{ {
DRM_DEVICE; DRM_DEVICE;
drm_i915_private_t *dev_priv; drm_i915_private_t *dev_priv;
...@@ -558,7 +541,7 @@ static int i915_quiescent(drm_device_t * dev) ...@@ -558,7 +541,7 @@ static int i915_quiescent(drm_device_t * dev)
return i915_wait_ring(dev, dev_priv->ring.Size - 8, __FUNCTION__); return i915_wait_ring(dev, dev_priv->ring.Size - 8, __FUNCTION__);
} }
int i915_flush_ioctl(DRM_IOCTL_ARGS) static int i915_flush_ioctl(DRM_IOCTL_ARGS)
{ {
DRM_DEVICE; DRM_DEVICE;
...@@ -567,7 +550,7 @@ int i915_flush_ioctl(DRM_IOCTL_ARGS) ...@@ -567,7 +550,7 @@ int i915_flush_ioctl(DRM_IOCTL_ARGS)
return i915_quiescent(dev); return i915_quiescent(dev);
} }
int i915_batchbuffer(DRM_IOCTL_ARGS) static int i915_batchbuffer(DRM_IOCTL_ARGS)
{ {
DRM_DEVICE; DRM_DEVICE;
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
...@@ -601,7 +584,7 @@ int i915_batchbuffer(DRM_IOCTL_ARGS) ...@@ -601,7 +584,7 @@ int i915_batchbuffer(DRM_IOCTL_ARGS)
return ret; return ret;
} }
int i915_cmdbuffer(DRM_IOCTL_ARGS) static int i915_cmdbuffer(DRM_IOCTL_ARGS)
{ {
DRM_DEVICE; DRM_DEVICE;
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
...@@ -637,18 +620,7 @@ int i915_cmdbuffer(DRM_IOCTL_ARGS) ...@@ -637,18 +620,7 @@ int i915_cmdbuffer(DRM_IOCTL_ARGS)
return 0; return 0;
} }
int i915_do_cleanup_pageflip(drm_device_t * dev) static int i915_flip_bufs(DRM_IOCTL_ARGS)
{
drm_i915_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("%s\n", __FUNCTION__);
if (dev_priv->current_page != 0)
i915_dispatch_flip(dev);
return 0;
}
int i915_flip_bufs(DRM_IOCTL_ARGS)
{ {
DRM_DEVICE; DRM_DEVICE;
...@@ -659,7 +631,7 @@ int i915_flip_bufs(DRM_IOCTL_ARGS) ...@@ -659,7 +631,7 @@ int i915_flip_bufs(DRM_IOCTL_ARGS)
return i915_dispatch_flip(dev); return i915_dispatch_flip(dev);
} }
int i915_getparam(DRM_IOCTL_ARGS) static int i915_getparam(DRM_IOCTL_ARGS)
{ {
DRM_DEVICE; DRM_DEVICE;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
...@@ -694,7 +666,7 @@ int i915_getparam(DRM_IOCTL_ARGS) ...@@ -694,7 +666,7 @@ int i915_getparam(DRM_IOCTL_ARGS)
return 0; return 0;
} }
int i915_setparam(DRM_IOCTL_ARGS) static int i915_setparam(DRM_IOCTL_ARGS)
{ {
DRM_DEVICE; DRM_DEVICE;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
...@@ -743,3 +715,19 @@ void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp) ...@@ -743,3 +715,19 @@ void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp)
} }
} }
drm_ioctl_desc_t i915_ioctls[] = {
[DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1},
[DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0},
[DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0},
[DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0},
[DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0},
[DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0},
[DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0},
[DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1},
[DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0},
[DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0},
[DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1},
[DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0}
};
int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "drm_pciids.h" #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->counters += 4;
dev->types[6] = _DRM_STAT_IRQ; dev->types[6] = _DRM_STAT_IRQ;
......
...@@ -99,14 +99,6 @@ typedef struct drm_i915_private { ...@@ -99,14 +99,6 @@ typedef struct drm_i915_private {
} drm_i915_private_t; } drm_i915_private_t;
/* i915_dma.c */ /* 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_kernel_lost_context(drm_device_t * dev);
extern void i915_driver_pretakedown(drm_device_t *dev); extern void i915_driver_pretakedown(drm_device_t *dev);
extern void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp); extern void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp);
...@@ -114,8 +106,6 @@ extern void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp); ...@@ -114,8 +106,6 @@ extern void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp);
/* i915_irq.c */ /* i915_irq.c */
extern int i915_irq_emit(DRM_IOCTL_ARGS); extern int i915_irq_emit(DRM_IOCTL_ARGS);
extern int i915_irq_wait(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 irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS);
extern void i915_driver_irq_preinstall(drm_device_t *dev); extern void i915_driver_irq_preinstall(drm_device_t *dev);
......
...@@ -56,7 +56,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) ...@@ -56,7 +56,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
return IRQ_HANDLED; 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; drm_i915_private_t *dev_priv = dev->dev_private;
u32 ret; u32 ret;
...@@ -76,7 +76,7 @@ int i915_emit_irq(drm_device_t * dev) ...@@ -76,7 +76,7 @@ int i915_emit_irq(drm_device_t * dev)
return ret; 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; drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int ret = 0; int ret = 0;
......
...@@ -1307,7 +1307,7 @@ static int r128_do_init_pageflip( drm_device_t *dev ) ...@@ -1307,7 +1307,7 @@ static int r128_do_init_pageflip( drm_device_t *dev )
return 0; 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_r128_private_t *dev_priv = dev->dev_private;
DRM_DEBUG( "\n" ); DRM_DEBUG( "\n" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment