From 1f0954f43d8c121f92da4e7e29279a0543de1ac2 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Tue, 5 Dec 2023 19:25:29 +0000 Subject: [PATCH] media: Use conftest to find if v4l2_async_subdev_nf_init() present Use conftest to find if function v4l2_async_subdev_nf_init() is present or not. In Linux 6.5, with change commit bda8953e8c3e7e ("media: v4l: async: Drop v4l2_async_nf_parse_fwnode_endpoints()"), added the function v4l2_async_subdev_nf_init() and dropped v4l2_async_nf_init(). Bug 4346767 Change-Id: I345db2acf0a07d05722611d9eacc7134aff0c35a Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028766 (cherry picked from commit 3839cecd1c1cb1ce6ea789979edfbfffe3deae24) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053708 Tested-by: mobile promotions Reviewed-by: mobile promotions --- Makefile | 3 --- drivers/media/platform/tegra/camera/vi/graph.c | 4 ++-- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 17 +++++++++++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ceaa6ad1..b7b07034 100644 --- a/Makefile +++ b/Makefile @@ -24,9 +24,6 @@ endif # Changes done in Linux 6.6 onwards ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_6); echo $$?),0) -# Rename async_nf_init and v4l2_async_subdev_nf_register -subdir-ccflags-y += -DNV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME - # Crypto driver has major change in it ops, skip it export CONFIG_SKIP_CRYPTO=y endif diff --git a/drivers/media/platform/tegra/camera/vi/graph.c b/drivers/media/platform/tegra/camera/vi/graph.c index 58d8c84c..4d71dd12 100644 --- a/drivers/media/platform/tegra/camera/vi/graph.c +++ b/drivers/media/platform/tegra/camera/vi/graph.c @@ -672,7 +672,7 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi) list_for_each_entry(entity, &chan->entities, list) __v4l2_async_notifier_add_subdev(&chan->notifier, &entity->asd); #else -#if defined (NV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME) +#if defined (NV_V4L2_ASYNC_SUBDEV_NF_INIT_PRESENT) /* Linux 6.5 */ v4l2_async_subdev_nf_init(&chan->notifier, tegra_channel_find_linked_csi_subdev(chan)); list_for_each_entry(entity, &chan->entities, list) { struct v4l2_async_connection *asd; @@ -698,7 +698,7 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi) ret = v4l2_async_notifier_register(&vi->v4l2_dev, &chan->notifier); #else -#if defined (NV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME) +#if defined (NV_V4L2_ASYNC_SUBDEV_NF_INIT_PRESENT) /* Linux 6.5 */ ret = v4l2_async_nf_register(&chan->notifier); #else ret = v4l2_async_nf_register(&vi->v4l2_dev, diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 18d8a298..2a4bccf8 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -152,6 +152,7 @@ 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 += 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 NV_CONFTEST_FUNCTION_COMPILE_TESTS += vm_area_struct_has_const_vm_flags NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_fd_to_handle NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_handle_to_fd diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index ceca2949..eee39cb6 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7509,6 +7509,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_V4L2_ASYNC_MATCH_TYPE_ENUM_PRESENT" "" "types" ;; + v4l2_async_subdev_nf_init) + # + # Determine if the function v4l2_async_subdev_nf_init() present or not. + # + # In Linux 6.5, with change commit bda8953e8c3e7e ("media: v4l: async: + # Drop v4l2_async_nf_parse_fwnode_endpoints()"), added the function + # v4l2_async_subdev_nf_init() and dropped v4l2_async_nf_init(). + # + CODE=" + #include + void conftest_v4l2_async_subdev_nf_init(void) { + v4l2_async_subdev_nf_init(); + }" + + compile_check_conftest "$CODE" "NV_V4L2_ASYNC_SUBDEV_NF_INIT_PRESENT" "" "functions" + ;; + # When adding a new conftest entry, please use the correct format for # specifying the relevant upstream Linux kernel commit. #