From 64728f311432ef2706a7f42b36ee5e925750fdc1 Mon Sep 17 00:00:00 2001 From: Jonas Larsson Date: Thu, 11 Jun 2020 09:19:54 -0700 Subject: [PATCH] staging: gasket: fix compilation on 5.1+ https://lore.kernel.org/patchwork/patch/1039724/ Bug: 158716452 Change-Id: I3c90a6524d3859e5518b7aece5a2817ed1f3efed (cherry picked from commit 0aacc629f48459a1f8169120afc868cdb48f0593) --- gasket_page_table.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gasket_page_table.c b/gasket_page_table.c index e495658..6cd8c0b 100644 --- a/gasket_page_table.c +++ b/gasket_page_table.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include "gasket_constants.h" @@ -532,7 +533,12 @@ static int gasket_perform_mapping(struct gasket_page_table *pg_tbl, return -EINVAL; /* Page already mapped for DMA. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) ptes[i].dma_addr = sg_page_iter_dma_address(sg_iter); +#else + ptes[i].dma_addr = sg_page_iter_dma_address( + container_of(sg_iter, struct sg_dma_page_iter, base)); +#endif ptes[i].page = NULL; offset = 0; } else if (is_coherent(pg_tbl, host_addr)) {