diff --git a/drivers/video/tegra/nvmap/nvmap_dmabuf.c b/drivers/video/tegra/nvmap/nvmap_dmabuf.c index bd0c5c11..5d8e87c4 100644 --- a/drivers/video/tegra/nvmap/nvmap_dmabuf.c +++ b/drivers/video/tegra/nvmap/nvmap_dmabuf.c @@ -489,8 +489,9 @@ static struct dma_buf_ops nvmap_dma_buf_ops = { .mmap = nvmap_dmabuf_mmap, .vmap = nvmap_dmabuf_vmap, .vunmap = nvmap_dmabuf_vunmap, +#if defined(NV_DMA_BUF_OPS_HAS_CACHE_SGT_MAPPING) .cache_sgt_mapping = true, - +#endif }; static char dmabuf_name[] = "nvmap_dmabuf"; diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 1d164d7b..084f0774 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -123,6 +123,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_spi_alloc_host NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_tegra_core_dev_init_opp_table_common NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change +NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_buf_ops_has_cache_sgt_mapping NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_slave_config_struct_has_slave_id NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_connector_helper_funcs_struct_mode_valid_has_const_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 1688e9d6..61c8247b 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7131,6 +7131,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_DISK_CHECK_MEDIA_CHANGE_PRESENT" "" "functions" ;; + dma_buf_ops_has_cache_sgt_mapping) + # + # Determine if the 'dma_buf_ops' structure has 'cache_sgt_mapping' member. + # + # In Linux v6.16, commit b72f66f22c0e ("dma-buf: drop caching of sg_tables") + # removed the 'cache_sgt_mapping' member from the 'dma_buf_ops' structure. + # + CODE=" + #include + int conftest_dma_buf_ops_has_cache_sgt_mapping(void) { + return offsetof(struct dma_buf_ops, cache_sgt_mapping); + }" + + compile_check_conftest "$CODE" "NV_DMA_BUF_OPS_HAS_CACHE_SGT_MAPPING" "" "types" + ;; + dma_slave_config_struct_has_slave_id) # # Determine if 'struct dma_slave_config' has the 'slave_id' member.