mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
scsi: ufs: Use conftest for suspend differences
In Linux v5.19, the arguments to the 'suspend' function pointer defined in the structure 'ufs_hba_variant_ops' was updated to add a 'status' argument. Add a new test to the conftest script that checks if the 'suspend' function has a 'status' argument and use the definition created by conftest to select which structure member is used. This is beneficial for working with 3rd party Linux kernels that may have back-ported upstream changes into their kernel and so the kernel version checks do not work. Bug 4221847 Change-Id: I05011a4a1aff7c54cd258147d6519b696904a2de Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996214 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
54e01347ea
commit
f748f0ef72
@@ -1,6 +1,8 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
// Copyright (c) 2015-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
// Copyright (c) 2015-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
|
|
||||||
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/time.h>
|
#include <linux/time.h>
|
||||||
@@ -965,11 +967,11 @@ static void ufs_tegra_context_restore(struct ufs_tegra_host *ufs_tegra)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
#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)
|
|
||||||
#else
|
|
||||||
static int ufs_tegra_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
|
static int ufs_tegra_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
|
||||||
enum ufs_notify_change_status status)
|
enum ufs_notify_change_status status)
|
||||||
|
#else
|
||||||
|
static int ufs_tegra_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
struct ufs_tegra_host *ufs_tegra = hba->priv;
|
struct ufs_tegra_host *ufs_tegra = hba->priv;
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_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 += 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_write_has_u8_ptr_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_connection_struct_present
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_match_type_enum_present
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_match_type_enum_present
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_subdev_nf_init
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_subdev_nf_init
|
||||||
@@ -181,7 +182,8 @@ NV_HEADER_PRESENCE_TESTS = \
|
|||||||
linux/iosys-map.h \
|
linux/iosys-map.h \
|
||||||
net/gso.h \
|
net/gso.h \
|
||||||
net/page_pool.h \
|
net/page_pool.h \
|
||||||
soc/tegra/tegra-prod.h
|
soc/tegra/tegra-prod.h \
|
||||||
|
ufs/ufshcd.h
|
||||||
|
|
||||||
# Filename to store the define for the header in $(1); this is only consumed by
|
# Filename to store the define for the header in $(1); this is only consumed by
|
||||||
# the rule below that concatenates all of these together.
|
# the rule below that concatenates all of these together.
|
||||||
|
|||||||
@@ -7399,6 +7399,31 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_TTY_OPERATIONS_STRUCT_WRITE_HAS_U8_PTR_ARG" "" "functions"
|
compile_check_conftest "$CODE" "NV_TTY_OPERATIONS_STRUCT_WRITE_HAS_U8_PTR_ARG" "" "functions"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
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 <ufs/ufshcd.h>
|
||||||
|
#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)
|
v4l2_async_connection_struct_present)
|
||||||
#
|
#
|
||||||
# Determine if the 'struct v4l2_async_connection' present or not.
|
# Determine if the 'struct v4l2_async_connection' present or not.
|
||||||
|
|||||||
Reference in New Issue
Block a user