From 3fba8947fb9978de174dddf35a6f1d608ca9b6ad Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Wed, 18 Dec 2024 10:43:17 +0000 Subject: [PATCH] drm/tegra: Fix build for Linux v6.14 In Linux v6.14, the 'date' field was removed from the 'drm_driver' structure. Add a test to conftest to detect this and update the Tegra DRM driver accordingly. Jira LINQPJ14-6 Change-Id: Ia3024321f12f8448d382deba996407f9d3232567 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297069 (cherry picked from commit 12d50906f3800c37a35be59b49157797ed529159) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3499756 Reviewed-by: Brad Griffis GVS: buildbot_gerritrpt Tested-by: Brad Griffis --- drivers/gpu/drm/tegra/drm.c | 2 ++ scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index ad5b599c..69eeb805 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -911,7 +911,9 @@ static const struct drm_driver tegra_drm_driver = { .name = DRIVER_NAME, .desc = DRIVER_DESC, +#if defined(NV_DRM_DRIVER_STRUCT_HAS_DATE) /* Linux v6.14 */ .date = DRIVER_DATE, +#endif .major = DRIVER_MAJOR, .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 96bb6d58..7db7577b 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -118,6 +118,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change 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_debugfs_remove_files_has_root_arg +NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_date NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_alloc_info NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_prepare_has_preferred_bpp_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 0c95272a..ca473c47 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7064,6 +7064,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG" "" "types" ;; + drm_driver_struct_has_date) + # + # Determine if the 'drm_driver' structure has a 'date' field. + # + # Commit cb2e1c2136f7 ("drm: remove driver date from struct drm_driver and all + # drivers") removed the 'date' field from the 'drm_driver' structure in Linux + # v6.14. + # + CODE=" + #include + int conftest_drm_driver_struct_has_date(void) { + return offsetof(struct drm_driver, date); + }" + + compile_check_conftest "$CODE" "NV_DRM_DRIVER_STRUCT_HAS_DATE" "" "types" + ;; + drm_driver_struct_has_irq_enabled_arg) # # Determine if the 'drm_driver' structure