dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 09/25] drm: mark dma setup/teardown as legacy systems
Date: Thu,  8 Aug 2013 15:41:19 +0200	[thread overview]
Message-ID: <1375969295-18929-10-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1375969295-18929-1-git-send-email-daniel.vetter@ffwll.ch>

And hide the checks a bit better. This was already disallowed for
modesetting drivers, so no functinal change here.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_dma.c  | 17 +++++++++++++++--
 drivers/gpu/drm/drm_drv.c  |  4 +---
 drivers/gpu/drm/drm_fops.c | 12 +++---------
 include/drm/drmP.h         |  4 ++--
 4 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
index 495b5fd..8a140a9 100644
--- a/drivers/gpu/drm/drm_dma.c
+++ b/drivers/gpu/drm/drm_dma.c
@@ -44,10 +44,18 @@
  *
  * 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;
 
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 743b24d..5b949a7 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -205,9 +205,7 @@ int drm_lastclose(struct drm_device * dev)
 		kfree(vma);
 	}
 
-	if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
-	    !drm_core_check_feature(dev, DRIVER_MODESET))
-		drm_dma_takedown(dev);
+	drm_legacy_dma_takedown(dev);
 
 	dev->dev_mapping = NULL;
 	mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 10bf4f6..702e2a8 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -61,15 +61,9 @@ static int drm_setup(struct drm_device * dev)
 	atomic_set(&dev->ioctl_count, 0);
 	atomic_set(&dev->vma_count, 0);
 
-	if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
-	    !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)
-			return i;
-	}
+	i = drm_legacy_dma_setup(dev);
+	if (i < 0)
+		return i;
 
 	for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
 		atomic_set(&dev->counts[i], 0);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index bc38f99..de19e97 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1394,8 +1394,8 @@ extern int drm_mapbufs(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv);
 
 				/* DMA support (drm_dma.h) */
-extern int drm_dma_setup(struct drm_device *dev);
-extern void drm_dma_takedown(struct drm_device *dev);
+extern int drm_legacy_dma_setup(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_core_reclaim_buffers(struct drm_device *dev,
 				     struct drm_file *filp);
-- 
1.8.3.2

  parent reply	other threads:[~2013-08-08 13:41 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08 13:41 [PATCH 00/25] drm cruft removal Daniel Vetter
2013-08-08 13:41 ` [PATCH 01/25] drm/omap: kill firstopen callback Daniel Vetter
2013-08-08 14:04   ` Rob Clark
2013-08-08 13:41 ` [PATCH 02/25] drm/radeon: kill firstopen callback for kms driver Daniel Vetter
2013-08-08 13:41 ` [PATCH 03/25] drm/imx: kill firstopen callback Daniel Vetter
2013-08-12 22:23   ` Greg Kroah-Hartman
2013-08-08 13:41 ` [PATCH 04/25] drm/vmwgfx: remove ->firstopen callback Daniel Vetter
2013-08-08 13:41 ` [PATCH 05/25] drm: don't call ->firstopen for KMS drivers Daniel Vetter
2013-08-08 13:41 ` [PATCH 06/25] drm: kill dev->driver->set_version Daniel Vetter
2013-08-08 14:10   ` Rob Clark
2013-08-08 13:41 ` [PATCH 07/25] drm: hide legacy sg cleanup better from common code Daniel Vetter
2013-08-08 13:41 ` [PATCH 08/25] drm: disallow legacy sg ioctls for modesetting drivers Daniel Vetter
2013-08-08 13:41 ` Daniel Vetter [this message]
2013-08-08 13:41 ` [PATCH 10/25] drm: disallow legacy dma " Daniel Vetter
2013-08-08 13:41 ` [PATCH 11/25] drm: mark context support as a legacy subsystem Daniel Vetter
2013-08-08 13:41 ` [PATCH 12/25] drm/vmwgfx: remove redundant clearing of driver->dma_quiescent Daniel Vetter
2013-08-08 13:41 ` [PATCH 13/25] drm: remove FASYNC support Daniel Vetter
2013-08-13 19:26   ` David Herrmann
2013-08-08 13:41 ` [PATCH 14/25] drm: rip out DRIVER_FB_DMA and related code Daniel Vetter
2013-08-08 13:41 ` [PATCH 15/25] drm: rip out a few unused DRIVER flags Daniel Vetter
2013-08-08 13:41 ` [PATCH 16/25] drm: remove a bunch of unused #defines from drmP.h Daniel Vetter
2013-08-08 13:41 ` [PATCH 17/25] drm: rip out drm_core_has_MTRR checks Daniel Vetter
2013-08-09 18:12   ` Andy Lutomirski
2013-08-09 18:36     ` Daniel Vetter
2013-08-09 18:39       ` Andy Lutomirski
2013-08-09 18:47         ` Daniel Vetter
2013-08-09 18:48           ` Andy Lutomirski
2013-08-15 12:44   ` David Herrmann
2013-08-08 13:41 ` [PATCH 18/25] drm/docs: rip out removed driver flags documentation Daniel Vetter
2013-08-08 13:41 ` [PATCH 19/25] drm: remove the dma_ioctl special-case Daniel Vetter
2013-08-13 18:05   ` David Herrmann
2013-08-08 13:41 ` [PATCH 20/25] drm/memory: don't export agp helpers Daniel Vetter
2013-08-08 13:41 ` [PATCH 21/25] drm: hollow-out GET_CLIENT ioctl Daniel Vetter
2013-08-08 13:41 ` [PATCH 22/25] drm: no-op out GET_STATS ioctl Daniel Vetter
2013-08-08 15:55   ` Eric Anholt
2013-08-09  9:05     ` Daniel Vetter
2013-08-08 13:41 ` [PATCH 23/25] drm: fix locking in gem debugfs/procfs file Daniel Vetter
2013-08-08 13:41 ` [PATCH 24/25] drm: remove procfs code, take 2 Daniel Vetter
2013-08-08 13:41 ` [PATCH 25/25] drm: move dev data clearing from drm_setup to lastclose Daniel Vetter
2013-08-13 18:12   ` David Herrmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375969295-18929-10-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).