From 4e5bd57a17e2279d5482ed3f4be250167703b9b5 Mon Sep 17 00:00:00 2001 From: oga Date: Wed, 13 Aug 2008 20:22:55 +0000 Subject: [PATCH] idgen32 wasn't really right here. Change back to how it was, but done a little nicer. Advice from deraadt@. --- sys/dev/pci/drm/drmP.h | 3 +-- sys/dev/pci/drm/drm_auth.c | 6 +----- sys/dev/pci/drm/drm_drv.c | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 5529ce22b85..1649577d7e3 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -66,7 +66,6 @@ #include #include #include -#include #include "drm.h" #include "drm_linux_list.h" @@ -635,7 +634,7 @@ struct drm_device { /* Authentication */ drm_file_list_t files; - struct idgen32_ctx magicid; + drm_magic_t magicid; SPLAY_HEAD(drm_magic_tree, drm_magic_entry) magiclist; /* Linked list of mappable regions. Protected by dev_lock */ diff --git a/sys/dev/pci/drm/drm_auth.c b/sys/dev/pci/drm/drm_auth.c index 4b1e20ca92d..6425875e3c4 100644 --- a/sys/dev/pci/drm/drm_auth.c +++ b/sys/dev/pci/drm/drm_auth.c @@ -124,11 +124,7 @@ drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv) auth->magic = file_priv->magic; } else { DRM_LOCK(); - do { - auth->magic = idgen32(&dev->magicid); - } while (drm_find_file(dev, auth->magic)); - - file_priv->magic = auth->magic; + file_priv->magic = auth->magic = dev->magicid++; drm_add_magic(dev, file_priv, auth->magic); DRM_UNLOCK(); } diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index f5b201e32e1..04331bb42a9 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -253,7 +253,7 @@ drm_firstopen(struct drm_device *dev) for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ ) atomic_set( &dev->counts[i], 0 ); - idgen32_init(&dev->magicid); + dev->magicid = 1; SPLAY_INIT(&dev->magiclist); dev->lock.lock_queue = 0; -- 2.20.1