Skip to content

Commit

Permalink
drm: misc cleanup
Browse files Browse the repository at this point in the history
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 <bunk@stusta.de>
Signed-off-by: Dave Airlie <airlied@linux.ie>
  • Loading branch information
Dave Airlie authored and Dave Airlie committed Jul 7, 2005
1 parent b952324 commit c94f702
Show file tree
Hide file tree
Showing 23 changed files with 135 additions and 178 deletions.
2 changes: 1 addition & 1 deletion drivers/char/drm/ati_pcigart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 0 additions & 22 deletions drivers/char/drm/drmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,6 @@ extern int drm_cpu_valid( void );
/* 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,
Expand All @@ -785,21 +783,13 @@ extern int drm_takedown(drm_device_t * dev);
/* 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"
Expand Down Expand Up @@ -853,9 +843,6 @@ extern int drm_newctx( struct inode *inode, struct file *filp,
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 );
Expand All @@ -873,9 +860,6 @@ extern int drm_rmdraw(struct inode *inode, struct file *filp,


/* 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,
Expand All @@ -892,13 +876,9 @@ extern int drm_unlock(struct inode *inode, struct file *filp,
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 );
Expand Down Expand Up @@ -926,7 +906,6 @@ extern void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp);
/* 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 );
Expand Down Expand Up @@ -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,
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;
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/drm/drm_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* 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;
Expand Down Expand Up @@ -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
* 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;
Expand Down
12 changes: 6 additions & 6 deletions drivers/char/drm/drm_bufs.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ 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
* 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->head->dev;
Expand Down Expand Up @@ -521,8 +521,8 @@ int drm_addbufs_agp( struct inode *inode, struct file *filp,
}
#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->head->dev;
Expand Down Expand Up @@ -751,8 +751,8 @@ int drm_addbufs_pci( struct inode *inode, struct file *filp,

}

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->head->dev;
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/drm/drm_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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::struct_sem lock.
*/
int drm_ctxbitmap_next( drm_device_t *dev )
static int drm_ctxbitmap_next( drm_device_t *dev )
{
int bit;

Expand Down Expand Up @@ -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
* 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;
Expand Down
9 changes: 6 additions & 3 deletions drivers/char/drm/drm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,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 },
Expand Down Expand Up @@ -447,8 +450,8 @@ module_exit( drm_core_exit );
*
* 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->head->dev;
Expand Down
10 changes: 3 additions & 7 deletions drivers/char/drm/drm_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -341,7 +343,7 @@ EXPORT_SYMBOL(drm_release);
* 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;
Expand Down Expand Up @@ -443,9 +445,3 @@ unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
}
EXPORT_SYMBOL(drm_poll);


/** No-op. */
ssize_t drm_read(struct file *filp, char __user *buf, size_t count, loff_t *off)
{
return 0;
}
2 changes: 1 addition & 1 deletion drivers/char/drm/drm_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* 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;
Expand Down
12 changes: 9 additions & 3 deletions drivers/char/drm/drm_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -225,8 +230,9 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
* 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;

Expand Down Expand Up @@ -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
* 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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/drm/drm_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int drm_vma_info(char *buf, char **start, off_t offset,
/**
* 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[] = {
Expand Down
92 changes: 45 additions & 47 deletions drivers/char/drm/drm_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,52 +157,6 @@ int drm_stub_open(struct inode *inode, struct file *filp)
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.
*
Expand All @@ -214,7 +168,7 @@ EXPORT_SYMBOL(drm_get_dev);
* create the proc init entry via proc_init(). This routines assigns
* 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;
int ret;
Expand Down Expand Up @@ -262,6 +216,50 @@ int drm_get_head(drm_device_t *dev, drm_head_t *head)
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.
Expand Down
Loading

0 comments on commit c94f702

Please sign in to comment.