diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-08-17 14:37:32 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-08-17 14:37:32 +0000 |
commit | 12ef535c6c2b88b0aa8490b92574e63baea7a7c0 (patch) | |
tree | 98a4a5105a2a7f9fb71be6b7f542068dc3e25c57 /sys/dev | |
parent | 49671daad622f12247c077f5e81781a943d999b7 (diff) |
Make sure we can't sleep with a spinlock held
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/drm/drm_context.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/dev/pci/drm/drm_context.c b/sys/dev/pci/drm/drm_context.c index beb363f98ab..d2c5fb4391f 100644 --- a/sys/dev/pci/drm/drm_context.c +++ b/sys/dev/pci/drm/drm_context.c @@ -80,15 +80,15 @@ drm_ctxbitmap_next(struct drm_device *dev) int drm_ctxbitmap_init(struct drm_device *dev) { - int i; - int temp; + atomic_t *bitmap; + int i, temp; + + bitmap = drm_calloc(1, PAGE_SIZE, DRM_MEM_CTXBITMAP); + if (bitmap == NULL) + return (ENOMEM); DRM_LOCK(); - dev->ctx_bitmap = drm_calloc(1, PAGE_SIZE, DRM_MEM_CTXBITMAP); - if (dev->ctx_bitmap == NULL) { - DRM_UNLOCK(); - return ENOMEM; - } + dev->ctx_bitmap = bitmap; dev->max_context = -1; DRM_UNLOCK(); @@ -103,9 +103,13 @@ drm_ctxbitmap_init(struct drm_device *dev) void drm_ctxbitmap_cleanup(struct drm_device *dev) { + atomic_t *bitmap; + DRM_LOCK(); - drm_free(dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP); + bitmap = dev->ctx_bitmap; + dev->ctx_bitmap = NULL; DRM_UNLOCK(); + drm_free(bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP); } int |