From dbced7f18167b1c07d644fafe08d3125168348c5 Mon Sep 17 00:00:00 2001 From: Dong Qiang Date: Wed, 1 Mar 2023 11:25:45 +0000 Subject: [PATCH] drivers: Fix mods arm ffa error for kernel 6.2 Updated from ffa_ops to msg_ops for ffa api Bug 3974855 Change-Id: Ice2ccea2c860f05dbd862a49837eba071d563311 Signed-off-by: Dong Qiang Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2865316 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/misc/mods/Makefile | 4 ---- drivers/misc/mods/mods_arm_ffa.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/misc/mods/Makefile b/drivers/misc/mods/Makefile index bf620452..8b9a22bf 100644 --- a/drivers/misc/mods/Makefile +++ b/drivers/misc/mods/Makefile @@ -18,11 +18,7 @@ mods-y += mods_mem.o mods-$(CONFIG_ACPI) += mods_acpi.o mods-$(CONFIG_TEGRA_NVADSP) += mods_adsp.o -# mods_arm_ffa and mods_bpmpipc are currently broken for Linux v6.2 -# and so skip for Linux v6.2+ -ifeq ($(shell test $(LINUX_VERSION) -lt $(LINUX_VERSION_6_2); echo $$?),0) mods-$(CONFIG_ARM_FFA_TRANSPORT) += mods_arm_ffa.o -endif mods-$(CONFIG_TEGRA_IVC) += mods_bpmpipc.o mods-$(CONFIG_COMMON_CLK) += mods_clock.o mods-$(CONFIG_DEBUG_FS) += mods_debugfs.o diff --git a/drivers/misc/mods/mods_arm_ffa.c b/drivers/misc/mods/mods_arm_ffa.c index 2c8ff336..64178c6b 100644 --- a/drivers/misc/mods/mods_arm_ffa.c +++ b/drivers/misc/mods/mods_arm_ffa.c @@ -30,7 +30,11 @@ static const struct ffa_device_id mods_ffa_device_id[] = { struct mods_ffa_ctx { struct ffa_device *ffa_dev; +#if KERNEL_VERSION(6, 2, 0) <= MODS_KERNEL_VERSION + const struct ffa_msg_ops *ffa_ops; +#else const struct ffa_dev_ops *ffa_ops; +#endif }; static struct mods_ffa_ctx mods_ffa_info; @@ -38,9 +42,17 @@ static struct mods_ffa_ctx mods_ffa_info; static int ffa_probe(struct ffa_device *ffa_dev) { int ret = 0; + +#if KERNEL_VERSION(6, 2, 0) <= MODS_KERNEL_VERSION + const struct ffa_msg_ops *ffa_ops = NULL; + + if (ffa_dev->ops) + ffa_ops = ffa_dev->ops->msg_ops; +#else const struct ffa_dev_ops *ffa_ops; ffa_ops = ffa_dev_ops_get(ffa_dev); +#endif if (!ffa_ops) { mods_error_printk("failed \"method\" init: ffa\n"); return -ENOENT;