drm/tegra: Fix build for Linux v6.5

In Linux v6.5, commit 62aeaeaa1b26 ("drm/aperture: Remove primary
argument") removed the 'primary' argument from the function
drm_aperture_remove_framebuffers(). Update the test in conftest script
for drm_aperture_remove_framebuffers() to test for this and use the
generated definition accordlingly in the Tegra DRM driver to fix the
build for Linux v6.5.

Bug 4221847

Change-Id: I7a7bb3a029b236e0ce42c1a404085757d95374d1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990528
This commit is contained in:
Jon Hunter
2023-10-03 14:50:04 +01:00
committed by mobile promotions
parent f926a58dd1
commit 413055df75
3 changed files with 24 additions and 8 deletions

View File

@@ -1300,7 +1300,9 @@ static int host1x_drm_probe(struct host1x_device *dev)
drm_mode_config_reset(drm); drm_mode_config_reset(drm);
if (drm->mode_config.num_crtc > 0) { if (drm->mode_config.num_crtc > 0) {
#if defined(NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_DRM_DRIVER_ARG) /* Linux v5.15 */ #if defined(NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_NO_PRIMARY_ARG) /* Linux v6.5 */
err = drm_aperture_remove_framebuffers(&tegra_drm_driver);
#elif defined(NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_DRM_DRIVER_ARG) /* Linux v5.15 */
err = drm_aperture_remove_framebuffers(false, &tegra_drm_driver); err = drm_aperture_remove_framebuffers(false, &tegra_drm_driver);
#else #else
err = drm_aperture_remove_framebuffers(false, "tegradrmfb"); err = drm_aperture_remove_framebuffers(false, "tegradrmfb");

View File

@@ -93,7 +93,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_create_has_no_owner_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += define_semaphore_has_number_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += define_semaphore_has_number_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers_has_drm_driver_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg 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_alloc_info
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_prepare_has_preferred_bpp_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_prepare_has_preferred_bpp_arg

View File

@@ -6419,24 +6419,38 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DEVM_THERMAL_OF_ZONE_REGISTER_PRESENT" "" "functions" compile_check_conftest "$CODE" "NV_DEVM_THERMAL_OF_ZONE_REGISTER_PRESENT" "" "functions"
;; ;;
drm_aperture_remove_framebuffers_has_drm_driver_arg) drm_aperture_remove_framebuffers)
# #
# Determine if the function 'drm_aperture_remove_framebuffers' # Determine if the function 'drm_aperture_remove_framebuffers'
# has the 'struct drm_driver' argument. # has the 'struct drm_driver' argument.
# #
# Commit 97c9bfe3f660 ("drm/aperture: Pass DRM driver structure # Conftest #1: In Linux v5.15, commit 97c9bfe3f660 ("drm/aperture:
# instead of driver name") updated the arguments for the function # Pass DRM driver structure instead of driver name") updated the
# drm_aperture_remove_framebuffers to pass 'struct drm_driver' in # arguments for the function drm_aperture_remove_framebuffers to
# Linux v5.15. # pass 'struct drm_driver'.
# #
CODE=" CODE="
#include <drm/drm_aperture.h> #include <drm/drm_aperture.h>
int conftest_drm_aperture_remove_framebuffers_has_drm_driver_arg( int conftest_drm_aperture_remove_framebuffers(
bool primary, const struct drm_driver *req_driver) { bool primary, const struct drm_driver *req_driver) {
return drm_aperture_remove_framebuffers(primary, req_driver); return drm_aperture_remove_framebuffers(primary, req_driver);
}" }"
compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_DRM_DRIVER_ARG" "" "types" compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_DRM_DRIVER_ARG" "" "types"
#
# Conftest #2: In Linux v6.5, commit 62aeaeaa1b26 ("drm/aperture:
# Remove primary argument") removed the 'primary' argument from the
# function drm_aperture_remove_framebuffers().
#
CODE="
#include <drm/drm_aperture.h>
int conftest_drm_aperture_remove_framebuffers(
const struct drm_driver *req_driver) {
return drm_aperture_remove_framebuffers(req_driver);
}"
compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_NO_PRIMARY_ARG" "" "types"
;; ;;
drm_driver_struct_has_irq_enabled_arg) drm_driver_struct_has_irq_enabled_arg)