diff --git a/drivers/net/can/mttcan/hal/m_ttcan.c b/drivers/net/can/mttcan/hal/m_ttcan.c index 9535a6eb..5f883483 100644 --- a/drivers/net/can/mttcan/hal/m_ttcan.c +++ b/drivers/net/can/mttcan/hal/m_ttcan.c @@ -1037,7 +1037,11 @@ int ttcan_controller_init(struct ttcan_controller *ttcan, u32 irq_flag, return 0; } +#if defined(NV_CYCLECOUNTER_STRUCT_READ_HAS_CONST_CYCLECOUNTER_ARG) u64 ttcan_read_ts_cntr(const struct cyclecounter *ccnt) +#else +u64 ttcan_read_ts_cntr(struct cyclecounter *ccnt) +#endif { struct mttcan_priv *priv = container_of(ccnt, struct mttcan_priv, cc); diff --git a/drivers/net/can/mttcan/include/m_ttcan.h b/drivers/net/can/mttcan/include/m_ttcan.h index 5d9baa2a..329a3666 100644 --- a/drivers/net/can/mttcan/include/m_ttcan.h +++ b/drivers/net/can/mttcan/include/m_ttcan.h @@ -559,5 +559,9 @@ int add_msg_controller_list(struct ttcan_controller *ttcan, int add_event_controller_list(struct ttcan_controller *ttcan, struct mttcan_tx_evt_element *txevt, struct list_head *evt_q); +#if defined(NV_CYCLECOUNTER_STRUCT_READ_HAS_CONST_CYCLECOUNTER_ARG) u64 ttcan_read_ts_cntr(const struct cyclecounter *ccnt); +#else +u64 ttcan_read_ts_cntr(struct cyclecounter *ccnt); +#endif #endif diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 1cc7a6f4..1a56ab39 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -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 diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index f3108cb1..83820acb 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -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 + 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.