diff --git a/drivers/platform/tegra/rtcpu/ivc-bus.c b/drivers/platform/tegra/rtcpu/ivc-bus.c index 4698cea5..2ed87cba 100644 --- a/drivers/platform/tegra/rtcpu/ivc-bus.c +++ b/drivers/platform/tegra/rtcpu/ivc-bus.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +#include + #include #include #include @@ -388,10 +390,10 @@ static int tegra_ivc_bus_probe(struct device *dev) return ret; } -#if (KERNEL_VERSION(5, 15, 0) <= LINUX_VERSION_CODE) -static void tegra_ivc_bus_remove(struct device *dev) -#else +#if defined(NV_BUS_TYPE_STRUCT_REMOVE_HAS_INT_RETURN_TYPE) /* Linux v5.15 */ static int tegra_ivc_bus_remove(struct device *dev) +#else +static void tegra_ivc_bus_remove(struct device *dev) #endif { if (dev->type == &tegra_ivc_channel_type) { @@ -408,7 +410,7 @@ static int tegra_ivc_bus_remove(struct device *dev) } -#if (KERNEL_VERSION(5, 15, 0) > LINUX_VERSION_CODE) +#if defined(NV_BUS_TYPE_STRUCT_REMOVE_HAS_INT_RETURN_TYPE) /* Linux v5.15 */ return 0; #endif } diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 582242a0..1c708552 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -88,6 +88,7 @@ endef # provided by the module-specific Kbuild files. # +NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_remove_has_int_return_type NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers_has_drm_driver_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 4d5015d7..8bd93e6a 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6293,6 +6293,25 @@ compile_test() { compile_check_conftest "$CODE" "NV_CRYPTO_PRESENT" "" "symbols" ;; + bus_type_struct_remove_has_int_return_type) + # + # Determine if the 'remove' callback from the 'bus_type' structure + # has an integer return type. + # + # Commit fc7a6209d571 ("bus: Make remove callback return void") made + # the 'remove' callback return void instead of an integer in Linux + # v5.15. + # + CODE=" + #include + int conftest_bus_type_struct_remove_has_int_return_type(struct device *dev, + struct bus_type *bus) { + return bus->remove(dev); + }" + + compile_check_conftest "$CODE" "NV_BUS_TYPE_STRUCT_REMOVE_HAS_INT_RETURN_TYPE" "" "types" + ;; + class_struct_devnode_has_const_dev_arg) # # Determine if the 'class' structure devnode function pointer @@ -6515,7 +6534,7 @@ compile_test() { # function in Linux v6.0. # CODE=" - #include + #include #include #include int conftest_register_shrinker_has_fmt_arg(struct shrinker *s, const char *name) {