Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma
[deliverable/linux.git] / drivers / gpu / drm / drm_dma.c
index 495b5fd2787c7b04986bdba6e9bf14efbddea7c0..8a140a953754de73d2a524bbaae8599bc5063984 100644 (file)
  *
  * 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;
 
+       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);
        if (!dev->dma)
                return -ENOMEM;
@@ -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
  * 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;
        int i, j;
 
+       if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) ||
+           drm_core_check_feature(dev, DRIVER_MODESET)) {
+               return;
+       }
+
        if (!dma)
                return;
 
This page took 0.050553 seconds and 5 git commands to generate.