summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2007-08-06 16:17:23 -0700
committerIan Romanick <idr@us.ibm.com>2007-08-06 16:17:23 -0700
commit90907c59152f628d6f0efea4927a06e547f4a3c7 (patch)
tree9bae338845d3446c6e131e9d96afadb038a2386c
parentf96bff9e213a950ab910832908d30e732435e628 (diff)
Replace per-heap semaphores with drm_device::struct_mutex.
-rw-r--r--linux-core/xgi_drv.c3
-rw-r--r--linux-core/xgi_drv.h3
-rw-r--r--linux-core/xgi_fb.c12
-rw-r--r--linux-core/xgi_pcie.c8
4 files changed, 10 insertions, 16 deletions
diff --git a/linux-core/xgi_drv.c b/linux-core/xgi_drv.c
index 33b3a51d..e98fd608 100644
--- a/linux-core/xgi_drv.c
+++ b/linux-core/xgi_drv.c
@@ -360,9 +360,6 @@ int xgi_driver_load(struct drm_device *dev, unsigned long flags)
dev->dev_private = info;
info->dev = dev;
- sema_init(&info->fb_sem, 1);
- sema_init(&info->pcie_sem, 1);
-
info->mmio.base = drm_get_resource_start(dev, 1);
info->mmio.size = drm_get_resource_len(dev, 1);
diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h
index 48c4b42c..384381c7 100644
--- a/linux-core/xgi_drv.h
+++ b/linux-core/xgi_drv.h
@@ -85,9 +85,6 @@ struct xgi_info {
struct xgi_mem_heap fb_heap;
struct xgi_mem_heap pcie_heap;
- struct semaphore fb_sem;
- struct semaphore pcie_sem;
-
struct xgi_cmdring_info cmdring;
};
diff --git a/linux-core/xgi_fb.c b/linux-core/xgi_fb.c
index 1d5dc22b..373c45dd 100644
--- a/linux-core/xgi_fb.c
+++ b/linux-core/xgi_fb.c
@@ -247,11 +247,11 @@ int xgi_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc,
{
struct xgi_mem_block *block;
- down(&info->fb_sem);
+ mutex_lock(&info->dev->struct_mutex);
block = xgi_mem_alloc((alloc->location == XGI_MEMLOC_LOCAL)
? &info->fb_heap : &info->pcie_heap,
alloc->size);
- up(&info->fb_sem);
+ mutex_unlock(&info->dev->struct_mutex);
if (block == NULL) {
alloc->size = 0;
@@ -292,9 +292,9 @@ int xgi_fb_free(struct xgi_info * info, unsigned long offset,
{
int err = 0;
- down(&info->fb_sem);
+ mutex_lock(&info->dev->struct_mutex);
err = xgi_mem_free(&info->fb_heap, offset, filp);
- up(&info->fb_sem);
+ mutex_unlock(&info->dev->struct_mutex);
return err;
}
@@ -324,7 +324,7 @@ void xgi_fb_free_all(struct xgi_info * info, struct drm_file * filp)
return;
}
- down(&info->fb_sem);
+ mutex_lock(&info->dev->struct_mutex);
do {
struct xgi_mem_block *block;
@@ -342,5 +342,5 @@ void xgi_fb_free_all(struct xgi_info * info, struct drm_file * filp)
(void) xgi_mem_free(&info->fb_heap, block->offset, filp);
} while(1);
- up(&info->fb_sem);
+ mutex_unlock(&info->dev->struct_mutex);
}
diff --git a/linux-core/xgi_pcie.c b/linux-core/xgi_pcie.c
index c0d424f5..883fbe7e 100644
--- a/linux-core/xgi_pcie.c
+++ b/linux-core/xgi_pcie.c
@@ -161,7 +161,7 @@ void xgi_pcie_free_all(struct xgi_info * info, struct drm_file * filp)
return;
}
- down(&info->pcie_sem);
+ mutex_lock(&info->dev->struct_mutex);
do {
struct xgi_mem_block *block;
@@ -179,7 +179,7 @@ void xgi_pcie_free_all(struct xgi_info * info, struct drm_file * filp)
(void) xgi_mem_free(&info->pcie_heap, block->offset, filp);
} while(1);
- up(&info->pcie_sem);
+ mutex_unlock(&info->dev->struct_mutex);
}
@@ -188,9 +188,9 @@ int xgi_pcie_free(struct xgi_info * info, unsigned long offset,
{
int err;
- down(&info->pcie_sem);
+ mutex_lock(&info->dev->struct_mutex);
err = xgi_mem_free(&info->pcie_heap, offset, filp);
- up(&info->pcie_sem);
+ mutex_unlock(&info->dev->struct_mutex);
if (err) {
DRM_ERROR("xgi_pcie_free() failed at base 0x%lx\n", offset);