Remove a bunch of dead code and fix spelling of a couple of comments.

This commit is contained in:
Eric Anholt 2003-04-24 04:50:07 +00:00
parent 00522cedd6
commit bcd527ee71
14 changed files with 12 additions and 296 deletions

View file

@ -80,12 +80,8 @@ typedef struct drm_file drm_file_t;
#define DRM_HASH_SIZE 16 /* Size of key hash table */
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
#define DRM_LOOPING_LIMIT 5000000
#define DRM_BSZ 1024 /* Buffer size for /dev/drm? output */
#define DRM_LOCK_SLICE 1 /* Time slice for lock, in jiffies */
#define DRM_FLAG_DEBUG 0x01
#define DRM_FLAG_NOCTX 0x02
#define DRM_MEM_DMA 0
#define DRM_MEM_SAREA 1
@ -110,12 +106,6 @@ typedef struct drm_file drm_file_t;
#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
/* Backward compatibility section */
/* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */
#ifndef _PAGE_PWT
#define _PAGE_PWT _PAGE_WT
#endif
/* Mapping helper macros */
#define DRM_IOREMAP(map) \
(map)->handle = DRM(ioremap)( dev, map )
@ -143,11 +133,6 @@ typedef struct drm_file drm_file_t;
} while(0)
typedef struct drm_pci_list {
u16 vendor;
u16 device;
} drm_pci_list_t;
typedef struct drm_ioctl_desc {
int (*func)(DRM_IOCTL_ARGS);
int auth_needed;
@ -271,22 +256,6 @@ typedef struct drm_lock_data {
} drm_lock_data_t;
typedef struct drm_device_dma {
#if 0
/* Performance Counters */
atomic_t total_prio; /* Total DRM_DMA_PRIORITY */
atomic_t total_bytes; /* Total bytes DMA'd */
atomic_t total_dmas; /* Total DMA buffers dispatched */
atomic_t total_missed_dma; /* Missed drm_do_dma */
atomic_t total_missed_lock; /* Missed lock in drm_do_dma */
atomic_t total_missed_free; /* Missed drm_free_this_buffer */
atomic_t total_missed_sched;/* Missed drm_dma_schedule */
atomic_t total_tried; /* Tried next_buffer */
atomic_t total_hit; /* Sent next_buffer */
atomic_t total_lost; /* Lost interrupt */
#endif
drm_buf_entry_t bufs[DRM_MAX_ORDER+1];
int buf_count;
drm_buf_t **buflist; /* Vector of pointers info bufs */
@ -337,11 +306,6 @@ typedef struct drm_sg_mem {
dma_addr_t *busaddr;
} drm_sg_mem_t;
typedef struct drm_sigdata {
int context;
drm_hw_lock_t *lock;
} drm_sigdata_t;
typedef struct drm_local_map {
unsigned long offset; /* Physical address (0 for SAREA)*/
unsigned long size; /* Physical size (bytes) */
@ -380,11 +344,8 @@ struct drm_device {
device_t device; /* Device instance from newbus */
#endif
dev_t devnode; /* Device number for mknod */
char *devname; /* For /proc/interrupts */
int blocked; /* Blocked due to VC switch? */
int flags; /* Flags to open(2) */
int writable; /* Opened with FWRITE */
/* Locks */
DRM_SPINTYPE count_lock; /* For inuse, open_count, buf_use */
@ -444,7 +405,7 @@ struct drm_device {
#if __HAVE_VBL_IRQ
wait_queue_head_t vbl_queue; /* vbl wait channel */
atomic_t vbl_received;
#if 0 /* vbl signals are untested, ntested */
#if 0 /* vbl signals are untested */
struct drm_vbl_sig_list vbl_sig_list;
DRM_SPINTYPE vbl_lock;
#endif
@ -465,8 +426,6 @@ struct drm_device {
drm_sg_mem_t *sg; /* Scatter gather memory */
atomic_t *ctx_bitmap;
void *dev_private;
drm_sigdata_t sigdata; /* For block_all_signals */
sigset_t sigmask;
};
extern int DRM(flags);
@ -522,7 +481,6 @@ extern int DRM(flush_unblock)(drm_device_t *dev, int context,
drm_lock_flags_t flags);
extern int DRM(flush_block_and_flush)(drm_device_t *dev, int context,
drm_lock_flags_t flags);
extern int DRM(notifier)(void *priv);
/* Buffer management support (drm_bufs.h) */
extern int DRM(order)( unsigned long size );

View file

@ -218,10 +218,6 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new )
return 0;
}
if ( DRM(flags) & DRM_FLAG_NOCTX ) {
DRM(context_switch_complete)( dev, new );
}
return 0;
}
@ -391,10 +387,6 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new)
return DRM_ERR(EINVAL);
}
if (DRM(flags) & DRM_FLAG_NOCTX) {
DRM(context_switch_complete)(dev, new);
}
atomic_dec(&q->use_count);
return 0;

View file

@ -86,12 +86,6 @@
#ifndef __HAVE_SG
#define __HAVE_SG 0
#endif
#ifndef __HAVE_KERNEL_CTX_SWITCH
#define __HAVE_KERNEL_CTX_SWITCH 0
#endif
#ifndef PCI_ANY_ID
#define PCI_ANY_ID ~0
#endif
#ifndef DRIVER_PREINIT
#define DRIVER_PREINIT()
@ -120,13 +114,6 @@
#ifndef DRIVER_FOPS
#endif
/*
* The default number of instances (minor numbers) to initialize.
*/
#ifndef DRIVER_NUM_CARDS
#define DRIVER_NUM_CARDS 1
#endif
#if 1 && DRM_DEBUG_CODE
int DRM(flags) = DRM_FLAG_DEBUG;
#else
@ -556,12 +543,6 @@ static int DRM(takedown)( drm_device_t *dev )
DRM_LOCK;
callout_stop( &dev->timer );
if ( dev->devname ) {
DRM(free)( dev->devname, strlen( dev->devname ) + 1,
DRM_MEM_DRIVER );
dev->devname = NULL;
}
if ( dev->unique ) {
DRM(free)( dev->unique, strlen( dev->unique ) + 1,
DRM_MEM_DRIVER );
@ -1020,10 +1001,9 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
device_unbusy(dev->device);
#endif
if ( !--dev->open_count ) {
if ( atomic_read( &dev->ioctl_count ) || dev->blocked ) {
DRM_ERROR( "Device busy: %ld %d\n",
(unsigned long)atomic_read( &dev->ioctl_count ),
dev->blocked );
if (atomic_read(&dev->ioctl_count)) {
DRM_ERROR("Device busy: %ld\n",
(unsigned long)atomic_read( &dev->ioctl_count ));
DRM_SPINUNLOCK( &dev->count_lock );
return DRM_ERR(EBUSY);
}
@ -1180,6 +1160,7 @@ int DRM(lock)( DRM_IOCTL_ARGS )
#endif
if ( !ret ) {
/* FIXME: Add signal blocking here */
#if __HAVE_DMA_READY
if ( lock.flags & _DRM_LOCK_READY ) {
@ -1190,12 +1171,6 @@ int DRM(lock)( DRM_IOCTL_ARGS )
if ( lock.flags & _DRM_LOCK_QUIESCENT ) {
DRIVER_DMA_QUIESCENT();
}
#endif
#if __HAVE_KERNEL_CTX_SWITCH
if ( dev->last_context != lock.context ) {
DRM(context_switch)(dev, dev->last_context,
lock.context);
}
#endif
}
@ -1220,25 +1195,6 @@ int DRM(unlock)( DRM_IOCTL_ARGS )
atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] );
#if __HAVE_KERNEL_CTX_SWITCH
/* We no longer really hold it, but if we are the next
* agent to request it then we should just be able to
* take it immediately and not eat the ioctl.
*/
dev->lock.pid = 0;
{
__volatile__ unsigned int *plock = &dev->lock.hw_lock->lock;
unsigned int old, new, prev, ctx;
ctx = lock.context;
do {
old = *plock;
new = ctx;
prev = cmpxchg(plock, old, new);
} while (prev != old);
}
wake_up_interruptible(&dev->lock.lock_queue);
#else
DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT );
#if __HAVE_DMA_SCHEDULE
@ -1253,7 +1209,6 @@ int DRM(unlock)( DRM_IOCTL_ARGS )
DRM_ERROR( "\n" );
}
}
#endif /* !__HAVE_KERNEL_CTX_SWITCH */
return 0;
}

View file

@ -121,15 +121,6 @@ int DRM(setunique)( DRM_IOCTL_ARGS )
dev->unique[dev->unique_len] = '\0';
dev->devname = DRM(alloc)(strlen(dev->name) + strlen(dev->unique) + 2,
DRM_MEM_DRIVER);
if(!dev->devname) {
DRM(free)(dev->devname, sizeof(*dev->devname), DRM_MEM_DRIVER);
return DRM_ERR(ENOMEM);
}
sprintf(dev->devname, "%s@%s", dev->name, dev->unique);
return 0;
}

View file

@ -202,35 +202,3 @@ int DRM(finish)( DRM_IOCTL_ARGS )
DRM(flush_unblock)(dev, lock.context, lock.flags);
return ret;
}
/* If we get here, it means that the process has called DRM_IOCTL_LOCK
without calling DRM_IOCTL_UNLOCK.
If the lock is not held, then let the signal proceed as usual.
If the lock is held, then set the contended flag and keep the signal
blocked.
Return 1 if the signal should be delivered normally.
Return 0 if the signal should be blocked. */
int DRM(notifier)(void *priv)
{
drm_sigdata_t *s = (drm_sigdata_t *)priv;
unsigned int old, new;
/* Allow signal delivery if lock isn't held */
if (!_DRM_LOCK_IS_HELD(s->lock->lock)
|| _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1;
/* Otherwise, set flag to force call to
drmUnlock */
do {
old = s->lock->lock;
new = old | _DRM_LOCK_CONT;
} while (!atomic_cmpset_int(&s->lock->lock, old, new));
return 0;
}

View file

@ -218,7 +218,7 @@ while (!condition) { \
#endif
#define malloctype DRM(M_DRM)
/* The macros confliced in the MALLOC_DEFINE */
/* The macros conflicted in the MALLOC_DEFINE */
MALLOC_DECLARE(malloctype);
#undef malloctype
@ -317,10 +317,8 @@ find_first_zero_bit(volatile void *p, int max)
* exist.
*/
#if (__FreeBSD_version < 500002 && __FreeBSD_version > 500000) || __FreeBSD_version < 420000
/* FIXME: again, what's the exact date? */
#define MODULE_VERSION(a,b) struct __hack
#define MODULE_DEPEND(a,b,c,d,e) struct __hack
#endif
/* Redefinitions to make templating easy */
@ -346,8 +344,6 @@ find_first_zero_bit(volatile void *p, int max)
#define DRM_DEBUG(fmt, arg...) do { } while (0)
#endif
#define DRM_PROC_LIMIT (PAGE_SIZE-80)
#if (__FreeBSD_version >= 500000) || ((__FreeBSD_version < 500000) && (__FreeBSD_version >= 410002))
#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
#else

View file

@ -306,8 +306,6 @@ do { \
#define DRM_DEBUG(fmt, arg...) do { } while (0)
#endif
#define DRM_PROC_LIMIT (PAGE_SIZE-80)
#define DRM_SYSCTL_PRINT(fmt, arg...) \
snprintf(buf, sizeof(buf), fmt, ##arg); \
error = SYSCTL_OUT(req, buf, strlen(buf)); \

View file

@ -80,12 +80,8 @@ typedef struct drm_file drm_file_t;
#define DRM_HASH_SIZE 16 /* Size of key hash table */
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
#define DRM_LOOPING_LIMIT 5000000
#define DRM_BSZ 1024 /* Buffer size for /dev/drm? output */
#define DRM_LOCK_SLICE 1 /* Time slice for lock, in jiffies */
#define DRM_FLAG_DEBUG 0x01
#define DRM_FLAG_NOCTX 0x02
#define DRM_MEM_DMA 0
#define DRM_MEM_SAREA 1
@ -110,12 +106,6 @@ typedef struct drm_file drm_file_t;
#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
/* Backward compatibility section */
/* _PAGE_WT changed to _PAGE_PWT in 2.2.6 */
#ifndef _PAGE_PWT
#define _PAGE_PWT _PAGE_WT
#endif
/* Mapping helper macros */
#define DRM_IOREMAP(map) \
(map)->handle = DRM(ioremap)( dev, map )
@ -143,11 +133,6 @@ typedef struct drm_file drm_file_t;
} while(0)
typedef struct drm_pci_list {
u16 vendor;
u16 device;
} drm_pci_list_t;
typedef struct drm_ioctl_desc {
int (*func)(DRM_IOCTL_ARGS);
int auth_needed;
@ -271,22 +256,6 @@ typedef struct drm_lock_data {
} drm_lock_data_t;
typedef struct drm_device_dma {
#if 0
/* Performance Counters */
atomic_t total_prio; /* Total DRM_DMA_PRIORITY */
atomic_t total_bytes; /* Total bytes DMA'd */
atomic_t total_dmas; /* Total DMA buffers dispatched */
atomic_t total_missed_dma; /* Missed drm_do_dma */
atomic_t total_missed_lock; /* Missed lock in drm_do_dma */
atomic_t total_missed_free; /* Missed drm_free_this_buffer */
atomic_t total_missed_sched;/* Missed drm_dma_schedule */
atomic_t total_tried; /* Tried next_buffer */
atomic_t total_hit; /* Sent next_buffer */
atomic_t total_lost; /* Lost interrupt */
#endif
drm_buf_entry_t bufs[DRM_MAX_ORDER+1];
int buf_count;
drm_buf_t **buflist; /* Vector of pointers info bufs */
@ -337,11 +306,6 @@ typedef struct drm_sg_mem {
dma_addr_t *busaddr;
} drm_sg_mem_t;
typedef struct drm_sigdata {
int context;
drm_hw_lock_t *lock;
} drm_sigdata_t;
typedef struct drm_local_map {
unsigned long offset; /* Physical address (0 for SAREA)*/
unsigned long size; /* Physical size (bytes) */
@ -380,11 +344,8 @@ struct drm_device {
device_t device; /* Device instance from newbus */
#endif
dev_t devnode; /* Device number for mknod */
char *devname; /* For /proc/interrupts */
int blocked; /* Blocked due to VC switch? */
int flags; /* Flags to open(2) */
int writable; /* Opened with FWRITE */
/* Locks */
DRM_SPINTYPE count_lock; /* For inuse, open_count, buf_use */
@ -444,7 +405,7 @@ struct drm_device {
#if __HAVE_VBL_IRQ
wait_queue_head_t vbl_queue; /* vbl wait channel */
atomic_t vbl_received;
#if 0 /* vbl signals are untested, ntested */
#if 0 /* vbl signals are untested */
struct drm_vbl_sig_list vbl_sig_list;
DRM_SPINTYPE vbl_lock;
#endif
@ -465,8 +426,6 @@ struct drm_device {
drm_sg_mem_t *sg; /* Scatter gather memory */
atomic_t *ctx_bitmap;
void *dev_private;
drm_sigdata_t sigdata; /* For block_all_signals */
sigset_t sigmask;
};
extern int DRM(flags);
@ -522,7 +481,6 @@ extern int DRM(flush_unblock)(drm_device_t *dev, int context,
drm_lock_flags_t flags);
extern int DRM(flush_block_and_flush)(drm_device_t *dev, int context,
drm_lock_flags_t flags);
extern int DRM(notifier)(void *priv);
/* Buffer management support (drm_bufs.h) */
extern int DRM(order)( unsigned long size );

View file

@ -218,10 +218,6 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new )
return 0;
}
if ( DRM(flags) & DRM_FLAG_NOCTX ) {
DRM(context_switch_complete)( dev, new );
}
return 0;
}
@ -391,10 +387,6 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new)
return DRM_ERR(EINVAL);
}
if (DRM(flags) & DRM_FLAG_NOCTX) {
DRM(context_switch_complete)(dev, new);
}
atomic_dec(&q->use_count);
return 0;

View file

@ -86,12 +86,6 @@
#ifndef __HAVE_SG
#define __HAVE_SG 0
#endif
#ifndef __HAVE_KERNEL_CTX_SWITCH
#define __HAVE_KERNEL_CTX_SWITCH 0
#endif
#ifndef PCI_ANY_ID
#define PCI_ANY_ID ~0
#endif
#ifndef DRIVER_PREINIT
#define DRIVER_PREINIT()
@ -120,13 +114,6 @@
#ifndef DRIVER_FOPS
#endif
/*
* The default number of instances (minor numbers) to initialize.
*/
#ifndef DRIVER_NUM_CARDS
#define DRIVER_NUM_CARDS 1
#endif
#if 1 && DRM_DEBUG_CODE
int DRM(flags) = DRM_FLAG_DEBUG;
#else
@ -556,12 +543,6 @@ static int DRM(takedown)( drm_device_t *dev )
DRM_LOCK;
callout_stop( &dev->timer );
if ( dev->devname ) {
DRM(free)( dev->devname, strlen( dev->devname ) + 1,
DRM_MEM_DRIVER );
dev->devname = NULL;
}
if ( dev->unique ) {
DRM(free)( dev->unique, strlen( dev->unique ) + 1,
DRM_MEM_DRIVER );
@ -1020,10 +1001,9 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
device_unbusy(dev->device);
#endif
if ( !--dev->open_count ) {
if ( atomic_read( &dev->ioctl_count ) || dev->blocked ) {
DRM_ERROR( "Device busy: %ld %d\n",
(unsigned long)atomic_read( &dev->ioctl_count ),
dev->blocked );
if (atomic_read(&dev->ioctl_count)) {
DRM_ERROR("Device busy: %ld\n",
(unsigned long)atomic_read( &dev->ioctl_count ));
DRM_SPINUNLOCK( &dev->count_lock );
return DRM_ERR(EBUSY);
}
@ -1180,6 +1160,7 @@ int DRM(lock)( DRM_IOCTL_ARGS )
#endif
if ( !ret ) {
/* FIXME: Add signal blocking here */
#if __HAVE_DMA_READY
if ( lock.flags & _DRM_LOCK_READY ) {
@ -1190,12 +1171,6 @@ int DRM(lock)( DRM_IOCTL_ARGS )
if ( lock.flags & _DRM_LOCK_QUIESCENT ) {
DRIVER_DMA_QUIESCENT();
}
#endif
#if __HAVE_KERNEL_CTX_SWITCH
if ( dev->last_context != lock.context ) {
DRM(context_switch)(dev, dev->last_context,
lock.context);
}
#endif
}
@ -1220,25 +1195,6 @@ int DRM(unlock)( DRM_IOCTL_ARGS )
atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] );
#if __HAVE_KERNEL_CTX_SWITCH
/* We no longer really hold it, but if we are the next
* agent to request it then we should just be able to
* take it immediately and not eat the ioctl.
*/
dev->lock.pid = 0;
{
__volatile__ unsigned int *plock = &dev->lock.hw_lock->lock;
unsigned int old, new, prev, ctx;
ctx = lock.context;
do {
old = *plock;
new = ctx;
prev = cmpxchg(plock, old, new);
} while (prev != old);
}
wake_up_interruptible(&dev->lock.lock_queue);
#else
DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT );
#if __HAVE_DMA_SCHEDULE
@ -1253,7 +1209,6 @@ int DRM(unlock)( DRM_IOCTL_ARGS )
DRM_ERROR( "\n" );
}
}
#endif /* !__HAVE_KERNEL_CTX_SWITCH */
return 0;
}

View file

@ -121,15 +121,6 @@ int DRM(setunique)( DRM_IOCTL_ARGS )
dev->unique[dev->unique_len] = '\0';
dev->devname = DRM(alloc)(strlen(dev->name) + strlen(dev->unique) + 2,
DRM_MEM_DRIVER);
if(!dev->devname) {
DRM(free)(dev->devname, sizeof(*dev->devname), DRM_MEM_DRIVER);
return DRM_ERR(ENOMEM);
}
sprintf(dev->devname, "%s@%s", dev->name, dev->unique);
return 0;
}

View file

@ -202,35 +202,3 @@ int DRM(finish)( DRM_IOCTL_ARGS )
DRM(flush_unblock)(dev, lock.context, lock.flags);
return ret;
}
/* If we get here, it means that the process has called DRM_IOCTL_LOCK
without calling DRM_IOCTL_UNLOCK.
If the lock is not held, then let the signal proceed as usual.
If the lock is held, then set the contended flag and keep the signal
blocked.
Return 1 if the signal should be delivered normally.
Return 0 if the signal should be blocked. */
int DRM(notifier)(void *priv)
{
drm_sigdata_t *s = (drm_sigdata_t *)priv;
unsigned int old, new;
/* Allow signal delivery if lock isn't held */
if (!_DRM_LOCK_IS_HELD(s->lock->lock)
|| _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1;
/* Otherwise, set flag to force call to
drmUnlock */
do {
old = s->lock->lock;
new = old | _DRM_LOCK_CONT;
} while (!atomic_cmpset_int(&s->lock->lock, old, new));
return 0;
}

View file

@ -218,7 +218,7 @@ while (!condition) { \
#endif
#define malloctype DRM(M_DRM)
/* The macros confliced in the MALLOC_DEFINE */
/* The macros conflicted in the MALLOC_DEFINE */
MALLOC_DECLARE(malloctype);
#undef malloctype
@ -317,10 +317,8 @@ find_first_zero_bit(volatile void *p, int max)
* exist.
*/
#if (__FreeBSD_version < 500002 && __FreeBSD_version > 500000) || __FreeBSD_version < 420000
/* FIXME: again, what's the exact date? */
#define MODULE_VERSION(a,b) struct __hack
#define MODULE_DEPEND(a,b,c,d,e) struct __hack
#endif
/* Redefinitions to make templating easy */
@ -346,8 +344,6 @@ find_first_zero_bit(volatile void *p, int max)
#define DRM_DEBUG(fmt, arg...) do { } while (0)
#endif
#define DRM_PROC_LIMIT (PAGE_SIZE-80)
#if (__FreeBSD_version >= 500000) || ((__FreeBSD_version < 500000) && (__FreeBSD_version >= 410002))
#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
#else

View file

@ -306,8 +306,6 @@ do { \
#define DRM_DEBUG(fmt, arg...) do { } while (0)
#endif
#define DRM_PROC_LIMIT (PAGE_SIZE-80)
#define DRM_SYSCTL_PRINT(fmt, arg...) \
snprintf(buf, sizeof(buf), fmt, ##arg); \
error = SYSCTL_OUT(req, buf, strlen(buf)); \