diff options
Diffstat (limited to 'sys/dev/pci/drm/mga_dma.c')
-rw-r--r-- | sys/dev/pci/drm/mga_dma.c | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/sys/dev/pci/drm/mga_dma.c b/sys/dev/pci/drm/mga_dma.c index 366da653f23..5bd300be9ea 100644 --- a/sys/dev/pci/drm/mga_dma.c +++ b/sys/dev/pci/drm/mga_dma.c @@ -1001,12 +1001,17 @@ int mga_dma_reset(struct drm_device *dev, void *data, * DMA buffer management */ -static int mga_dma_get_buffers(struct drm_device * dev, - struct drm_file *file_priv, struct drm_dma * d) + +int +mga_dma_buffers(struct drm_device *dev, struct drm_dma * d, + struct drm_file *file_priv) { + drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; struct drm_buf *buf; int i; + WRAP_TEST_WITH_RETURN(dev_priv); + for (i = d->granted_count; i < d->request_count; i++) { buf = mga_freelist_get(dev); if (!buf) @@ -1026,43 +1031,6 @@ static int mga_dma_get_buffers(struct drm_device * dev, return 0; } -int mga_dma_buffers(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - struct drm_device_dma *dma = dev->dma; - drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; - struct drm_dma *d = data; - int ret = 0; - - LOCK_TEST_WITH_RETURN(dev, file_priv); - - /* Please don't send us buffers. - */ - if (d->send_count != 0) { - DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", - DRM_CURRENTPID, d->send_count); - return EINVAL; - } - - /* We'll send you buffers. - */ - if (d->request_count < 0 || d->request_count > dma->buf_count) { - DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", - DRM_CURRENTPID, d->request_count, dma->buf_count); - return EINVAL; - } - - WRAP_TEST_WITH_RETURN(dev_priv); - - d->granted_count = 0; - - if (d->request_count) { - ret = mga_dma_get_buffers(dev, file_priv, d); - } - - return ret; -} - /** * Called when the last opener of the device is closed. */ |