diff --git a/drivers/thermal/max77851_thermal.c b/drivers/thermal/max77851_thermal.c index 2b4d5289..c1bd7d96 100644 --- a/drivers/thermal/max77851_thermal.c +++ b/drivers/thermal/max77851_thermal.c @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-2.0 -// SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. /* * Junction temperature thermal driver for Maxim Max77851. */ @@ -44,14 +44,18 @@ struct max77851_therm_info { int irq_tjalarm2; }; -#if defined(NV_DEVM_THERMAL_OF_ZONE_REGISTER_PRESENT) +#if defined(NV_DEVM_THERMAL_OF_ZONE_REGISTER_PRESENT) /* Linux v6.1 */ static int max77851_thermal_read_temp(struct thermal_zone_device *data, int *temp) #else static int max77851_thermal_read_temp(void *data, int *temp) #endif { -#if defined(NV_DEVM_THERMAL_OF_ZONE_REGISTER_PRESENT) +#if defined(NV_DEVM_THERMAL_OF_ZONE_REGISTER_PRESENT) /* Linux v6.1 */ +#if defined(NV_THERMAL_ZONE_DEVICE_PRIV_PRESENT) /* Linux v6.4 */ + struct max77851_therm_info *thermal = thermal_zone_device_priv(data); +#else struct max77851_therm_info *thermal = data->devdata; +#endif #else struct max77851_therm_info *thermal = data; #endif diff --git a/drivers/thermal/pex9749-thermal.c b/drivers/thermal/pex9749-thermal.c index 0a6d3a4d..cfc95ca8 100644 --- a/drivers/thermal/pex9749-thermal.c +++ b/drivers/thermal/pex9749-thermal.c @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -110,10 +110,14 @@ static int pex9749_calc_temp(u16 v) return temp; } -#if defined(NV_DEVM_THERMAL_OF_ZONE_REGISTER_PRESENT) +#if defined(NV_DEVM_THERMAL_OF_ZONE_REGISTER_PRESENT) /* Linux v6.1 */ static int pex9749_get_temp(struct thermal_zone_device *tz, int *temp) { +#if defined(NV_THERMAL_ZONE_DEVICE_PRIV_PRESENT) /* Linux v6.4 */ + struct pex9749_priv *priv = thermal_zone_device_priv(tz); +#else struct pex9749_priv *priv = tz->devdata; +#endif #else static int pex9749_get_temp(void *data, int *temp) { diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 8e80b976..154a9ace 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -170,6 +170,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra264_chip_id 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 += 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 diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 89843940..e0a97568 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7815,6 +7815,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP" "" "types" ;; + thermal_zone_device_priv) + # + # Determine if the function thermal_zone_device_priv() is present. + # + # Commit a6ff3c002146 ("thermal/core: Add a thermal zone 'devdata' + # accessor") added function thermal_zone_device_priv() in Linux + # v6.4. + # + CODE=" + #include + void conftest_thermal_zone_device_priv(void) { + thermal_zone_device_priv(); + }" + + compile_check_conftest "$CODE" "NV_THERMAL_ZONE_DEVICE_PRIV_PRESENT" "" "functions" + ;; + tegra_dev_iommu_get_stream_id) # # Determine if the function tegra_dev_iommu_get_stream_id is present.