aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2007-06-29 21:15:33 -0700
committerIan Romanick <idr@us.ibm.com>2007-06-29 21:15:33 -0700
commit4403540776c8ed3c2e28f26b6dacaab0b9e40e05 (patch)
treebb094ddb67d5e50835704278198e88b0237df5f3
parent4c4780bc8e5bf01b2b920c6b8de4ddbd0256c81f (diff)
Clean up xgi_pcie_heap_check
The whole purpose of xgi_pcie_heap_check is to log information about entries on the used_list. If XGI_DEBUG is not set, it doesn't print anything. Therefore we can #ifdef the whole function body. Convert open-code list iteration to use list_for_each_entry.
-rw-r--r--linux-core/xgi_pcie.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/linux-core/xgi_pcie.c b/linux-core/xgi_pcie.c
index a81dbe8b..dd758013 100644
--- a/linux-core/xgi_pcie.c
+++ b/linux-core/xgi_pcie.c
@@ -347,35 +347,31 @@ int xgi_pcie_heap_init(struct xgi_info * info)
void xgi_pcie_heap_check(void)
{
- struct list_head *useList, *temp;
+#ifdef XGI_DEBUG
struct xgi_pcie_block *block;
unsigned int ownerIndex;
-#ifdef XGI_DEBUG
- char *ownerStr[6] =
+ static const char *const ownerStr[6] =
{ "2D", "3D", "3D_CMD", "3D_SCR", "3D_TEX", "ELSE" };
-#endif
- if (xgi_pcie_heap) {
- useList = &xgi_pcie_heap->used_list;
- temp = useList->next;
- XGI_INFO("pcie freemax = 0x%lx\n", xgi_pcie_heap->max_freesize);
- while (temp != useList) {
- block = list_entry(temp, struct xgi_pcie_block, list);
- if (block->owner == PCIE_2D)
- ownerIndex = 0;
- else if (block->owner > PCIE_3D_TEXTURE
- || block->owner < PCIE_2D
- || block->owner < PCIE_3D)
- ownerIndex = 5;
- else
- ownerIndex = block->owner - PCIE_3D + 1;
- XGI_INFO
- ("Allocated by %s, block->offset: 0x%lx block->size: 0x%lx \n",
- ownerStr[ownerIndex], block->offset, block->size);
- temp = temp->next;
- }
+ if (!xgi_pcie_heap) {
+ return;
+ }
+
+ XGI_INFO("pcie freemax = 0x%lx\n", xgi_pcie_heap->max_freesize);
+ list_for_each_entry(block, &xgi_pcie_heap->used_list, list) {
+ if (block->owner == PCIE_2D)
+ ownerIndex = 0;
+ else if (block->owner > PCIE_3D_TEXTURE
+ || block->owner < PCIE_2D
+ || block->owner < PCIE_3D)
+ ownerIndex = 5;
+ else
+ ownerIndex = block->owner - PCIE_3D + 1;
+ XGI_INFO("Allocated by %s, block offset: 0x%lx, size: 0x%lx \n",
+ ownerStr[ownerIndex], block->offset, block->size);
}
+#endif
}
void xgi_pcie_heap_cleanup(struct xgi_info * info)