conftest: update tests for devfreq and thermal

Introduce the following three tests:
1. devfreq_dev_profile_has_is_cooling_device
2. devfreq_has_freq_table
3. thermal_zone_for_each_trip

Bug 4854967

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I5fe2f7102f667a31d61550487a153590584ed638
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3213844
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Johnny Liu
2024-09-18 01:30:55 +00:00
committed by Jon Hunter
parent 8a471e9088
commit 727ee719a2
2 changed files with 53 additions and 0 deletions

View File

@@ -105,6 +105,8 @@ 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 += 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
NV_CONFTEST_FUNCTION_COMPILE_TESTS += device_add_disk_has_int_return_type
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_tegra_core_dev_init_opp_table_common
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register
@@ -186,6 +188,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map
NV_CONFTEST_FUNCTION_COMPILE_TESTS += thermal_zone_device_priv
NV_CONFTEST_FUNCTION_COMPILE_TESTS += thermal_zone_device_ops_struct_has_get_trip_type
NV_CONFTEST_FUNCTION_COMPILE_TESTS += thermal_zone_for_each_trip
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_send_xchar_has_u8_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_write_has_u8_ptr_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_set_termios_has_const_ktermios_arg

View File

@@ -6812,6 +6812,39 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DEFINE_SEMAPHORE_HAS_NUMBER_ARG" "" "types"
;;
devfreq_dev_profile_has_is_cooling_device)
#
# Determine if the 'devfreq_dev_profile' structure has 'is_cooling_device'.
#
# Commit 1224451bb6f93 ("PM / devfreq: Register devfreq as a cooling device
# on demand") updated the devfreq_dev_profile and add the is_cooling_device
# field in v5.12.
#
CODE="
#include <linux/devfreq.h>
bool conftest_devfreq_dev_profile_has_is_cooling_device(struct devfreq_dev_profile *profile) {
return profile->is_cooling_device;
}"
compile_check_conftest "$CODE" "NV_DEVFREQ_DEV_PROFILE_HAS_IS_COOLING_DEVICE" "" "types"
;;
devfreq_has_freq_table)
#
# Determine if the 'devfreq' structure has 'freq_table'.
#
# Commit b5d281f6c16d ("PM / devfreq: Rework freq_table to be local to devfreq
# struct") updated the devfreq and add the freq_table field in v5.19.
#
CODE="
#include <linux/devfreq.h>
unsigned long *conftest_devfreq_has_freq_table(struct devfreq *devfreq) {
return devfreq->freq_table;
}"
compile_check_conftest "$CODE" "NV_DEVFREQ_HAS_FREQ_TABLE" "" "types"
;;
device_add_disk_has_int_return_type)
#
# Determine if the function device_add_disk() returns an integer.
@@ -8110,6 +8143,23 @@ compile_test() {
compile_check_conftest "$CODE" "NV_THERMAL_ZONE_DEVICE_OPS_STRUCT_HAS_GET_TRIP_TYPE" "" "types"
;;
thermal_zone_for_each_trip)
#
# Determine if the function thermal_zone_for_each_trip is present.
#
# thermal_zone_for_each_trip was added in commit a56cc0a833852
# ("thermal: core: Add function to walk trips under zone lock")
# in v6.6-rc3 (2023-10-03)
#
CODE="
#include <linux/thermal.h>
int conftest_thermal_zone_for_each_trip(void) {
return thermal_zone_for_each_trip();
}"
compile_check_conftest "$CODE" "NV_THERMAL_ZONE_FOR_EACH_TRIP_PRESENT" "" "functions"
;;
tegra_dev_iommu_get_stream_id)
#
# Determine if the function tegra_dev_iommu_get_stream_id is present.