Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345379
b: refs/heads/master
c: 7e0f992
h: refs/heads/master
i:
  345377: 4711771
  345375: d24654d
v: v3
  • Loading branch information
Ben Skeggs committed Nov 28, 2012
1 parent 315084c commit 683fe71
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d338081a6008b3638ca45e0020c5a0cebe362fd
refs/heads/master: 7e0f992b796e102d32b75392fba38be7cab1c5a9
17 changes: 10 additions & 7 deletions trunk/drivers/gpu/drm/nouveau/core/core/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,18 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block)
int
nouveau_mm_fini(struct nouveau_mm *mm)
{
struct nouveau_mm_node *node, *heap =
list_first_entry(&mm->nodes, struct nouveau_mm_node, nl_entry);
int nodes = 0;
if (nouveau_mm_initialised(mm)) {
struct nouveau_mm_node *node, *heap =
list_first_entry(&mm->nodes, typeof(*heap), nl_entry);
int nodes = 0;

list_for_each_entry(node, &mm->nodes, nl_entry) {
if (WARN_ON(nodes++ == mm->heap_nodes))
return -EBUSY;
}

list_for_each_entry(node, &mm->nodes, nl_entry) {
if (WARN_ON(nodes++ == mm->heap_nodes))
return -EBUSY;
kfree(heap);
}

kfree(heap);
return 0;
}
6 changes: 6 additions & 0 deletions trunk/drivers/gpu/drm/nouveau/core/include/core/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ struct nouveau_mm {
int heap_nodes;
};

static inline bool
nouveau_mm_initialised(struct nouveau_mm *mm)
{
return mm->block_size != 0;
}

int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block);
int nouveau_mm_fini(struct nouveau_mm *);
int nouveau_mm_head(struct nouveau_mm *, u8 type, u32 size_max, u32 size_min,
Expand Down
8 changes: 2 additions & 6 deletions trunk/drivers/gpu/drm/nouveau/core/subdev/fb/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,8 @@ nouveau_fb_destroy(struct nouveau_fb *pfb)

for (i = 0; i < pfb->tile.regions; i++)
pfb->tile.fini(pfb, i, &pfb->tile.region[i]);

if (pfb->tags.block_size)
nouveau_mm_fini(&pfb->tags);

if (pfb->vram.block_size)
nouveau_mm_fini(&pfb->vram);
nouveau_mm_fini(&pfb->tags);
nouveau_mm_fini(&pfb->vram);

nouveau_subdev_destroy(&pfb->base);
}
Expand Down

0 comments on commit 683fe71

Please sign in to comment.