Replace per-heap semaphores with drm_device::struct_mutex.

This commit is contained in:
Ian Romanick 2007-08-06 16:17:23 -07:00
parent f96bff9e21
commit 90907c5915
4 changed files with 10 additions and 16 deletions

View file

@ -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);

View file

@ -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;
};

View file

@ -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);
}

View file

@ -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);