From 742e79fa063a7549ac52b801e69eb9720cd3b240 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Wed, 12 Mar 2025 10:00:44 +0000 Subject: [PATCH] tegra: hwpm: Simplify CONFTEST presence check The variable 'NV_BUILD_SYSTEM_TYPE' is an NVIDIA internal Makefile variable used for building the Linux kernel. We should avoid using this in drivers where possible because otherwise it will require external users to set this. CONFTEST itself is not internal and is distributed with the NVIDIA OOT drivers. Rather than using 'NV_BUILD_SYSTEM_TYPE' to see if CONFTEST is presence, we can simply see if the 'srctree.conftest' variable is set and avoid using 'NV_BUILD_SYSTEM_TYPE' at all. Furthermore, given that the variable 'CONFIG_TEGRA_HWPM_CONFTEST' now defines if CONFTEST is present and this will only be set in the Makefile if 'CONFIG_TEGRA_HWPM_OOT' is set, then we don't need to check for both of these variables in the source files to determine if we need to include 'nvidia/conftest.h'. Bug 5120925 Change-Id: If9f6cebc7cc38414fce10a445ed090ba345e5002 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3318049 Reviewed-by: Yifei Wan Reviewed-by: Besar Wicaksono GVS: buildbot_gerritrpt Reviewed-by: svcacv Reviewed-by: Vasuki Shankar --- drivers/tegra/hwpm/Makefile | 2 +- drivers/tegra/hwpm/os/linux/driver.c | 2 +- drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c | 2 +- drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tegra/hwpm/Makefile b/drivers/tegra/hwpm/Makefile index e212091..04b50c4 100644 --- a/drivers/tegra/hwpm/Makefile +++ b/drivers/tegra/hwpm/Makefile @@ -43,7 +43,7 @@ ccflags-y += -DCONFIG_TEGRA_HWPM_OOT CONFIG_TEGRA_FUSE_UPSTREAM := y ccflags-y += -DCONFIG_TEGRA_FUSE_UPSTREAM -ifneq ($(NV_BUILD_SYSTEM_TYPE),) +ifneq ($(srctree.nvconftest),) ccflags-y += -DCONFIG_TEGRA_HWPM_CONFTEST ccflags-y += -I$(srctree.nvconftest) endif diff --git a/drivers/tegra/hwpm/os/linux/driver.c b/drivers/tegra/hwpm/os/linux/driver.c index c51a238..b6547b8 100644 --- a/drivers/tegra/hwpm/os/linux/driver.c +++ b/drivers/tegra/hwpm/os/linux/driver.c @@ -10,7 +10,7 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ -#if defined(CONFIG_TEGRA_HWPM_CONFTEST) && defined(CONFIG_TEGRA_HWPM_OOT) +#if defined(CONFIG_TEGRA_HWPM_CONFTEST) #include #endif diff --git a/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c index 670d638..408e6d7 100644 --- a/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c +++ b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only // SPDX-FileCopyrightText: Copyright (c) 2021-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -#if defined(CONFIG_TEGRA_HWPM_CONFTEST) && defined(CONFIG_TEGRA_HWPM_OOT) +#if defined(CONFIG_TEGRA_HWPM_CONFTEST) #include #endif #include diff --git a/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h index 8bed0f7..69625f7 100644 --- a/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h +++ b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h @@ -17,7 +17,7 @@ #ifndef TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H #define TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H -#if defined(CONFIG_TEGRA_HWPM_CONFTEST) && defined(CONFIG_TEGRA_HWPM_OOT) +#if defined(CONFIG_TEGRA_HWPM_CONFTEST) #include #endif