From 702def895cfaa7d4b6316b6c725763987057f75d Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Tue, 19 Dec 2023 09:48:19 +0000 Subject: [PATCH] camera: Use conftest to find if v4l2_async_notifier_* present use conftest to determine if APIs v4l2_async_notifier_*() present or not. These APIs have been renamed in commit 3c8c15391481 ("media: v4l: async: Rename async nf functions, clean up long lines") in Linux 5.16 Bug 4387902 Change-Id: Id2023543f487c3867ef4e140662141803ac63f04 Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037918 GVS: Gerrit_Virtual_Submit --- drivers/media/platform/tegra/camera/vi/graph.c | 7 +++---- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/tegra/camera/vi/graph.c b/drivers/media/platform/tegra/camera/vi/graph.c index 3f36f906..06cc3490 100644 --- a/drivers/media/platform/tegra/camera/vi/graph.c +++ b/drivers/media/platform/tegra/camera/vi/graph.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -426,7 +425,7 @@ void tegra_vi_graph_cleanup(struct tegra_mc_vi *vi) list_for_each_entry(chan, &vi->vi_chans, list) { #if defined(CONFIG_V4L2_ASYNC) -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) +#if defined(NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT) v4l2_async_notifier_unregister(&chan->notifier); #else v4l2_async_nf_unregister(&chan->notifier); @@ -667,7 +666,7 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi) i = 0; #if defined(CONFIG_V4L2_ASYNC) -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) +#if defined(NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT) v4l2_async_notifier_init(&chan->notifier); list_for_each_entry(entity, &chan->entities, list) __v4l2_async_notifier_add_subdev(&chan->notifier, &entity->asd); @@ -694,7 +693,7 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi) chan->subdevs_bound = 0; /* Register the async notifier for this channel */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) +#if defined(NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT) ret = v4l2_async_notifier_register(&vi->v4l2_dev, &chan->notifier); #else diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 02dcd299..4fd262f6 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -160,6 +160,7 @@ 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 +NV_CONFTEST_FUNCTION_COMPILE_TESTS += v4l2_async_notifier_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 2a06e202..82c92c70 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7631,6 +7631,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_V4L2_ASYNC_SUBDEV_NF_INIT_PRESENT" "" "functions" ;; + v4l2_async_notifier_init) + # + # Determine if the function v4l2_async_notifier_init() present or not. + # + # The API is renamed with commit 3c8c15391481 ("media: v4l: async: + # Rename async nf functions, clean up long lines") in Linux 5.16 + # + CODE=" + #include + void conftest_v4l2_async_notifier_init(void) { + v4l2_async_notifier_init(); + }" + + compile_check_conftest "$CODE" "NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT" "" "functions" + ;; + crypto_engine_ctx_struct_removed_test) # # Determine if struct 'crypto_engine_ctx' is removed in linux kernel.