summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/drm_drv.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-04-12 14:10:22 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-04-12 14:10:22 +0000
commit027b1334162c3cbaf6167038026b6d7354256093 (patch)
treedc3c8f428762ceb113ce2e87edcbd9f2ca271b1d /sys/dev/pci/drm/drm_drv.c
parent845099509bda04edae00d2ea742e42df4242e874 (diff)
Switch part of the magic hashtable over to using a TAILQ instead
of a hand-rolled list. Ideally this code needs more changes, but for now that'll do. Tested by many.
Diffstat (limited to 'sys/dev/pci/drm/drm_drv.c')
-rw-r--r--sys/dev/pci/drm/drm_drv.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index fd8111f06f8..a36ac17f9fb 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -381,8 +381,7 @@ drm_firstopen(drm_device_t *dev)
atomic_set( &dev->counts[i], 0 );
for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) {
- dev->magiclist[i].head = NULL;
- dev->magiclist[i].tail = NULL;
+ TAILQ_INIT(&dev->magiclist[i]);
}
dev->lock.lock_queue = 0;
@@ -405,7 +404,7 @@ drm_firstopen(drm_device_t *dev)
int
drm_lastclose(drm_device_t *dev)
{
- drm_magic_entry_t *pt, *next;
+ struct drm_magic_entry *pt;
drm_local_map_t *map;
#ifdef __FreeBSD__
drm_local_map_t *mapsave;
@@ -429,11 +428,9 @@ drm_lastclose(drm_device_t *dev)
}
/* Clear pid list */
for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) {
- for ( pt = dev->magiclist[i].head ; pt ; pt = next ) {
- next = pt->next;
- free(pt, M_DRM);
+ while ((pt = TAILQ_FIRST(&dev->magiclist[i])) != NULL) {
+ TAILQ_REMOVE(&dev->magiclist[i], pt, link);
}
- dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
}
/* Clear AGP information */