Commit e2e99a82 authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

drm: mark dma setup/teardown as legacy systems

And hide the checks a bit better. This was already disallowed for
modesetting drivers, so no functinal change here.
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 8e194bbf
...@@ -44,10 +44,18 @@ ...@@ -44,10 +44,18 @@
* *
* Allocate and initialize a drm_device_dma structure. * Allocate and initialize a drm_device_dma structure.
*/ */
int drm_dma_setup(struct drm_device *dev) int drm_legacy_dma_setup(struct drm_device *dev)
{ {
int i; int i;
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) ||
drm_core_check_feature(dev, DRIVER_MODESET)) {
return 0;
}
dev->buf_use = 0;
atomic_set(&dev->buf_alloc, 0);
dev->dma = kzalloc(sizeof(*dev->dma), GFP_KERNEL); dev->dma = kzalloc(sizeof(*dev->dma), GFP_KERNEL);
if (!dev->dma) if (!dev->dma)
return -ENOMEM; return -ENOMEM;
...@@ -66,11 +74,16 @@ int drm_dma_setup(struct drm_device *dev) ...@@ -66,11 +74,16 @@ int drm_dma_setup(struct drm_device *dev)
* Free all pages associated with DMA buffers, the buffers and pages lists, and * Free all pages associated with DMA buffers, the buffers and pages lists, and
* finally the drm_device::dma structure itself. * finally the drm_device::dma structure itself.
*/ */
void drm_dma_takedown(struct drm_device *dev) void drm_legacy_dma_takedown(struct drm_device *dev)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
int i, j; int i, j;
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) ||
drm_core_check_feature(dev, DRIVER_MODESET)) {
return;
}
if (!dma) if (!dma)
return; return;
......
...@@ -205,9 +205,7 @@ int drm_lastclose(struct drm_device * dev) ...@@ -205,9 +205,7 @@ int drm_lastclose(struct drm_device * dev)
kfree(vma); kfree(vma);
} }
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && drm_legacy_dma_takedown(dev);
!drm_core_check_feature(dev, DRIVER_MODESET))
drm_dma_takedown(dev);
dev->dev_mapping = NULL; dev->dev_mapping = NULL;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
......
...@@ -60,15 +60,9 @@ static int drm_setup(struct drm_device * dev) ...@@ -60,15 +60,9 @@ static int drm_setup(struct drm_device * dev)
atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->ioctl_count, 0);
atomic_set(&dev->vma_count, 0); atomic_set(&dev->vma_count, 0);
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && i = drm_legacy_dma_setup(dev);
!drm_core_check_feature(dev, DRIVER_MODESET)) {
dev->buf_use = 0;
atomic_set(&dev->buf_alloc, 0);
i = drm_dma_setup(dev);
if (i < 0) if (i < 0)
return i; return i;
}
for (i = 0; i < ARRAY_SIZE(dev->counts); i++) for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
atomic_set(&dev->counts[i], 0); atomic_set(&dev->counts[i], 0);
......
...@@ -1374,8 +1374,8 @@ extern int drm_mapbufs(struct drm_device *dev, void *data, ...@@ -1374,8 +1374,8 @@ extern int drm_mapbufs(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
/* DMA support (drm_dma.h) */ /* DMA support (drm_dma.h) */
extern int drm_dma_setup(struct drm_device *dev); extern int drm_legacy_dma_setup(struct drm_device *dev);
extern void drm_dma_takedown(struct drm_device *dev); extern void drm_legacy_dma_takedown(struct drm_device *dev);
extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf); extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf);
extern void drm_core_reclaim_buffers(struct drm_device *dev, extern void drm_core_reclaim_buffers(struct drm_device *dev,
struct drm_file *filp); struct drm_file *filp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment