Linux-Tegra Archive mirror
 help / color / mirror / Atom feed
From: Mikko Perttunen <cyndis@kapsi.fi>
To: Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>
Cc: Mikko Perttunen <mperttunen@nvidia.com>,
	dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org
Subject: [PATCH 1/2] drm/tegra: gem: Open code drm_prime_gem_destroy
Date: Wed, 24 Apr 2024 08:13:34 +0300	[thread overview]
Message-ID: <20240424051335.2872574-1-cyndis@kapsi.fi> (raw)

From: Mikko Perttunen <mperttunen@nvidia.com>

Since we aren't using drm_gem_prime_import(_dev), for clarity don't
use the corresponding destroy function either.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/gpu/drm/tegra/gem.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index b4eb030ea961..189861c6c630 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -520,9 +520,12 @@ void tegra_bo_free_object(struct drm_gem_object *gem)
 		tegra_bo_iommu_unmap(tegra, bo);
 
 	if (gem->import_attach) {
+		struct dma_buf *dmabuf = gem->import_attach->dmabuf;
+
 		dma_buf_unmap_attachment_unlocked(gem->import_attach, bo->sgt,
 						  DMA_TO_DEVICE);
-		drm_prime_gem_destroy(gem, NULL);
+		dma_buf_detach(dmabuf, gem->import_attach);
+		dma_buf_put(dmabuf);
 	} else {
 		tegra_bo_free(gem->dev, bo);
 	}
-- 
2.42.0


             reply	other threads:[~2024-04-24  6:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24  5:13 Mikko Perttunen [this message]
2024-04-24  5:13 ` [PATCH 2/2] drm/tegra: gem: Don't attach dma-bufs when not needed Mikko Perttunen

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=20240424051335.2872574-1-cyndis@kapsi.fi \
    --to=cyndis@kapsi.fi \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=thierry.reding@gmail.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).