net: can: mttcan: Fix build for Linux v6.17

In Linux v6.17, the 'const' qualifier for the 'struct cyclecounter'
argument on of the cyclecounter 'read' function pointer was dropped.
Add a test to conftest to detect this and update the Tegra MTT CAN
driver accordingly to fix the build.

Bug 5420210

Change-Id: Idff1429bbf45fe160e16a6dbc51e8cb00909a876
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3423831
(cherry picked from commit 10569f9bbea4fc8172a94b8d5c5190fc2687b199)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3462468
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2025-07-23 18:18:31 +01:00
committed by mobile promotions
parent 9976ac1020
commit 76bdc9f5b6
4 changed files with 27 additions and 0 deletions

View File

@@ -112,6 +112,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_attribute_struct_has_const_struct_cl
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 += clk_hw_determine_rate_no_reparent
NV_CONFTEST_FUNCTION_COMPILE_TESTS += cyclecounter_struct_read_has_const_cyclecounter_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += define_semaphore_has_number_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devfreq_dev_profile_has_is_cooling_device
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devfreq_has_freq_table

View File

@@ -6945,6 +6945,24 @@ compile_test() {
compile_check_conftest "$CODE" "NV_CLK_HW_DETERMINE_RATE_NO_REPARENT_PRESENT" "" "functions"
;;
cyclecounter_struct_read_has_const_cyclecounter_arg)
#
# Determine if the 'cyclecounter' structure 'read' function pointer
# has a const 'struct cyclecounter' argument.
#
# The const qualifier was dropped in Linux v6.17 by commit e78f70bad29c
# ("time/timecounter: Fix the lie that struct cyclecounter is const")
#
CODE="
#include <linux/timecounter.h>
void conftest(struct cyclecounter *cc) {
u64 (*fn)(const struct cyclecounter *) = cc->read;
}"
compile_check_conftest "$CODE" \
"NV_CYCLECOUNTER_STRUCT_READ_HAS_CONST_CYCLECOUNTER_ARG" "" "types"
;;
define_semaphore_has_number_arg)
#
# Determine if the macro DEFINE_SEMAPHORE has a number argument.