ufs: Fix Tegra UFS for Linux v6.15

In Linux v6.15, the pwr_change_notify() function was updated making the
3rd argument of type const. Add a conftest to detect this and update the
Tegra UFS driver accordingly.

JIRA LINQPJ14-47

Change-Id: I83f22bf0961200d9078fb35d408dac9149d786d2
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3330680
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Kartik Rajput <kkartik@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2025-02-19 14:57:39 +00:00
parent cf368bfa2b
commit 9672874453
3 changed files with 33 additions and 0 deletions

View File

@@ -1670,10 +1670,17 @@ static void ufs_tegra_scramble_enable(struct ufs_hba *hba)
}
}
#if defined(NV_UFS_HBA_VARIANT_OPS_PWR_CHANGE_NOTIFY_HAS_CONST_ARG) /* Linux v6.15 */
static int ufs_tegra_pwr_change_notify(struct ufs_hba *hba,
enum ufs_notify_change_status status,
const struct ufs_pa_layer_attr *dev_max_params,
struct ufs_pa_layer_attr *dev_req_params)
#else
static int ufs_tegra_pwr_change_notify(struct ufs_hba *hba,
enum ufs_notify_change_status status,
struct ufs_pa_layer_attr *dev_max_params,
struct ufs_pa_layer_attr *dev_req_params)
#endif
{
struct ufs_tegra_host *ufs_tegra = hba->priv;
u32 vs_save_config;

View File

@@ -221,6 +221,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_send_xchar_has_u8_ar
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_has_set_dma_mask
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ufs_hba_variant_ops_pwr_change_notify_has_const_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ufs_hba_variant_ops_suspend_has_status_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ufshcd_quirks_enum_has_ufshcd_quirk_broken_64bit_address
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ufshcd_quirks_enum_has_ufshcd_quirk_broken_power_seqeunce

View File

@@ -8668,6 +8668,31 @@ compile_test() {
compile_check_conftest "$CODE" "NV_UFS_HBA_VARIANT_OPS_HAS_SET_DMA_MASK" "" "types"
;;
ufs_hba_variant_ops_pwr_change_notify_has_const_arg)
#
# Determine if the 3rd argument of pwr_change_notify() is const.
#
# In Linux v6.15, commit 3bcd901e4257 ("scsi: ufs: Constify the third
# pwr_change_notify() argument") updated the pwr_change_notify()
# function making the 3rd argument of type const.
#
CODE="
#if defined(NV_UFS_UFSHCD_H_PRESENT)
#include <ufs/ufshcd.h>
#else
#include \"../drivers/scsi/ufs/ufshcd.h\"
#endif
void conftest(struct ufs_hba_variant_ops *ops) {
int (*fn)(struct ufs_hba *hba,
enum ufs_notify_change_status status,
const struct ufs_pa_layer_attr *desired_pwr_mode,
struct ufs_pa_layer_attr *final_params) = ops->pwr_change_notify;
}"
compile_check_conftest "$CODE" \
"NV_UFS_HBA_VARIANT_OPS_PWR_CHANGE_NOTIFY_HAS_CONST_ARG" "" "types"
;;
ufs_hba_variant_ops_suspend_has_status_arg)
#
# Determine if the 'suspend' function for the