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);
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;
};
{
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;
{
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;
}
return;
}
- down(&info->fb_sem);
+ mutex_lock(&info->dev->struct_mutex);
do {
struct xgi_mem_block *block;
(void) xgi_mem_free(&info->fb_heap, block->offset, filp);
} while(1);
- up(&info->fb_sem);
+ mutex_unlock(&info->dev->struct_mutex);
}
return;
}
- down(&info->pcie_sem);
+ mutex_lock(&info->dev->struct_mutex);
do {
struct xgi_mem_block *block;
(void) xgi_mem_free(&info->pcie_heap, block->offset, filp);
} while(1);
- up(&info->pcie_sem);
+ mutex_unlock(&info->dev->struct_mutex);
}
{
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);