summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Delgass <ldelgass@users.sourceforge.net>2003-04-30 16:07:26 +0000
committerLeif Delgass <ldelgass@users.sourceforge.net>2003-04-30 16:07:26 +0000
commit55dddb570f1330d38dbaf897d3954a05a34df648 (patch)
tree52ede3fa33123ababeb2650ced56610c32be8ac1
parentc99ae2788f39d234c4fbf826f411094e885adf49 (diff)
Compile fix with memory debugging off. Rename MEMORY_DEBUG to
DRM_MEMORY_DEBUG and move #define to drmP.h
-rw-r--r--linux-core/drmP.h2
-rw-r--r--linux-core/drm_memory.h8
-rw-r--r--linux-core/drm_pci.c14
-rw-r--r--linux/drmP.h2
-rw-r--r--linux/drm_memory.h8
-rw-r--r--linux/drm_pci.h14
6 files changed, 30 insertions, 18 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 95067342..ec4786a3 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -117,6 +117,8 @@
#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
also include looping detection. */
+#define DRM_DEBUG_MEMORY 1 /* Include memory allocation debugging code
+ from drm_memory_debug.h */
#define DRM_HASH_SIZE 16 /* Size of key hash table */
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h
index ae5737f1..9e14591f 100644
--- a/linux-core/drm_memory.h
+++ b/linux-core/drm_memory.h
@@ -34,13 +34,11 @@
#include "drmP.h"
/* Cut down version of drm_memory_debug.h, which used to be called
- * drm_memory.h. If you want the debug functionality, change 0 to 1
- * below.
+ * drm_memory.h. If you want the debug functionality, set DRM_DEBUG_MEMORY
+ * to 1 in drmP.h.
*/
-#define DEBUG_MEMORY 0
-
-#if DEBUG_MEMORY
+#if DRM_DEBUG_MEMORY
#include "drm_memory_debug.h"
#else
void DRM(mem_init)(void)
diff --git a/linux-core/drm_pci.c b/linux-core/drm_pci.c
index fb9df119..b32c0a30 100644
--- a/linux-core/drm_pci.c
+++ b/linux-core/drm_pci.c
@@ -55,9 +55,11 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align,
dma_addr_t maxaddr, dma_addr_t *busaddr)
{
void *address;
+#if 0
unsigned long addr;
size_t sz;
-#if DEBUG_MEMORY
+#endif
+#if DRM_DEBUG_MEMORY
int area = DRM_MEM_DMA;
spin_lock(&DRM(mem_lock));
@@ -83,7 +85,7 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align,
address = pci_alloc_consistent( dev->pdev, size, busaddr );
-#if DEBUG_MEMORY
+#if DRM_DEBUG_MEMORY
if (address == NULL) {
spin_lock(&DRM(mem_lock));
++DRM(mem_stats)[area].fail_count;
@@ -122,16 +124,20 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align,
void
DRM(pci_free)(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr)
{
+#if 0
unsigned long addr;
size_t sz;
-#if DEBUG_MEMORY
+#endif
+#if DRM_DEBUG_MEMORY
int area = DRM_MEM_DMA;
int alloc_count;
int free_count;
#endif
if (!vaddr) {
+#if DRM_DEBUG_MEMORY
DRM_MEM_ERROR(area, "Attempt to free address 0\n");
+#endif
} else {
#if 0
/* XXX - Is virt_to_page() legal for consistent mem? */
@@ -145,7 +151,7 @@ DRM(pci_free)(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr)
pci_free_consistent( dev->pdev, size, vaddr, busaddr );
}
-#if DEBUG_MEMORY
+#if DRM_DEBUG_MEMORY
spin_lock(&DRM(mem_lock));
free_count = ++DRM(mem_stats)[area].free_count;
alloc_count = DRM(mem_stats)[area].succeed_count;
diff --git a/linux/drmP.h b/linux/drmP.h
index 95067342..ec4786a3 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -117,6 +117,8 @@
#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then
also include looping detection. */
+#define DRM_DEBUG_MEMORY 1 /* Include memory allocation debugging code
+ from drm_memory_debug.h */
#define DRM_HASH_SIZE 16 /* Size of key hash table */
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
diff --git a/linux/drm_memory.h b/linux/drm_memory.h
index ae5737f1..9e14591f 100644
--- a/linux/drm_memory.h
+++ b/linux/drm_memory.h
@@ -34,13 +34,11 @@
#include "drmP.h"
/* Cut down version of drm_memory_debug.h, which used to be called
- * drm_memory.h. If you want the debug functionality, change 0 to 1
- * below.
+ * drm_memory.h. If you want the debug functionality, set DRM_DEBUG_MEMORY
+ * to 1 in drmP.h.
*/
-#define DEBUG_MEMORY 0
-
-#if DEBUG_MEMORY
+#if DRM_DEBUG_MEMORY
#include "drm_memory_debug.h"
#else
void DRM(mem_init)(void)
diff --git a/linux/drm_pci.h b/linux/drm_pci.h
index fb9df119..b32c0a30 100644
--- a/linux/drm_pci.h
+++ b/linux/drm_pci.h
@@ -55,9 +55,11 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align,
dma_addr_t maxaddr, dma_addr_t *busaddr)
{
void *address;
+#if 0
unsigned long addr;
size_t sz;
-#if DEBUG_MEMORY
+#endif
+#if DRM_DEBUG_MEMORY
int area = DRM_MEM_DMA;
spin_lock(&DRM(mem_lock));
@@ -83,7 +85,7 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align,
address = pci_alloc_consistent( dev->pdev, size, busaddr );
-#if DEBUG_MEMORY
+#if DRM_DEBUG_MEMORY
if (address == NULL) {
spin_lock(&DRM(mem_lock));
++DRM(mem_stats)[area].fail_count;
@@ -122,16 +124,20 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align,
void
DRM(pci_free)(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr)
{
+#if 0
unsigned long addr;
size_t sz;
-#if DEBUG_MEMORY
+#endif
+#if DRM_DEBUG_MEMORY
int area = DRM_MEM_DMA;
int alloc_count;
int free_count;
#endif
if (!vaddr) {
+#if DRM_DEBUG_MEMORY
DRM_MEM_ERROR(area, "Attempt to free address 0\n");
+#endif
} else {
#if 0
/* XXX - Is virt_to_page() legal for consistent mem? */
@@ -145,7 +151,7 @@ DRM(pci_free)(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr)
pci_free_consistent( dev->pdev, size, vaddr, busaddr );
}
-#if DEBUG_MEMORY
+#if DRM_DEBUG_MEMORY
spin_lock(&DRM(mem_lock));
free_count = ++DRM(mem_stats)[area].free_count;
alloc_count = DRM(mem_stats)[area].succeed_count;