diff --git a/drivers/scsi/ufs/ufs-tegra-common.c b/drivers/scsi/ufs/ufs-tegra-common.c index 76e2455d..b49c5ece 100644 --- a/drivers/scsi/ufs/ufs-tegra-common.c +++ b/drivers/scsi/ufs/ufs-tegra-common.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only // Copyright (c) 2015-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +#include + #include #include #include @@ -960,11 +962,11 @@ static void ufs_tegra_context_restore(struct ufs_tegra_host *ufs_tegra) } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) -static int ufs_tegra_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) -#else +#if defined(NV_UFS_HBA_VARIANT_OPS_SUSPEND_HAS_STATUS_ARG) static int ufs_tegra_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op, enum ufs_notify_change_status status) +#else +static int ufs_tegra_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) #endif { struct ufs_tegra_host *ufs_tegra = hba->priv; diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index d8ed12a4..26e30372 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -152,6 +152,7 @@ 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_write_has_u8_ptr_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_set_termios_has_const_ktermios_arg +NV_CONFTEST_FUNCTION_COMPILE_TESTS += ufs_hba_variant_ops_suspend_has_status_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_connection_struct_present NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_match_type_enum_present NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_subdev_nf_init @@ -190,7 +191,8 @@ NV_HEADER_PRESENCE_TESTS = \ linux/kconfig.h \ linux/iosys-map.h \ net/gso.h \ - net/page_pool.h + net/page_pool.h \ + ufs/ufshcd.h # Filename to store the define for the header in $(1); this is only consumed by # the rule below that concatenates all of these together. diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 64d58ffa..1f87bc0b 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7515,6 +7515,31 @@ compile_test() { compile_check_conftest "$CODE" "NV_TTY_OPERATIONS_STRUCT_SET_TERMIOS_HAS_CONST_KTERMIOS_ARG" "" "types" ;; + ufs_hba_variant_ops_suspend_has_status_arg) + # + # Determine if the 'suspend' function for the + # 'struct ufs_hba_variant_ops' has a 'status' argument. + # + # In Linux v5.16, commit 9561f58442e4 ("scsi: ufs: + # mediatek: Support vops pre suspend to disable auto-hibern8") + # updated the arguments to the 'suspend' function of the + # 'struct ufs_hba_variant_ops'. + # + CODE=" + #if defined(NV_UFS_UFSHCD_H_PRESENT) + #include + #else + #include \"../drivers/scsi/ufs/ufshcd.h\" + #endif + void conftest_ufs_hba_variant_ops_suspend_has_status_arg( + struct ufs_hba_variant_ops *ops) { + int (*fn)(struct ufs_hba *, enum ufs_pm_op, + enum ufs_notify_change_status) = ops->suspend; + }" + + compile_check_conftest "$CODE" "NV_UFS_HBA_VARIANT_OPS_SUSPEND_HAS_STATUS_ARG" "" "types" + ;; + v4l2_async_connection_struct_present) # # Determine if the 'struct v4l2_async_connection' present or not.