From eb769c9dac0488266e40cddb1e05e7049028125c Mon Sep 17 00:00:00 2001
From: Eric Naim <dnaim@cachyos.org>
Date: Mon, 9 Jun 2025 13:00:54 +0700
Subject: [PATCH 4/4] nv-dmabuf: Inline dma_buf_attachment_is_dynamic()

6.16 made dma_buf_attachment_is_dynamic() an internal function, meaning
that modules like nvidia cannot use it now. This is not much of a
problem since we can inline the function body directly.

Signed-off-by: Eric Naim <dnaim@cachyos.org>
---
 kernel-open/nvidia/nv-dmabuf.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel-open/nvidia/nv-dmabuf.c b/kernel-open/nvidia/nv-dmabuf.c
index 8c1447b90a01..1c77ebe243a1 100644
--- a/kernel-open/nvidia/nv-dmabuf.c
+++ b/kernel-open/nvidia/nv-dmabuf.c
@@ -837,12 +837,10 @@ nv_dma_buf_map(
     // PCIe mapping, importers must be able to handle peer MMIO resources
     // not backed by struct page.
     //
-#if defined(NV_DMA_BUF_HAS_DYNAMIC_ATTACHMENT) && \
-    defined(NV_DMA_BUF_ATTACHMENT_HAS_PEER2PEER)
+#if defined(NV_DMA_BUF_ATTACHMENT_HAS_PEER2PEER)
     if (((!priv->nv->coherent) ||
          (priv->mapping_type == NV_DMABUF_EXPORT_MAPPING_TYPE_FORCE_PCIE)) &&
-        dma_buf_attachment_is_dynamic(attachment) &&
-        !attachment->peer2peer)
+        !!attachment->importer_ops && !attachment->peer2peer)
     {
         nv_printf(NV_DBG_ERRORS,
                   "NVRM: failed to map dynamic attachment with no P2P support\n");
-- 
2.49.0

