GKI: Adapt to upstream dma-buf locking changes

The dma-buf locking convention has changed upstream [1] and this driver
is generating warnings because it has not yet been updated to take the
necessary locks.

[1] https://lore.kernel.org/all/20221017172229.42269-1-dmitry.osipenko@collabora.com/
Change-Id: I95f60757d9ff83a88ff5ecb67a5a9f7c7caf603b
Signed-off-by: T.J. Mercier <tjmercier@google.com>
[willmcvicker: adapt based on LINUX_VERSION_CODE]
Signed-off-by: Will McVicker <willmcvicker@google.com>
(cherry picked from commit 508a6ac20d3c0c12457734812dfa4be7f543ab4e)
diff --git a/drivers/trusty/trusty-ipc.c b/drivers/trusty/trusty-ipc.c
index 6309cfd..5ae31fd 100644
--- a/drivers/trusty/trusty-ipc.c
+++ b/drivers/trusty/trusty-ipc.c
@@ -918,8 +918,13 @@
 	}
 
 	if (shared_handle->sgt)
-		dma_buf_unmap_attachment(shared_handle->attach,
-					 shared_handle->sgt, DMA_BIDIRECTIONAL);
+#if (KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE)
+		dma_buf_unmap_attachment_unlocked(
+#else
+		dma_buf_unmap_attachment(
+#endif
+			shared_handle->attach, shared_handle->sgt,
+			DMA_BIDIRECTIONAL);
 	if (shared_handle->attach)
 		dma_buf_detach(shared_handle->dma_buf, shared_handle->attach);
 	if (shared_handle->dma_buf)
@@ -1538,8 +1543,12 @@
 		goto cleanup_handle;
 	}
 
-	shared_handle->sgt = dma_buf_map_attachment(shared_handle->attach,
-						    DMA_BIDIRECTIONAL);
+#if (KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE)
+	shared_handle->sgt = dma_buf_map_attachment_unlocked(
+#else
+	shared_handle->sgt = dma_buf_map_attachment(
+#endif
+				shared_handle->attach, DMA_BIDIRECTIONAL);
 	if (IS_ERR(shared_handle->sgt)) {
 		ret = PTR_ERR(shared_handle->sgt);
 		shared_handle->sgt = NULL;