diff --git a/drivers/hwmon/f75308.c b/drivers/hwmon/f75308.c index 0b7d0a5a..f26e312a 100644 --- a/drivers/hwmon/f75308.c +++ b/drivers/hwmon/f75308.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -1093,8 +1093,10 @@ static int f75308_probe_child_from_dt(struct device *dev, u32 reg_idx, seg_idx = 0, seg_val; u8 seg5[F75308_MAX_FAN_SEG_CNT]; const char *val_str; +#if !defined(NV_OF_PROPERTY_FOR_EACH_REMOVED_INTERNAL_ARGS) /* Linux v6.11 */ struct property *prop; const __be32 *p; +#endif status = of_property_read_u32(child, "reg", ®_idx); if (status) { @@ -1125,7 +1127,11 @@ static int f75308_probe_child_from_dt(struct device *dev, if (status) return status; +#if defined(NV_OF_PROPERTY_FOR_EACH_REMOVED_INTERNAL_ARGS) /* Linux v6.11 */ + of_property_for_each_u32(child, "5seg", seg_val) { +#else of_property_for_each_u32(child, "5seg", prop, p, seg_val) { +#endif dev_dbg(dev, "%s: seg5[%u]: %u\n", __func__, seg_idx, seg_val); if (seg_idx < F75308_MAX_FAN_SEG_CNT) seg5[seg_idx++] = seg_val; diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 066b6781..03e931c5 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -141,6 +141,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += of_get_named_gpio_flags NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_chip_struct_has_of_node_present NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_device_find NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_device_get_chip +NV_CONFTEST_FUNCTION_COMPILE_TESTS += of_property_for_each_u32_removed_internal_args NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_chip_struct_has_base_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_chip_struct_has_struct_device diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index a4c5c91e..1a8e8325 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7375,6 +7375,30 @@ compile_test() { compile_check_conftest "$CODE" "NV_MII_BUS_STRUCT_HAS_WRITE_C45" "" "types" ;; + of_property_for_each_u32_removed_internal_args) + # + # Determine if the internal arguments for the macro + # of_property_for_each_u32() have been removed. + # + # Commit 9722c3b66e21 ("of: remove internal arguments from + # of_property_for_each_u32()") removes two arguments from + # of_property_for_each_u32() which are used internally within + # the macro and so do not need to be passed. This change was + # made for Linux v6.11. + # + CODE=" + #include + void conftest_of_property_for_each_u32(struct device_node *np, + char *propname) { + u32 val; + + of_property_for_each_u32(np, propname, val) + pr_info(\"val %u\n\", val); + }" + + compile_check_conftest "$CODE" "NV_OF_PROPERTY_FOR_EACH_REMOVED_INTERNAL_ARGS" "" "types" + ;; + pwm_chip_struct_has_base_arg) # # Determine if 'struct pwm_chip' has the 'base' field.