From 9c180ac0c8a34936d3ffaf0764ab18d79b39c59a Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Fri, 22 Mar 2024 22:17:38 +0000 Subject: [PATCH] soc/tegra: bpmp: Fix build for Linux v6.9 In Linux v6.9-rc1, the typedef genpd_xlate_t was updated to make 'of_phandle_args' argument const. Add a test to the conftest script to test if this argument is const and update the BPMP powergate driver accordingly. Bug 4471899 Change-Id: I85ddb3689ccf5dc769cd208575db69a2cf7b0a11 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3103819 Reviewed-by: Paritosh Dixit --- drivers/soc/tegra/powergate-bpmp.c | 10 +++++++--- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/soc/tegra/powergate-bpmp.c b/drivers/soc/tegra/powergate-bpmp.c index d733db4a..5b67dc7f 100644 --- a/drivers/soc/tegra/powergate-bpmp.c +++ b/drivers/soc/tegra/powergate-bpmp.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. - */ +// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +#include #include #include @@ -305,7 +305,11 @@ static void tegra_bpmp_remove_powergates(struct tegra_bpmp *bpmp) } static struct generic_pm_domain * +#if defined(NV_GENDPD_XLATE_T_HAS_CONST_OF_PHANDLE_ARGS) +tegra_powergate_xlate(const struct of_phandle_args *spec, void *data) +#else tegra_powergate_xlate(struct of_phandle_args *spec, void *data) +#endif { struct generic_pm_domain *domain = ERR_PTR(-ENOENT); struct genpd_onecell_data *genpd = data; diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index cc1e4a47..0a021488 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -119,6 +119,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_scdc_get_set_has_struct_drm_connector_ NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_coalesce_has_coal_and_extack_args NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_ringparam_has_ringparam_and_extack_args NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_rxfh_has_rxfh_param_args +NV_CONFTEST_FUNCTION_COMPILE_TESTS += genpd_xlate_t_has_const_of_phandle_args NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_file_rcu_has_double_ptr_file_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_new_client_device diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index be79e91f..62604cf1 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7075,6 +7075,26 @@ compile_test() { "NV_ETHTOOL_OPS_GET_SET_RXFH_HAS_RXFH_PARAM_ARGS" "" "types" ;; + genpd_xlate_t_has_const_of_phandle_args) + # + # Determine if genpd_xlate_t function pointer has a + # 'const struct of_phandle_args' argument. + # + # Commit 4d0824608a63 ("pmdomain: core: constify of_phandle_args in xlate") + # updated the typedef of genpd_xlate_t to make of_phandle_args argument const. + # + CODE=" + #include + void conftest_genpd_xlate_t_has_const_of_phandle_args(struct genpd_onecell_data *gpd, + const struct of_phandle_args *args, + void *data) + { + gpd->xlate(args, data); + }" + + compile_check_conftest "$CODE" "NV_GENDPD_XLATE_T_HAS_CONST_OF_PHANDLE_ARGS" "" "types" + ;; + netif_set_tso_max_size) # # Determine if netif_set_tso_max_size() function is present