From 85692c2c64ac389c5dc1cc918671c3ef7cbd2bd7 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 16 Jan 2024 15:34:15 +0000 Subject: [PATCH] scsi: ufs: Use conftest for Tegra264 The chip ID for Tegra264 was added in Linux v6.5 and not Linux v6.1 as indicated in the Tegra UFS driver. Hence, the Tegra UFS driver does not build against any generic Linux v6.1 to v6.4 kernel. Fix this by using conftest to determine if the chip ID definition is present in the kernel. Bug 4221847 Change-Id: If2ca1202b2a69bf7de36fc327406f1579d2f4969 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3054870 (cherry picked from commit abeacc353437eee2b407677931440b1296a71b62) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3054827 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/scsi/ufs/ufs-tegra-common.c | 8 +++++--- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufs-tegra-common.c b/drivers/scsi/ufs/ufs-tegra-common.c index 290fb174..ca1f07fd 100644 --- a/drivers/scsi/ufs/ufs-tegra-common.c +++ b/drivers/scsi/ufs/ufs-tegra-common.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only -// Copyright (c) 2015-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +#include #include @@ -1947,7 +1949,7 @@ static struct ufs_tegra_soc_data tegra234_soc_data = { .chip_id = TEGRA234, }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) +#if defined(NV_TEGRA264_CHIP_ID_PRESENT) /* Linux v6.5 */ static struct ufs_tegra_soc_data tegra264_soc_data = { .chip_id = TEGRA264, }; @@ -1960,7 +1962,7 @@ static const struct of_device_id ufs_tegra_of_match[] = { }, { .compatible = "tegra234,ufs_variant", .data = &tegra234_soc_data, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) +#if defined(NV_TEGRA264_CHIP_ID_PRESENT) /* Linux v6.5 */ }, { .compatible = "tegra264,ufs_variant", .data = &tegra264_soc_data, diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index d6b12841..f11fe10b 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -155,6 +155,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += simple_util_dai_init NV_CONFTEST_FUNCTION_COMPILE_TESTS += spi_driver_struct_remove_return_type_int NV_CONFTEST_FUNCTION_COMPILE_TESTS += spi_get_chipselect 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 += tty_operations_struct_send_xchar_has_u8_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 81ac3075..389d6152 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7541,6 +7541,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_TC_TAPRIO_QOPT_OFFLOAD_STRUCT_HAS_CMD" "" "types" ;; + tegra264_chip_id) + # + # Determine if the 'TEGRA264' definition is present. + # + # Added by commit d94436465152 ("soc/tegra: fuse: Add support for + # Tegra264") in Linux v6.5. + # + CODE=" + #include + u8 conftest_tegra264_chip_id(void) { + return TEGRA264; + }" + + compile_check_conftest "$CODE" "NV_TEGRA264_CHIP_ID_PRESENT" "" "types" + ;; + tegra_ivc_struct_has_iosys_map) # # Determine if the 'tegra_ivc' structure has the 'map' argument.