aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/xgi_drv.c6
-rw-r--r--linux-core/xgi_drv.h6
-rw-r--r--linux-core/xgi_fb.c14
-rw-r--r--linux-core/xgi_pcie.c31
4 files changed, 13 insertions, 44 deletions
diff --git a/linux-core/xgi_drv.c b/linux-core/xgi_drv.c
index e98fd608..f6e7b550 100644
--- a/linux-core/xgi_drv.c
+++ b/linux-core/xgi_drv.c
@@ -284,8 +284,10 @@ void xgi_driver_preclose(struct drm_device * dev, struct drm_file * filp)
{
struct xgi_info * info = dev->dev_private;
- xgi_pcie_free_all(info, filp);
- xgi_fb_free_all(info, filp);
+ mutex_lock(&info->dev->struct_mutex);
+ xgi_free_all(info, &info->pcie_heap, filp);
+ xgi_free_all(info, &info->fb_heap, filp);
+ mutex_unlock(&info->dev->struct_mutex);
}
diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h
index 384381c7..79276b70 100644
--- a/linux-core/xgi_drv.h
+++ b/linux-core/xgi_drv.h
@@ -38,7 +38,7 @@
#define DRIVER_MAJOR 0
#define DRIVER_MINOR 10
-#define DRIVER_PATCHLEVEL 3
+#define DRIVER_PATCHLEVEL 4
#include "xgi_cmdlist.h"
#include "xgi_drm.h"
@@ -111,8 +111,8 @@ extern int xgi_pcie_free(struct xgi_info * info, unsigned long offset,
extern void *xgi_find_pcie_virt(struct xgi_info * info, u32 address);
-extern void xgi_pcie_free_all(struct xgi_info *, struct drm_file *);
-extern void xgi_fb_free_all(struct xgi_info *, struct drm_file *);
+extern void xgi_free_all(struct xgi_info *, struct xgi_mem_heap *,
+ struct drm_file *);
extern int xgi_fb_alloc_ioctl(struct drm_device * dev, void * data,
struct drm_file * filp);
diff --git a/linux-core/xgi_fb.c b/linux-core/xgi_fb.c
index 373c45dd..f8341a67 100644
--- a/linux-core/xgi_fb.c
+++ b/linux-core/xgi_fb.c
@@ -318,29 +318,27 @@ int xgi_fb_heap_init(struct xgi_info * info)
/**
* Free all blocks associated with a particular file handle.
*/
-void xgi_fb_free_all(struct xgi_info * info, struct drm_file * filp)
+void xgi_free_all(struct xgi_info * info, struct xgi_mem_heap * heap,
+ struct drm_file * filp)
{
- if (!info->fb_heap.initialized) {
+ if (!heap->initialized) {
return;
}
- mutex_lock(&info->dev->struct_mutex);
do {
struct xgi_mem_block *block;
- list_for_each_entry(block, &info->fb_heap.used_list, list) {
+ list_for_each_entry(block, &heap->used_list, list) {
if (block->filp == filp) {
break;
}
}
- if (&block->list == &info->fb_heap.used_list) {
+ if (&block->list == &heap->used_list) {
break;
}
- (void) xgi_mem_free(&info->fb_heap, block->offset, filp);
+ (void) xgi_mem_free(heap, block->offset, filp);
} while(1);
-
- mutex_unlock(&info->dev->struct_mutex);
}
diff --git a/linux-core/xgi_pcie.c b/linux-core/xgi_pcie.c
index 883fbe7e..b2edf3b1 100644
--- a/linux-core/xgi_pcie.c
+++ b/linux-core/xgi_pcie.c
@@ -152,37 +152,6 @@ int xgi_pcie_alloc_ioctl(struct drm_device * dev, void * data,
}
-/**
- * Free all blocks associated with a particular file handle.
- */
-void xgi_pcie_free_all(struct xgi_info * info, struct drm_file * filp)
-{
- if (!info->pcie_heap.initialized) {
- return;
- }
-
- mutex_lock(&info->dev->struct_mutex);
-
- do {
- struct xgi_mem_block *block;
-
- list_for_each_entry(block, &info->pcie_heap.used_list, list) {
- if (block->filp == filp) {
- break;
- }
- }
-
- if (&block->list == &info->pcie_heap.used_list) {
- break;
- }
-
- (void) xgi_mem_free(&info->pcie_heap, block->offset, filp);
- } while(1);
-
- mutex_unlock(&info->dev->struct_mutex);
-}
-
-
int xgi_pcie_free(struct xgi_info * info, unsigned long offset,
struct drm_file * filp)
{