diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-10-31 11:19:40 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-31 11:22:51 +1000 |
commit | a7dbf00433fa9dc6f4a3828a17d56a9df2bd06b1 (patch) | |
tree | d59a16030201ea5d9a1dded6585b36fe4cf8ffcf /drivers | |
parent | 1249ac592a2f995fef977be33abf077bdb57b3aa (diff) | |
download | linux-3.10-a7dbf00433fa9dc6f4a3828a17d56a9df2bd06b1.tar.gz linux-3.10-a7dbf00433fa9dc6f4a3828a17d56a9df2bd06b1.tar.bz2 linux-3.10-a7dbf00433fa9dc6f4a3828a17d56a9df2bd06b1.zip |
drm/nouveau: allow creation of zero-sized mm
Useful for places where a given chipset may or may not have a given
resource, and we want to avoid having to spray checks for the mm's
existance around everywhere.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/core/mm.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/include/core/mm.h | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/core/core/mm.c b/drivers/gpu/drm/nouveau/core/core/mm.c index 4d620644867..a6d3cd6490f 100644 --- a/drivers/gpu/drm/nouveau/core/core/mm.c +++ b/drivers/gpu/drm/nouveau/core/core/mm.c @@ -218,13 +218,16 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block) node = kzalloc(sizeof(*node), GFP_KERNEL); if (!node) return -ENOMEM; - node->offset = roundup(offset, mm->block_size); - node->length = rounddown(offset + length, mm->block_size) - node->offset; + + if (length) { + node->offset = roundup(offset, mm->block_size); + node->length = rounddown(offset + length, mm->block_size); + node->length -= node->offset; + } list_add_tail(&node->nl_entry, &mm->nodes); list_add_tail(&node->fl_entry, &mm->free); mm->heap_nodes++; - mm->heap_size += length; return 0; } diff --git a/drivers/gpu/drm/nouveau/core/include/core/mm.h b/drivers/gpu/drm/nouveau/core/include/core/mm.h index 9ee9bf4028c..975137ba34a 100644 --- a/drivers/gpu/drm/nouveau/core/include/core/mm.h +++ b/drivers/gpu/drm/nouveau/core/include/core/mm.h @@ -19,7 +19,6 @@ struct nouveau_mm { u32 block_size; int heap_nodes; - u32 heap_size; }; int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block); |