diff options
author | Dave Airlie <airlied@linux.ie> | 2007-06-10 15:40:10 +1000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2007-06-10 15:40:21 +1000 |
commit | 280083d4a2a12a1ff6dc1b068553a4ae8960200c (patch) | |
tree | e03b6cb4825b18412a0984af33dfb4c8fd573493 /linux-core/drm_drawable.c | |
parent | 31815730732a5d2a446aa316a5b4d837766762e6 (diff) |
use krh's idr mods to remove lists from idr code
Diffstat (limited to 'linux-core/drm_drawable.c')
-rw-r--r-- | linux-core/drm_drawable.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/linux-core/drm_drawable.c b/linux-core/drm_drawable.c index d599430b..eb44a189 100644 --- a/linux-core/drm_drawable.c +++ b/linux-core/drm_drawable.c @@ -67,11 +67,8 @@ again: goto again; } - list_add(&draw_info->head, &dev->drwlist); - spin_unlock_irqrestore(&dev->drw_lock, irqflags); - draw_info->id = new_id; draw.handle = new_id; DRM_DEBUG("%d\n", draw.handle); @@ -102,7 +99,6 @@ int drm_rmdraw(DRM_IOCTL_ARGS) spin_lock_irqsave(&dev->drw_lock, irqflags); - list_del(&draw_info->head); idr_remove(&dev->drw_idr, draw.handle); drm_free(draw_info, sizeof(struct drm_drawable_list), DRM_MEM_BUFS); @@ -199,3 +195,18 @@ drm_drawable_info_t *drm_get_drawable_info(drm_device_t *dev, drm_drawable_t id) return &draw_info->info; } EXPORT_SYMBOL(drm_get_drawable_info); + +static int drm_drawable_free(int idr, void *p, void *data) +{ + struct drm_drawable_list *drw_entry = p; + drm_free(drw_entry->info.rects, drw_entry->info.num_rects * + sizeof(drm_clip_rect_t), DRM_MEM_BUFS); + drm_free(drw_entry, sizeof(struct drm_drawable_list), DRM_MEM_BUFS); + return 0; +} + +void drm_drawable_free_all(drm_device_t *dev) +{ + idr_for_each(&dev->drw_idr, drm_drawable_free, NULL); + idr_remove_all(&dev->drw_idr); +} |